asciidoctor-latex icon indicating copy to clipboard operation
asciidoctor-latex copied to clipboard

dollar signs in source blocks

Open maverickwoo opened this issue 7 years ago • 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[]).

maverickwoo avatar Aug 21 '17 03:08 maverickwoo

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).

mojavelinux avatar Sep 04 '17 21:09 mojavelinux

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

maverickwoo avatar Sep 23 '17 03:09 maverickwoo