DocBook writer: add id to para if in Div with id element.
This makes the writer work properly with linked bibliographic items with pandoc-citeproc. Closes jgm/pandoc-citeproc#132.
This commit is contained in:
parent
2fb5709915
commit
f532dd69c9
1 changed files with 8 additions and 0 deletions
|
@ -154,6 +154,14 @@ listItemToDocbook opts item =
|
|||
-- | Convert a Pandoc block element to Docbook.
|
||||
blockToDocbook :: WriterOptions -> Block -> Doc
|
||||
blockToDocbook _ Null = empty
|
||||
-- Add ids to paragraphs in divs with ids - this is needed for
|
||||
-- pandoc-citeproc to get link anchors in bibliographies:
|
||||
blockToDocbook opts (Div (ident,_,_) [Para lst]) =
|
||||
let attribs = [("id", ident) | not (null ident)] in
|
||||
if hasLineBreaks lst
|
||||
then flush $ nowrap $ inTags False "literallayout" attribs
|
||||
$ inlinesToDocbook opts lst
|
||||
else inTags True "para" attribs $ inlinesToDocbook opts lst
|
||||
blockToDocbook opts (Div _ bs) = blocksToDocbook opts $ map plainToPara bs
|
||||
blockToDocbook _ (Header _ _ _) = empty -- should not occur after hierarchicalize
|
||||
blockToDocbook opts (Plain lst) = inlinesToDocbook opts lst
|
||||
|
|
Loading…
Reference in a new issue