Closed manuelfuenmayor closed 3 months ago
Yeah, this is going to need double escaping.
Passthrough, which is being invoked here, converts <
to <
and &
to &
, as it should:
<title>Asciidoctor: A fast text processor & publishing
toolchain for converting AsciiDoc to HTML5,
DocBook & more.</title>
ends up as
<title>Asciidoctor: A fast text processor & publishing
toolchain for converting AsciiDoc to HTML5,
DocBook & more.</title>
Which will convert back to:
<title>Asciidoctor: A fast text processor & publishing
toolchain for converting AsciiDoc to HTML5,
DocBook & more.</title>
And that's the problem: the passthrough is assuming &
should be left as &
, and it shouldn't, it should end up as &amp;
.
Pass blocks are being processed by decoding and then re-encoding XML escapes, to ensure that any escapes in passthroughs are resolved. That is resulting in & &
=> & &
=> & &
The only way we are going to get a coherent outcome here is if we do not decode the XML: if we find &
in a pass through, we good and encode it as &mp;
, and if we see ‌
, we do not try and resolve it to —
. That was a naive decision, and Asciidoctor doesn't try that kind of thing; it passes through & &
to HTML as & &
. Neither should Metanorma.
In relation to https://github.com/metanorma/rfc-asciidoc-rfc/issues/26
Description
Presence of
&
entity in XML reference causes compilation failure.XML reference sample:
(See
<title>
tag)To replicate
Use this branch from rfc-asciidoc-rfc repository: https://github.com/metanorma/rfc-asciidoc-rfc/tree/test-amp-bug, and try to compile the
draft-ribose-asciirfc.adoc
file. To succeed in compilation, remove the&
entities from both:./references/informative/asciidoctor-manual.xml
and./references/informative/asciidoctor.xml
.