You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conditional statements are not working when I use 'mathematical-treeprocessor' extension.
The "hello world" string doesn't apear when using 'preprossor extension'.
Unfortunately, this is one of the limitations of a preprocessor. A preprocessor does not see the structure of the AsciiDoc document in any way, aside from the preprocessor directives. As far as the preprocessor is concerned, it's just handling lines of text, some of which may contain preprocessor directives.
If you want the preprocessor to know about the attributes defined in the document header, you first need to parse the document up to the end of the document header, push those attributes into the document object, then allow the preprocessor to proceed.
What we may want to consider is adding an option to the Preprocessor that tells it to parse the document header in order to extract the attributes, then run on the remaining lines of code. That change would need to happen in core.
There is a fix. Instead of returning a new Reader from your preprocessor, return a new PreprocessorReader initialised with your processed raw lines, thus:
class myPreprocessor <Asciidoctor::Extensions::Preprocessor
def process document, reader
Asciidoctor::PreprocessorReader.new document, reader.lines.map {|line|
# do your stuff here..
line
}
end
end
Conditional statements are not working when I use 'mathematical-treeprocessor' extension.
The "hello world" string doesn't apear when using 'preprossor extension'.
Conditional statements are working well when I delete mathematical-preprocessor code on 'mathematical-treeprocessor.rb'.
I've tested several other preprocessors, it's same on other preprocessors make same problem too.
Conditional statements which looks for CLI attributes works well.
Only conditional satements which looks for DOCUMENT attributes are not working.
The text was updated successfully, but these errors were encountered: