asciidoctor/asciidoctor-latex

dollar signs in source blocks

maverickwoo opened this issue · 2 comments

It seems asciidoctor-latex currently parses the content of a source block. The following example shows their interaction.

foo.adoc:

= Include Bug Demo

Testing $x$, $y$.

[source,perl]
----
print $_, $_;
----

EOF

The output for the source block is:

print pass:[\(_, \)]_;

This seems counterintuitive since we may expect that a source block to be processed only by a source highlighter. While we may expect the writer to alter the code in a source block to escape the dollar signs and thus this interaction may be acceptable, this interaction effectively prohibits the use of include, (e.g., include::bar.pl[]).

I agree this should not happen. This is the danger of using a preprocessor to process syntax. A preprocessor does not recognize the structure of the AsciiDoc document, so it's going to lead to these sorts of bugs. A tree processor is the right solution because it can choose which nodes in the tree to process.

(I'm considering other types of extensions that might offer more flexibility, but those are still just considerations).

Does this mean there is currently no safe method to use include with asciidoctor-latex? Thanks!