git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: respect text wrapping options.
12a3481John MacFarlane
src/Text/Pandoc/Writers/Ms.hs+6−1
@@ -500,7 +500,12 @@ inlineToMs _ il@(RawInline f str)
500 report $ InlineNotRendered il
500 report $ InlineNotRendered il
501 return empty
501 return empty
502inlineToMs _ (LineBreak) = return $ cr <> text ".br" <> cr
502inlineToMs _ (LineBreak) = return $ cr <> text ".br" <> cr
503−inlineToMs opts SoftBreak = handleNotes opts cr
503+inlineToMs opts SoftBreak =
504+ handleNotes opts $
505+ case writerWrapText opts of
506+ WrapAuto -> space
507+ WrapNone -> space
508+ WrapPreserve -> cr
504inlineToMs opts Space = handleNotes opts space
509inlineToMs opts Space = handleNotes opts space
505inlineToMs opts (Link _ txt ('#':ident, _)) = do
510inlineToMs opts (Link _ txt ('#':ident, _)) = do
506 -- internal link
511 -- internal link
test/tables.ms+13−26
@@ -135,20 +135,16 @@ T}
135.LP
135.LP
136Multiline table with caption:
136Multiline table with caption:
137.PP
137.PP
138−Here's the caption.
139−It may span multiple lines.
138+Here's the caption. It may span multiple lines.
140.TS
139.TS
141delim(@@) tab( );
140delim(@@) tab( );
142cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
141cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
143T{
142T{
144−Centered
143+Centered Header
145−Header
146T} T{
144T} T{
147−Left
148−Aligned
145+Left Aligned
149T} T{
146T} T{
150−Right
151−Aligned
147+Right Aligned
152T} T{
148T} T{
153Default aligned
149Default aligned
154T}
150T}
@@ -160,8 +156,7 @@ row
160T} T{
156T} T{
16112.0
15712.0
162T} T{
158T} T{
163−Example of a row that spans
159+Example of a row that spans multiple lines.
164−multiple lines.
165T}
160T}
166T{
161T{
167Second
162Second
@@ -171,8 +166,7 @@ T} T{
1715.0
1665.0
172T} T{
167T} T{
173Here's another one.
168Here's another one.
174−Note
175−the blank line between rows.
169+Note the blank line between rows.
176T}
170T}
177.TE
171.TE
178.LP
172.LP
@@ -182,14 +176,11 @@ Multiline table without caption:
182delim(@@) tab( );
176delim(@@) tab( );
183cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
177cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
184T{
178T{
185−Centered
179+Centered Header
186−Header
187T} T{
180T} T{
188−Left
189−Aligned
181+Left Aligned
190T} T{
182T} T{
191−Right
192−Aligned
183+Right Aligned
193T} T{
184T} T{
194Default aligned
185Default aligned
195T}
186T}
@@ -201,8 +192,7 @@ row
201T} T{
192T} T{
20212.0
19312.0
203T} T{
194T} T{
204−Example of a row that spans
195+Example of a row that spans multiple lines.
205−multiple lines.
206T}
196T}
207T{
197T{
208Second
198Second
@@ -212,8 +202,7 @@ T} T{
2125.0
2025.0
213T} T{
203T} T{
214Here's another one.
204Here's another one.
215−Note
216−the blank line between rows.
205+Note the blank line between rows.
217T}
206T}
218.TE
207.TE
219.LP
208.LP
@@ -263,8 +252,7 @@ row
263T} T{
252T} T{
26412.0
25312.0
265T} T{
254T} T{
266−Example of a row that spans
255+Example of a row that spans multiple lines.
267−multiple lines.
268T}
256T}
269T{
257T{
270Second
258Second
@@ -274,7 +262,6 @@ T} T{
2745.0
2625.0
275T} T{
263T} T{
276Here's another one.
264Here's another one.
277−Note
278−the blank line between rows.
265+Note the blank line between rows.
279T}
266T}
280.TE
267.TE
test/writer.ms+26−43
@@ -72,8 +72,7 @@ Anonymous
72.1C
72.1C
73.LP
73.LP
74This is a set of tests for pandoc.
74This is a set of tests for pandoc.
75−Most of them are adapted from
76−John Gruber's markdown test suite.
75+Most of them are adapted from John Gruber's markdown test suite.
77.HLINE
76.HLINE
78.SH 1
77.SH 1
79Headers
78Headers
@@ -127,12 +126,10 @@ Paragraphs
127Here's a regular paragraph.
126Here's a regular paragraph.
128.PP
127.PP
129In Markdown 1.0.0 and earlier.
128In Markdown 1.0.0 and earlier.
130−Version
129+Version 8.
131−8.
132This line turns into a list item.
130This line turns into a list item.
133−Because a hard\-wrapped line in the
134−middle of a paragraph looked like a
131+Because a hard\-wrapped line in the middle of a paragraph looked like a list
135−list item.
132+item.
136.PP
133.PP
137Here's one with a bullet.
134Here's one with a bullet.
138* criminey.
135* criminey.
@@ -181,8 +178,7 @@ nested
181.RE
178.RE
182.RE
179.RE
183.LP
180.LP
184−This should not be a block quote: 2
181+This should not be a block quote: 2 > 1.
185−> 1.
186.PP
182.PP
187And a following paragraph.
183And a following paragraph.
188.HLINE
184.HLINE
@@ -315,8 +311,7 @@ Item 1, graf one.
315.PP
311.PP
316Item 1.
312Item 1.
317graf two.
313graf two.
318−The quick brown fox jumped over the lazy dog's
314+The quick brown fox jumped over the lazy dog's back.
319−back.
320.RE
315.RE
321.IP "2." 3
316.IP "2." 3
322Item 2.
317Item 2.
@@ -373,18 +368,14 @@ Tabs and spaces
373.pdfhref O 2 "Tabs and spaces"
368.pdfhref O 2 "Tabs and spaces"
374.pdfhref M "tabs-and-spaces"
369.pdfhref M "tabs-and-spaces"
375.IP \[bu] 2
370.IP \[bu] 2
376−this is a list item
377−indented with tabs
371+this is a list item indented with tabs
378.IP \[bu] 2
372.IP \[bu] 2
379−this is a list item
380−indented with spaces
373+this is a list item indented with spaces
381.RS 2
374.RS 2
382.IP \[bu] 2
375.IP \[bu] 2
383−this is an example list item
376+this is an example list item indented with tabs
384−indented with tabs
385.IP \[bu] 2
377.IP \[bu] 2
386−this is an example list item
378+this is an example list item indented with spaces
387−indented with spaces
388.RE
379.RE
389.SH 2
380.SH 2
390Fancy list markers
381Fancy list markers
@@ -398,8 +389,7 @@ and now 3
398.LP
389.LP
399with a continuation
390with a continuation
400.IP "iv." 4
391.IP "iv." 4
401−sublist with roman numerals,
392+sublist with roman numerals, starting with 4
402−starting with 4
403.IP " v." 4
393.IP " v." 4
404more items
394more items
405.RS 4
395.RS 4
@@ -495,8 +485,7 @@ Multiple blocks with italics:
495red fruit
485red fruit
496.RS
486.RS
497.PP
487.PP
498−contains seeds,
499−crisp, pleasant to taste
488+contains seeds, crisp, pleasant to taste
500.RE
489.RE
501.IP "\f[I]orange\f[]"
490.IP "\f[I]orange\f[]"
502orange fruit
491orange fruit
@@ -658,8 +647,8 @@ Superscripts: a\*{bc\*}d a\*{\f[I]hello\f[]\*} a\*{hello\~there\*}.
658.PP
647.PP
659Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\~of\~them\*>O.
648Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\~of\~them\*>O.
660.PP
649.PP
661−These should not be superscripts or subscripts,
650+These should not be superscripts or subscripts, because of the unescaped
662−because of the unescaped spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
651+spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
663.HLINE
652.HLINE
664.SH 1
653.SH 1
665Smart quotes, ellipses, dashes
654Smart quotes, ellipses, dashes
@@ -674,8 +663,7 @@ Smart quotes, ellipses, dashes
674`Oak,' `elm,' and `beech' are names of trees.
663`Oak,' `elm,' and `beech' are names of trees.
675So is `pine.'
664So is `pine.'
676.PP
665.PP
677−`He said, \[lq]I want to go.\[rq]' Were you alive in the
666+`He said, \[lq]I want to go.\[rq]' Were you alive in the 70's?
678−70's?
679.PP
667.PP
680Here is some quoted `\f[C]code\f[]' and a \[lq]\c
668Here is some quoted `\f[C]code\f[]' and a \[lq]\c
681.pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \
669.pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \
@@ -981,18 +969,16 @@ Footnotes
981Here is a footnote reference,\**
969Here is a footnote reference,\**
982.FS
970.FS
983Here is the footnote.
971Here is the footnote.
984−It can go anywhere after the footnote
972+It can go anywhere after the footnote reference.
985−reference.
986It need not be placed at the end of the document.
973It need not be placed at the end of the document.
987.FE
974.FE
988and another.\**
975and another.\**
989.FS
976.FS
990Here's the long note.
977Here's the long note.
991−This one contains multiple
978+This one contains multiple blocks.
992−blocks.
993.PP
979.PP
994−Subsequent blocks are indented to show that they belong to the
980+Subsequent blocks are indented to show that they belong to the footnote (as
995−footnote (as with list items).
981+with list items).
996.IP
982.IP
997.nf
983.nf
998\f[C]
984\f[C]
@@ -1000,20 +986,17 @@ footnote (as with list items).
1000\f[]
986\f[]
1001.fi
987.fi
1002.LP
988.LP
1003−If you want, you can indent every line, but you can also be
989+If you want, you can indent every line, but you can also be lazy and just
1004−lazy and just indent the first line of each block.
990+indent the first line of each block.
1005.FE
991.FE
1006−This should \f[I]not\f[] be a footnote reference, because it
992+This should \f[I]not\f[] be a footnote reference, because it contains a
1007−contains a space.[\[ha]my note] Here is an inline note.\**
993+space.[\[ha]my note] Here is an inline note.\**
1008.FS
994.FS
1009−This
1010−is \f[I]easier\f[] to type.
995+This is \f[I]easier\f[] to type.
1011−Inline notes may contain
996+Inline notes may contain \c
1012−\c
1013.pdfhref W -D "http://google.com" -A "\c" \
997.pdfhref W -D "http://google.com" -A "\c" \
1014 -- "links"
998 -- "links"
1015−\& and \f[C]]\f[] verbatim characters,
999+\& and \f[C]]\f[] verbatim characters, as well as [bracketed text].
1016−as well as [bracketed text].
1017.FE
1000.FE
1018.RS
1001.RS
1019.LP
1002.LP