Re: Extensions of useful macros for software documentation
Posted by mariocup on Mar 03, 2019; 12:44pm
URL: https://discuss.asciidoctor.org/Re-Extensions-of-useful-macros-for-software-documentation-tp6756p6771.html
Hi Dan,
I want to use the macro like
```
file::name.o
```
instead of
```
file::name.o[]
```
I was not able to achieve it with a block macro file::target[attrlist]. Only file::name.o[] seem to work.
Some of the macros have been rewritten in a way that they work also with hierarchical include directives. This was a problem before I switched to the Preprocessor.
In addition I am facing some issues with the current implementation of the opt and file macro.
```
lines.map do |line|
while ((startIndex = line.index("opt::")))
if match = /(\w*-*(<\w*\s*\w*>)*)*/.match(line[(startIndex + 5)..-1])[0]
line.insert(startIndex + 5 + match.length, "`")
line[startIndex..startIndex+4] = "`-"
end
end
end
```
and file
```
lines.map do |line|
while ((startIndex = line.index("file::")))
if match = /([[:punct:]]|\w)*\.\w+/.match(line[(startIndex + 6)..-1])[0]
line.insert(startIndex + 6 + match.length, "`")
line[startIndex..startIndex+5] = "`"
end
```
As debugging of macros is no fun I would be very happy for any hints how to use the macros correctly.