diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-05-16 14:39:20 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-05-16 14:39:20 -0700 |
commit | bde3d7622ddd2cda7adabc309335bb2865c1d520 (patch) | |
tree | 989b3828ed52aa9658011af4aa31a0069dc1e734 /src/Text/Pandoc/Writers | |
parent | cc7dcf2a92ca10cb12a86370b717092a789bc3fe (diff) | |
download | pandoc-bde3d7622ddd2cda7adabc309335bb2865c1d520.tar.gz |
OpenDocument writer: add custom-style "Abstract" in metadata abstract.
This ensures that the abstract is rendered with style Abstract.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index 6fd0dd5dd..c6b66382b 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -28,6 +28,7 @@ import Text.Pandoc.BCP47 (Lang (..), parseBCP47) import Text.Pandoc.Class.PandocMonad (PandocMonad, report, translateTerm, setTranslations, toLang) import Text.Pandoc.Definition +import qualified Text.Pandoc.Builder as B import Text.Pandoc.Logging import Text.Pandoc.Options import Text.DocLayout @@ -223,12 +224,18 @@ writeOpenDocument opts (Pandoc meta blocks) = do let colwidth = if writerWrapText opts == WrapAuto then Just $ writerColumns opts else Nothing + let meta' = case lookupMetaBlocks "abstract" meta of + [] -> meta + xs -> B.setMeta "abstract" + (B.divWith ("",[],[("custom-style","Abstract")]) + (B.fromList xs)) + meta ((body, metadata),s) <- flip runStateT defaultWriterState $ do m <- metaToContext opts (blocksToOpenDocument opts) (fmap chomp . inlinesToOpenDocument opts) - meta + meta' b <- blocksToOpenDocument opts blocks return (b, m) let styles = stTableStyles s ++ stParaStyles s ++ formulaStyles ++ |