asciidoctor / asciidoctor-latex

:triangular_ruler: Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
http://asciidoctor.org
Other
111 stars 26 forks source link

dollar signs in source blocks #69

Open maverickwoo opened 6 years ago

maverickwoo commented 6 years ago

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

mojavelinux commented 6 years ago

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

maverickwoo commented 6 years ago

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