summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-04-06 12:45:23 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-04-06 12:45:23 +0200
commit6b0d3d1582bd764a8496b4074608da11ae9349d4 (patch)
tree4fcc4ce7b58315ef8ce58ca7655e34b79cd2433e
parent12ae1df5bfa447f94d8a3db24dd890e54bcbcf55 (diff)
Ms writer: wider indents for lists.
Previously some indents weren't wide enough, leading the list item to start on a line after the marker.
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs11
-rw-r--r--test/writer.ms192
2 files changed, 102 insertions, 101 deletions
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index f162c4213..e4daa1be0 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -347,7 +347,7 @@ blockToMs opts (BulletList items) = do
return (vcat contents)
blockToMs opts (OrderedList attribs items) = do
let markers = take (length items) $ orderedListMarkers attribs
- let indent = 1 + (maximum $ map length markers)
+ let indent = 2 + (maximum $ map length markers)
contents <- mapM (\(num, item) -> orderedListItemToMs opts num indent item) $
zip markers items
setFirstPara
@@ -365,15 +365,15 @@ bulletListItemToMs opts ((Para first):rest) =
bulletListItemToMs opts ((Plain first):rest) = do
first' <- blockToMs opts (Plain first)
rest' <- blockListToMs opts rest
- let first'' = text ".IP \\[bu] 2" $$ first'
+ let first'' = text ".IP \\[bu] 3" $$ first'
let rest'' = if null rest
then empty
- else text ".RS 2" $$ rest' $$ text ".RE"
+ else text ".RS 3" $$ rest' $$ text ".RE"
return (first'' $$ rest'')
bulletListItemToMs opts (first:rest) = do
first' <- blockToMs opts first
rest' <- blockListToMs opts rest
- return $ text "\\[bu] .RS 2" $$ first' $$ rest' $$ text ".RE"
+ return $ text "\\[bu] .RS 3" $$ first' $$ rest' $$ text ".RE"
-- | Convert ordered list item (a list of blocks) to ms.
orderedListItemToMs :: PandocMonad m
@@ -392,7 +392,8 @@ orderedListItemToMs opts num indent (first:rest) = do
let first'' = text (".IP \"" ++ num' ++ "\" " ++ show indent) $$ first'
let rest'' = if null rest
then empty
- else text ".RS 4" $$ rest' $$ text ".RE"
+ else text ".RS " <> text (show indent) $$
+ rest' $$ text ".RE"
return $ first'' $$ rest''
-- | Convert definition list item (label, list of blocks) to ms.
diff --git a/test/writer.ms b/test/writer.ms
index a133c62cf..617ccc752 100644
--- a/test/writer.ms
+++ b/test/writer.ms
@@ -162,9 +162,9 @@ sub\ status\ {
.fi
.LP
A list:
-.IP "1." 3
+.IP " 1." 4
item one
-.IP "2." 3
+.IP " 2." 4
item two
.LP
Nested block quotes:
@@ -221,51 +221,51 @@ Unordered
.pdfhref M "unordered"
.LP
Asterisks tight:
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 1
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 2
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 3
.LP
Asterisks loose:
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 1
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 2
-.IP \[bu] 2
+.IP \[bu] 3
asterisk 3
.LP
Pluses tight:
-.IP \[bu] 2
+.IP \[bu] 3
Plus 1
-.IP \[bu] 2
+.IP \[bu] 3
Plus 2
-.IP \[bu] 2
+.IP \[bu] 3
Plus 3
.LP
Pluses loose:
-.IP \[bu] 2
+.IP \[bu] 3
Plus 1
-.IP \[bu] 2
+.IP \[bu] 3
Plus 2
-.IP \[bu] 2
+.IP \[bu] 3
Plus 3
.LP
Minuses tight:
-.IP \[bu] 2
+.IP \[bu] 3
Minus 1
-.IP \[bu] 2
+.IP \[bu] 3
Minus 2
-.IP \[bu] 2
+.IP \[bu] 3
Minus 3
.LP
Minuses loose:
-.IP \[bu] 2
+.IP \[bu] 3
Minus 1
-.IP \[bu] 2
+.IP \[bu] 3
Minus 2
-.IP \[bu] 2
+.IP \[bu] 3
Minus 3
.SH 2
Ordered
@@ -273,39 +273,39 @@ Ordered
.pdfhref M "ordered"
.LP
Tight:
-.IP "1." 3
+.IP " 1." 4
First
-.IP "2." 3
+.IP " 2." 4
Second
-.IP "3." 3
+.IP " 3." 4
Third
.LP
and:
-.IP "1." 3
+.IP " 1." 4
One
-.IP "2." 3
+.IP " 2." 4
Two
-.IP "3." 3
+.IP " 3." 4
Three
.LP
Loose using tabs:
-.IP "1." 3
+.IP " 1." 4
First
-.IP "2." 3
+.IP " 2." 4
Second
-.IP "3." 3
+.IP " 3." 4
Third
.LP
and using spaces:
-.IP "1." 3
+.IP " 1." 4
One
-.IP "2." 3
+.IP " 2." 4
Two
-.IP "3." 3
+.IP " 3." 4
Three
.LP
Multiple paragraphs:
-.IP "1." 3
+.IP " 1." 4
Item 1, graf one.
.RS 4
.PP
@@ -313,116 +313,116 @@ Item 1.
graf two.
The quick brown fox jumped over the lazy dog's back.
.RE
-.IP "2." 3
+.IP " 2." 4
Item 2.
-.IP "3." 3
+.IP " 3." 4
Item 3.
.SH 2
Nested
.pdfhref O 2 "Nested"
.pdfhref M "nested"
-.IP \[bu] 2
+.IP \[bu] 3
Tab
-.RS 2
-.IP \[bu] 2
+.RS 3
+.IP \[bu] 3
Tab
-.RS 2
-.IP \[bu] 2
+.RS 3
+.IP \[bu] 3
Tab
.RE
.RE
.LP
Here's another:
-.IP "1." 3
+.IP " 1." 4
First
-.IP "2." 3
+.IP " 2." 4
Second:
.RS 4
-.IP \[bu] 2
+.IP \[bu] 3
Fee
-.IP \[bu] 2
+.IP \[bu] 3
Fie
-.IP \[bu] 2
+.IP \[bu] 3
Foe
.RE
-.IP "3." 3
+.IP " 3." 4
Third
.LP
Same thing but with paragraphs:
-.IP "1." 3
+.IP " 1." 4
First
-.IP "2." 3
+.IP " 2." 4
Second:
.RS 4
-.IP \[bu] 2
+.IP \[bu] 3
Fee
-.IP \[bu] 2
+.IP \[bu] 3
Fie
-.IP \[bu] 2
+.IP \[bu] 3
Foe
.RE
-.IP "3." 3
+.IP " 3." 4
Third
.SH 2
Tabs and spaces
.pdfhref O 2 "Tabs and spaces"
.pdfhref M "tabs-and-spaces"
-.IP \[bu] 2
+.IP \[bu] 3
this is a list item indented with tabs
-.IP \[bu] 2
+.IP \[bu] 3
this is a list item indented with spaces
-.RS 2
-.IP \[bu] 2
+.RS 3
+.IP \[bu] 3
this is an example list item indented with tabs
-.IP \[bu] 2
+.IP \[bu] 3
this is an example list item indented with spaces
.RE
.SH 2
Fancy list markers
.pdfhref O 2 "Fancy list markers"
.pdfhref M "fancy-list-markers"
-.IP "(2)" 4
+.IP " (2)" 5
begins with 2
-.IP "(3)" 4
+.IP " (3)" 5
and now 3
-.RS 4
+.RS 5
.LP
with a continuation
-.IP "iv." 4
+.IP " iv." 5
sublist with roman numerals, starting with 4
-.IP " v." 4
+.IP " v." 5
more items
-.RS 4
-.IP "(A)" 4
+.RS 5
+.IP " (A)" 5
a subsublist
-.IP "(B)" 4
+.IP " (B)" 5
a subsublist
.RE
.RE
.LP
Nesting:
-.IP "A." 3
+.IP " A." 4
Upper Alpha
.RS 4
-.IP "I." 3
+.IP " I." 4
Upper Roman.
.RS 4
-.IP "(6)" 4
+.IP " (6)" 5
Decimal start with 6
-.RS 4
-.IP "c)" 3
+.RS 5
+.IP " c)" 4
Lower alpha with paren
.RE
.RE
.RE
.LP
Autonumbering:
-.IP "1." 3
+.IP " 1." 4
Autonumber.
-.IP "2." 3
+.IP " 2." 4
More.
.RS 4
-.IP "1." 3
+.IP " 1." 4
Nested.
.RE
.LP
@@ -545,9 +545,9 @@ computer
.IP "orange"
orange fruit
.RS
-.IP "1." 3
+.IP " 1." 4
sublist
-.IP "2." 3
+.IP " 2." 4
sublist
.RE
.SH 1
@@ -680,35 +680,35 @@ Ellipses\&...and\&...and\&....
LaTeX
.pdfhref O 1 "LaTeX"
.pdfhref M "latex"
-.IP \[bu] 2
-.IP \[bu] 2
+.IP \[bu] 3
+.IP \[bu] 3
@2 + 2 = 4@
-.IP \[bu] 2
+.IP \[bu] 3
@x \[u2208] y@
-.IP \[bu] 2
+.IP \[bu] 3
@alpha \[u2227] omega@
-.IP \[bu] 2
+.IP \[bu] 3
@223@
-.IP \[bu] 2
+.IP \[bu] 3
@p@\-Tree
-.IP \[bu] 2
+.IP \[bu] 3
Here's some display math:
.EQ
d over {d x} f ( x ) = lim sub {h -> 0} {f ( x + h ) \[u2212] f ( x )} over h
.EN
-.IP \[bu] 2
+.IP \[bu] 3
Here's one that has a line break in it: @alpha + omega times x sup 2@.
.LP
These shouldn't be math:
-.IP \[bu] 2
+.IP \[bu] 3
To get the famous equation, write \f[C]$e\ =\ mc\[ha]2$\f[].
-.IP \[bu] 2
+.IP \[bu] 3
$22,000 is a \f[I]lot\f[] of money.
So is $34,000.
(It worked if \[lq]lot\[rq] is emphasized.)
-.IP \[bu] 2
+.IP \[bu] 3
Shoes ($20) and socks ($5).
-.IP \[bu] 2
+.IP \[bu] 3
Escaped \f[C]$\f[]: $73 \f[I]this should be emphasized\f[] 23$.
.LP
Here's a LaTeX table:
@@ -719,15 +719,15 @@ Special Characters
.pdfhref M "special-characters"
.LP
Here is some unicode:
-.IP \[bu] 2
+.IP \[bu] 3
I hat: Î
-.IP \[bu] 2
+.IP \[bu] 3
o umlaut: ö
-.IP \[bu] 2
+.IP \[bu] 3
section: §
-.IP \[bu] 2
+.IP \[bu] 3
set membership: ∈
-.IP \[bu] 2
+.IP \[bu] 3
copyright: ©
.LP
AT&T has an ampersand in their name.
@@ -920,14 +920,14 @@ With an ampersand: \c
.pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \
-- "http://example.com/?foo=1&bar=2"
\&
-.IP \[bu] 2
+.IP \[bu] 3
In a list?
-.IP \[bu] 2
+.IP \[bu] 3
\c
.pdfhref W -D "http://example.com/" -A "\c" \
-- "http://example.com/"
\&
-.IP \[bu] 2
+.IP \[bu] 3
It should.
.LP
An e\-mail address: \c
@@ -1005,7 +1005,7 @@ Notes can go in quotes.\**
In quote.
.FE
.RE
-.IP "1." 3
+.IP " 1." 4
And in list items.\**
.FS
In list.