pandoc
pandoc copied to clipboard
DocBook writer: output identifiers of figure blocks
@reviewer: I am not sure if the id needs to be prefixed with writerIdentifierPrefix opts
as done in line 190 (this is the only place where the prefix is added AFAICT).
Note: In contrast to the DocBook writer, the DocBook reader already supports the identifier.
Behavior before the change:
$ pandoc -f Markdown -t docbook <<<'{#testid}' | pandoc -f docbook -t markdown

Behavior after the change:
$ pandoc -f Markdown -t docbook <<<'{#testid}' | pandoc -f docbook -t markdown
{#testid}
Docs for --id-prefix
say "Specify a prefix to be added to all identifiers and internal links in HTML and DocBook output," so yes, I'd say it should be added in this case too.
I’ve added the prefix. However, now I seriously wonder if the prefix is maybe also missing at other places in the DocBook writer. The following
:::{#bar}
bar div
:::
:::{#sec .section}
sec div
:::
[foo link](#foo)
[span]{#spanid}
{#testid}
translates via pandoc --id-prefix=prefix- -f Markdown -t docbook
(including this change) to
<para xml:id="bar">
bar div
</para>
<para xml:id="sec">
sec div
</para>
<para>
<link linkend="prefix-foo">foo link</link>
</para>
<para>
<anchor xml:id="spanid" />span
</para>
<figure xml:id="prefix-testid">
<title>caption text</title>
<mediaobject>
<imageobject>
<imagedata fileref="file.svg" />
</imageobject>
<textobject><phrase>caption text</phrase></textobject>
</mediaobject>
</figure>
Note that prefix-
is not added to every id.
Hi, I'm sorry I let this languish so long.
You're right that the prefix isn't added everywhere it should be. Perhaps that could be addressed in a separate PR. Or, feel free to address it here.
I'll add one substantive comment to your code above.
It would also be great to have a test. Simplest way is a "command test" called test/command/8608.md
. See the other files in that directory for examples.