git.iko.soy/typeable/pandoc
on master help sign in
ConTeXt writer: Add reference anchors to Div with ids.
c1f6d5eJohn MacFarlane
src/Text/Pandoc/Writers/ConTeXt.hs+7−1
@@ -151,7 +151,13 @@ blockToConTeXt (CodeBlock _ str) =
151 -- blankline because \stoptyping can't have anything after it, inc. '}'
151 -- blankline because \stoptyping can't have anything after it, inc. '}'
152blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
152blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
153blockToConTeXt (RawBlock _ _ ) = return empty
153blockToConTeXt (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
155blockToConTeXt (BulletList lst) = do
161blockToConTeXt (BulletList lst) = do
156 contents <- mapM listItemToConTeXt lst
162 contents <- mapM listItemToConTeXt lst
157 return $ ("\\startitemize" <> if isTightList lst
163 return $ ("\\startitemize" <> if isTightList lst