aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-25 19:30:24 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-25 19:30:24 +0100
commitc941a00cac0655349b6c03618bc096ac07237779 (patch)
tree3eb53fba06e475b3ba56368f498271f7e368ecc2
parent7d3d5387ac9c34d88375739188f7fcaa494b82c2 (diff)
downloadpandoc-c941a00cac0655349b6c03618bc096ac07237779.tar.gz
Ms writer: improved pdf metadata.
-rw-r--r--data/templates/default.ms3
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs4
-rw-r--r--test/writer.ms3
3 files changed, 8 insertions, 2 deletions
diff --git a/data/templates/default.ms b/data/templates/default.ms
index 8d4d0a052..acffb5f6a 100644
--- a/data/templates/default.ms
+++ b/data/templates/default.ms
@@ -39,7 +39,8 @@
.\" ***************************************************************
.\" PDF metadata
.mso pdfmark.tmac
-.pdfinfo /Title $title$
+.pdfinfo /Title "$title-meta$"
+.pdfinfo /Author "$author-meta$"
$if(adjusting)$
.ad $adjusting$
$endif$
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index 6e8c1bd63..7d0c278a6 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -117,11 +117,15 @@ pandocToMs opts (Pandoc meta blocks) = do
body <- blockListToMs opts blocks
let main = render' body
hasInlineMath <- gets stHasInlineMath
+ let titleMeta = (escapeString . stringify) $ docTitle meta
+ let authorsMeta = map (escapeString . stringify) $ docAuthors meta
let context = defField "body" main
$ defField "has-inline-math" hasInlineMath
$ defField "hyphenate" True
$ defField "pandoc-version" pandocVersion
$ defField "toc" (writerTableOfContents opts)
+ $ defField "title-meta" titleMeta
+ $ defField "author-meta" (intercalate "; " authorsMeta)
$ metadata
case writerTemplate opts of
Nothing -> return main
diff --git a/test/writer.ms b/test/writer.ms
index 969407909..03512cbb4 100644
--- a/test/writer.ms
+++ b/test/writer.ms
@@ -39,7 +39,8 @@
.\" ***************************************************************
.\" PDF metadata
.mso pdfmark.tmac
-.pdfinfo /Title Pandoc Test Suite
+.pdfinfo /Title "Pandoc Test Suite"
+.pdfinfo /Author "John MacFarlane; Anonymous"
.hy
.EQ
delim ||