aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt15
-rw-r--r--data/templates/default.ms8
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs7
-rw-r--r--test/writer.ms22
4 files changed, 30 insertions, 22 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index 529bbd6ff..fcccd7c6f 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1508,6 +1508,21 @@ Variables for man pages
`hyphenate`
: if `true` (the default), hyphenation will be used
+Variables for ms
+----------------
+
+`pointsize`
+: point size (e.g. `10p`)
+
+`lineheight`
+: line height (e.g. `12p`)
+
+`fontfamily`
+: font family (e.g. `T` or `P`)
+
+`indent`
+: paragraph indent (e.g. `2m`)
+
Using variables in templates
----------------------------
diff --git a/data/templates/default.ms b/data/templates/default.ms
index e7e28b6d6..c13684372 100644
--- a/data/templates/default.ms
+++ b/data/templates/default.ms
@@ -27,13 +27,13 @@ $endif$
.\" header/footer width
.nr LT \n[LL]
.\" point size
-.nr PS 10p
+.nr PS $if(pointsize)$$pointsize$$else$10p$endif$
.\" line height
-.nr VS 12p
+.nr VS $if(lineheight)$$lineheight$$else$12p$endif$
.\" font family: A, BM, H, HN, N, P, T, ZCM
-.fam T
+.fam $if(fontfamily)$$fontfamily$$else$T$endif$
.\" paragraph indent
-.nr PI 2m
+.nr PI $if(indent)$$indent$$else$2m$endif$
.\" interparagraph space
.nr PD 0.33v
.\" footnote width
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index aadbd208e..4118a7bfb 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -516,10 +516,9 @@ inlineToMs opts (Link _ txt (src, _)) = do
doubleQuotes (text (escapeUri src)) <> text " -A " <>
doubleQuotes (text "\\c") <> space <> text "\\") <> cr <>
text " -- " <> doubleQuotes (nowrap contents) <> cr <> text "\\&"
-inlineToMs opts (Image attr alternate (source, tit)) = do
- let alt = if null alternate then [Str "image"] else alternate
- linkPart <- inlineToMs opts (Link attr alt (source, tit))
- return $ char '[' <> text "IMAGE: " <> linkPart <> char ']'
+inlineToMs _ (Image _ alternate (_, _)) =
+ return $ char '[' <> text "IMAGE: " <>
+ text (escapeString (stringify alternate)) <> char ']'
inlineToMs _ (Note contents) = do
modify $ \st -> st{ stNotes = contents : stNotes st }
return $ text "\\**"
diff --git a/test/writer.ms b/test/writer.ms
index 759bdba15..0a67a6312 100644
--- a/test/writer.ms
+++ b/test/writer.ms
@@ -17,15 +17,15 @@
.\" left margin
.nr PO 1.25i
.\" top margin
-.nr HM 1.25in
+.nr HM 1.25i
.\" bottom margin
-.nr FM 1.25in
+.nr FM 1.25i
.\" header/footer width
.nr LT \n[LL]
-.\" point size (pt x 1000)
-.nr PS 10000
-.\" line height (pt x 1000)
-.nr VS 12000
+.\" point size
+.nr PS 10p
+.\" line height
+.nr VS 12p
.\" font family: A, BM, H, HN, N, P, T, ZCM
.fam T
.\" paragraph indent
@@ -969,15 +969,9 @@ Images
.LP
From \[lq]Voyage dans la Lune\[rq] by Georges Melies (1902):
.PP
-[IMAGE: \c
-.pdfhref W -D "lalune.jpg" -A "\c" \
- -- "lalune"
-\&]
+[IMAGE: lalune]
.PP
-Here is a movie [IMAGE: \c
-.pdfhref W -D "movie.jpg" -A "\c" \
- -- "movie"
-\&] icon.
+Here is a movie [IMAGE: movie] icon.
.HLINE
.SH 1
Footnotes