diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-11-16 18:21:33 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-11-16 18:21:33 -0800 |
commit | 202d404d654b0d5222124f3db15a9c9b9380193d (patch) | |
tree | d73266a2d1469712fae1381bd447fc41afd4b5d6 /src | |
parent | 2a44140e114a6b31e63056eb2615cf8b99fd0d9b (diff) | |
download | pandoc-202d404d654b0d5222124f3db15a9c9b9380193d.tar.gz |
ConTeXt writer: set csl-hanging-ident variable if needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/ConTeXt.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 08fa99451..3e6a13d3f 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -40,6 +40,7 @@ data WriterState = , stOrderedListLevel :: Int -- level of ordered list , stOptions :: WriterOptions -- writer options , stHasCslRefs :: Bool -- has CSL citations + , stCslHangingIndent :: Bool -- CSL hanging indent } data Tabl = Xtb | Ntb deriving (Show, Eq) @@ -54,6 +55,7 @@ writeConTeXt options document = , stOrderedListLevel = 0 , stOptions = options , stHasCslRefs = False + , stCslHangingIndent = False } in evalStateT (pandocToConTeXt options document) defaultWriterState @@ -93,6 +95,7 @@ pandocToConTeXt options (Pandoc meta blocks) = do $ defField "layout" layoutFromMargins $ defField "number-sections" (writerNumberSections options) $ defField "csl-refs" (stHasCslRefs st) + $ defField "csl-hanging-indent" (stCslHangingIndent st) $ maybe id (\l -> defField "context-lang" (literal l :: Doc Text)) mblang $ (case T.unpack . render Nothing <$> @@ -187,8 +190,9 @@ blockToConTeXt (CodeBlock _ str) = blockToConTeXt b@(RawBlock f str) | f == Format "context" || f == Format "tex" = return $ literal str <> blankline | otherwise = empty <$ report (BlockNotRendered b) -blockToConTeXt (Div ("refs",_,_) bs) = do - modify $ \st -> st{ stHasCslRefs = True } +blockToConTeXt (Div ("refs",classes,_) bs) = do + modify $ \st -> st{ stHasCslRefs = True + , stCslHangingIndent = "hanging-indent" `elem` classes } inner <- blockListToConTeXt bs return $ "\\startcslreferences" $$ inner $$ "\\stopcslreferences" blockToConTeXt (Div (ident,_,kvs) bs) = do |