aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-28 17:46:26 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-28 17:46:26 -0700
commitc1f6d5e31feddacb9fa519e688da2d50a3f214ad (patch)
tree6688be0b9e13abbfcbc62990f48ab7b392bceb03
parente54c8613e82b1df7c1b9940a3d333fbbd6394473 (diff)
downloadpandoc-c1f6d5e31feddacb9fa519e688da2d50a3f214ad.tar.gz
ConTeXt writer: Add reference anchors to Div with ids.
This is useful for pandoc-citeproc linked citations.
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 20ac96d8d..6f45617bb 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -151,7 +151,13 @@ blockToConTeXt (CodeBlock _ str) =
-- blankline because \stoptyping can't have anything after it, inc. '}'
blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
blockToConTeXt (RawBlock _ _ ) = return empty
-blockToConTeXt (Div _ bs) = blockListToConTeXt bs
+blockToConTeXt (Div (ident,_,_) bs) = do
+ contents <- blockListToConTeXt bs
+ if null ident
+ then return contents
+ else return $
+ ("\\reference" <> brackets (text $ toLabel ident) <> braces empty)
+ $$ contents
blockToConTeXt (BulletList lst) = do
contents <- mapM listItemToConTeXt lst
return $ ("\\startitemize" <> if isTightList lst