From c1f6d5e31feddacb9fa519e688da2d50a3f214ad Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 28 May 2015 17:46:26 -0700 Subject: ConTeXt writer: Add reference anchors to Div with ids. This is useful for pandoc-citeproc linked citations. --- src/Text/Pandoc/Writers/ConTeXt.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3