diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-07-26 22:55:31 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-07-26 22:55:45 -0700 |
commit | 2610de0159cb73948d8972a59bbdcbb8ebc6f468 (patch) | |
tree | 7a2d11a89d2c4b715ee49c8c5f881a9daf83e044 /src | |
parent | d9751f91c43ad96becb6aaf2f5abcd9c0b37754c (diff) | |
download | pandoc-2610de0159cb73948d8972a59bbdcbb8ebc6f468.tar.gz |
Docx writer: include abstract with Abstract style.
Addresses docx part of #1451.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index de31e462e..3d9586348 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -481,17 +481,24 @@ writeOpenXML opts (Pandoc meta blocks) = do _ -> [] let auths = docAuthors meta let dat = docDate meta + let abstract' = case lookupMeta "abstract" meta of + Just (MetaBlocks bs) -> bs + Just (MetaInlines ils) -> [Plain ils] + Nothing -> [] title <- withParaProp (pStyle "Title") $ blocksToOpenXML opts [Para tit | not (null tit)] authors <- withParaProp (pStyle "Authors") $ blocksToOpenXML opts [Para (intercalate [LineBreak] auths) | not (null auths)] date <- withParaProp (pStyle "Date") $ blocksToOpenXML opts [Para dat | not (null dat)] + abstract <- if null abstract' + then return [] + else withParaProp (pStyle "Abstract") $ blocksToOpenXML opts abstract' let convertSpace (Str x : Space : Str y : xs) = Str (x ++ " " ++ y) : xs convertSpace (Str x : Str y : xs) = Str (x ++ y) : xs convertSpace xs = xs let blocks' = bottomUp convertSpace $ blocks doc' <- blocksToOpenXML opts blocks' notes' <- reverse `fmap` gets stFootnotes - let meta' = title ++ authors ++ date + let meta' = title ++ authors ++ date ++ abstract return (meta' ++ doc', notes') -- | Convert a list of Pandoc blocks to OpenXML. |