OpenDocument writer: add custom-style "Abstract" in metadata abstract.
This ensures that the abstract is rendered with style Abstract.
This commit is contained in:
parent
cc7dcf2a92
commit
bde3d7622d
1 changed files with 8 additions and 1 deletions
|
@ -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 ++
|
||||
|
|
Loading…
Reference in a new issue