diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-29 20:01:51 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-29 20:01:51 -0700 |
commit | 45d26fd01adc3aa14dd090f3faedf9d47718b54f (patch) | |
tree | d41cce9038ec12492f53600fde70f5d8774bbe5d /src/Text/Pandoc/Writers/Docx.hs | |
parent | 3c8f17b52c9475a3c10d2c77164233bf2179e9b6 (diff) | |
parent | 0587334bc0c87ae62f37cf14543b7727d408aeca (diff) | |
download | pandoc-45d26fd01adc3aa14dd090f3faedf9d47718b54f.tar.gz |
Merge pull request #1383 from jkr/writer-bookmark-fix
Docx writer: insert bookmark tags inside <w:p> tag.
Diffstat (limited to 'src/Text/Pandoc/Writers/Docx.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 31e64f14e..4b787b023 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -514,8 +514,11 @@ blockToOpenXML :: WriterOptions -> Block -> WS [Element] blockToOpenXML _ Null = return [] blockToOpenXML opts (Div _ bs) = blocksToOpenXML opts bs blockToOpenXML opts (Header lev (ident,_,_) lst) = do - contents <- withParaProp (pStyle $ "Heading" ++ show lev) $ - blockToOpenXML opts (Para lst) + + paraProps <- withParaProp (pStyle $ "Heading" ++ show lev) $ + getParaProps False + contents <- inlinesToOpenXML opts lst + usedIdents <- gets stSectionIds let bookmarkName = if null ident then uniqueIdent lst usedIdents @@ -525,7 +528,7 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do let bookmarkStart = mknode "w:bookmarkStart" [("w:id", id') ,("w:name",bookmarkName)] () let bookmarkEnd = mknode "w:bookmarkEnd" [("w:id", id')] () - return $ [bookmarkStart] ++ contents ++ [bookmarkEnd] + return [mknode "w:p" [] (paraProps ++ [bookmarkStart, bookmarkEnd] ++ contents)] blockToOpenXML opts (Plain lst) = withParaProp (pStyle "Compact") $ blockToOpenXML opts (Para lst) -- title beginning with fig: indicates that the image is a figure |