diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 18:06:15 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 18:06:15 +0200 |
commit | bd99d9f6affedd476d5fe14bef267197cb3e5f55 (patch) | |
tree | 96bd2e3d5617b29fd2961fe211b33c9576e686a8 /src/Text | |
parent | 5354b441706b7c745efecb9174b00625c2d6bab3 (diff) | |
download | pandoc-bd99d9f6affedd476d5fe14bef267197cb3e5f55.tar.gz |
Ms writer: Add PDF outline bookmarks.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/Ms.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs index 60e1f6041..0536e0cfb 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -249,6 +249,8 @@ blockToMs opts (Header level (ident,classes,_) inlines) = do then empty else nowrap $ text ".pdfhref M " <> doubleQuotes (text ident) + let bookmark = text ".pdfhref O " <> text (show level ++ " ") <> + doubleQuotes (text (escapeString (stringify inlines))) let tocEntry = if writerTableOfContents opts && level <= writerTOCDepth opts then text ".XS" $$ @@ -262,6 +264,7 @@ blockToMs opts (Header level (ident,classes,_) inlines) = do modify $ \st -> st{ stFirstPara = True } return $ (text heading <> space <> text (show level)) $$ contents $$ + bookmark $$ anchor $$ tocEntry blockToMs _ (CodeBlock _ str) = do |