diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-07-29 20:39:59 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-07-29 20:46:55 -0700 |
commit | 33a051d00d01974f3cdc3942e647bdd85979e96c (patch) | |
tree | 732914067ad44f8d07f134e35d9102ec4c99f7e3 /src/Text/Pandoc/Writers | |
parent | 8c2ed54e2e6819aee2bb4b948102fbab8f920d86 (diff) | |
download | pandoc-33a051d00d01974f3cdc3942e647bdd85979e96c.tar.gz |
Docx writer: Print subtitle from metadata if present.
Use Subtitle style.
See #1451.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 8629becff..2a1731c1e 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -485,9 +485,15 @@ writeOpenXML opts (Pandoc meta blocks) = do Just (MetaBlocks bs) -> bs Just (MetaInlines ils) -> [Plain ils] _ -> [] + let subtitle' = case lookupMeta "subtitle" meta of + Just (MetaBlocks [Plain xs]) -> xs + Just (MetaBlocks [Para xs]) -> xs + Just (MetaInlines xs) -> xs + _ -> [] title <- withParaProp (pStyle "Title") $ blocksToOpenXML opts [Para tit | not (null tit)] - authors <- withParaProp (pStyle "Authors") $ blocksToOpenXML opts - [Para (intercalate [LineBreak] auths) | not (null auths)] + subtitle <- withParaProp (pStyle "Subtitle") $ blocksToOpenXML opts [Para subtitle' | not (null subtitle')] + authors <- withParaProp (pStyle "Author") $ blocksToOpenXML opts $ + map Para auths date <- withParaProp (pStyle "Date") $ blocksToOpenXML opts [Para dat | not (null dat)] abstract <- if null abstract' then return [] @@ -498,7 +504,7 @@ writeOpenXML opts (Pandoc meta blocks) = do let blocks' = bottomUp convertSpace $ blocks doc' <- blocksToOpenXML opts blocks' notes' <- reverse `fmap` gets stFootnotes - let meta' = title ++ authors ++ date ++ abstract + let meta' = title ++ subtitle ++ authors ++ date ++ abstract return (meta' ++ doc', notes') -- | Convert a list of Pandoc blocks to OpenXML. |