aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-12-13 08:56:22 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-12-13 08:56:22 -0800
commit3e079a25bce7165a618f01d2e7625bab4ca33b6b (patch)
tree1d1bf34498d084a2dd54271139234d4084a24ee8 /src
parent44120ea7165546152af88fd442c52ab0f201052e (diff)
downloadpandoc-3e079a25bce7165a618f01d2e7625bab4ca33b6b.tar.gz
AsciiDoc writers: Add anchors on Div elements.
This partially addresses jgm/pandoc-citeproc#143. It does not use the native asciidoc syntax for citations, but it does get the links to individual citations working.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/AsciiDoc.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index 1038044e7..b767aa669 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -253,7 +253,10 @@ blockToAsciiDoc opts (OrderedList (_start, sty, _delim) items) = do
blockToAsciiDoc opts (DefinitionList items) = do
contents <- mapM (definitionListItemToAsciiDoc opts) items
return $ cat contents <> blankline
-blockToAsciiDoc opts (Div _ bs) = blockListToAsciiDoc opts bs
+blockToAsciiDoc opts (Div (ident,_,_) bs) = do
+ let identifier = if (null ident) then empty else ("[[" <> text ident <> "]]")
+ contents <- blockListToAsciiDoc opts bs
+ return $ identifier $$ contents
-- | Convert bullet list item (list of blocks) to asciidoc.
bulletListItemToAsciiDoc :: WriterOptions -> [Block] -> State WriterState Doc