I've included a stripped-down example (tarball attached), but the core problem is that given asciidoc input like this:
[[submit,submit]]
ifdef::inctext[]
If this sentence is commented out, the anchor fails to work when using a2x
(but not when using asciidoc).
endif::inctext[]
[source,{basebackend@docbook:c++:cpp}]
------------------------------------------------------------------------------
int somefunc(
int arg);
------------------------------------------------------------------------------
Then when run through a2x to get xhtml output:
- If the 'inctext' attribute is defined - e.g. if some plain text
immediately follows the [[submit]] anchor - then it works OK and
xrefs to that anchor are present in the generated XHTML.
- If the 'inctext' attribute is not defined - e.g. if the [source]
directive immediately follows the [[submit]] anchor - then xmllint
fails and no output is generated, because the generated intermediate
Docbook XML does not contain 'id' and 'xreflabel' attributes on the
<programlisting> tag corresponding to [source]. It's unclear why,
since those attributes are supported by the Docbook schema, and
Docbook will do the right thing if they're manually inserted in the
intermediate XML on the <programlisting> tag.
While hoping for this to be fixed, in the meantime, any suggestions
on workarounds? Is there perhaps a way to insert invisible content after
the anchor that *will* get id/xreflabel attributes attached, but will
remain attached to the [source] block so it will have the *effect* of
placing the anchor there? I need to do this in hundreds of places in the
document this problem came up in, but the [source] blocks are
generated, so it's easy to apply a workaround to all of them at once.
Note that the problem does not occur when using asciidoc directly to
its single-file HTML target. But I do need to generate output in other
forms, such as chunked HTML. So going through a2x seems to be
unavoidable (or at least, going through the asciidoc -> Docbook ->
xsltproc -> output chain, whether or not using a2x).
Also note that this is a bug with asciidoc's docbook output,
not with a2x per se.
Thanks,
Jon Leech
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/d/optout.
test.tar
Description: Unix tar archive
