git.iko.soy/typeable/pandoc
on master help sign in
ConTeXt writer: Add reference anchors to Div with ids.

This is useful for pandoc-citeproc linked citations.

commitc1f6d5e31feddacb9fa519e688da2d50a3f214ad authorJohn MacFarlane <jgm@berkeley.edu> dateThu 28 May 2015, 17:46 (11 years ago) parente54c861
1 file changed+7−1
src/Text/Pandoc/Writers/ConTeXt.hs+7−1
src/Text/Pandoc/Writers/ConTeXt.hs+7−1
@@ -151,7 +151,13 @@ blockToConTeXt (CodeBlock _ str) =
151151 -- blankline because \stoptyping can't have anything after it, inc. '}'
152152blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
153153blockToConTeXt (RawBlock _ _ ) = return empty
154−blockToConTeXt (Div _ bs) = blockListToConTeXt bs
154+blockToConTeXt (Div (ident,_,_) bs) = do
155+ contents <- blockListToConTeXt bs
156+ if null ident
157+ then return contents
158+ else return $
159+ ("\\reference" <> brackets (text $ toLabel ident) <> braces empty)
160+ $$ contents
155161blockToConTeXt (BulletList lst) = do
156162 contents <- mapM listItemToConTeXt lst
157163 return $ ("\\startitemize" <> if isTightList lst