git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: respect text wrapping options.
commit12a3481632bfc3d477759095fa01fa92e169b292 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 5 Apr 2017, 15:17 (10 years ago) parent48729f9
3 files changed+45−70
src/Text/Pandoc/Writers/Ms.hs+6−1 test/tables.ms+13−26 test/writer.ms+26−43
src/Text/Pandoc/Writers/Ms.hs+6−1
@@ -500,7 +500,12 @@ inlineToMs _ il@(RawInline f str)
500500 report $ InlineNotRendered il
501501 return empty
502502inlineToMs _ (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
504509inlineToMs opts Space = handleNotes opts space
505510inlineToMs opts (Link _ txt ('#':ident, _)) = do
506511 -- internal link
test/tables.ms+13−26
@@ -135,20 +135,16 @@ T}
135135.LP
136136Multiline table with caption:
137137.PP
138−Here's the caption.
139−It may span multiple lines.
138+Here's the caption. It may span multiple lines.
140139.TS
141140delim(@@) tab( );
142141cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
143142T{
144−Centered
145−Header
143+Centered Header
146144T} T{
147−Left
148−Aligned
145+Left Aligned
149146T} T{
150−Right
151−Aligned
147+Right Aligned
152148T} T{
153149Default aligned
154150T}
@@ -160,8 +156,7 @@ row
160156T} T{
16115712.0
162158T} T{
163−Example of a row that spans
164−multiple lines.
159+Example of a row that spans multiple lines.
165160T}
166161T{
167162Second
@@ -171,8 +166,7 @@ T} T{
1711665.0
172167T} T{
173168Here's another one.
174−Note
175−the blank line between rows.
169+Note the blank line between rows.
176170T}
177171.TE
178172.LP
@@ -182,14 +176,11 @@ Multiline table without caption:
182176delim(@@) tab( );
183177cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
184178T{
185−Centered
186−Header
179+Centered Header
187180T} T{
188−Left
189−Aligned
181+Left Aligned
190182T} T{
191−Right
192−Aligned
183+Right Aligned
193184T} T{
194185Default aligned
195186T}
@@ -201,8 +192,7 @@ row
201192T} T{
20219312.0
203194T} T{
204−Example of a row that spans
205−multiple lines.
195+Example of a row that spans multiple lines.
206196T}
207197T{
208198Second
@@ -212,8 +202,7 @@ T} T{
2122025.0
213203T} T{
214204Here's another one.
215−Note
216−the blank line between rows.
205+Note the blank line between rows.
217206T}
218207.TE
219208.LP
@@ -263,8 +252,7 @@ row
263252T} T{
26425312.0
265254T} T{
266−Example of a row that spans
267−multiple lines.
255+Example of a row that spans multiple lines.
268256T}
269257T{
270258Second
@@ -274,7 +262,6 @@ T} T{
2742625.0
275263T} T{
276264Here's another one.
277−Note
278−the blank line between rows.
265+Note the blank line between rows.
279266T}
280267.TE
test/writer.ms+26−43
@@ -72,8 +72,7 @@ Anonymous
7272.1C
7373.LP
7474This 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.
7776.HLINE
7877.SH 1
7978Headers
@@ -127,12 +126,10 @@ Paragraphs
127126Here's a regular paragraph.
128127.PP
129128In Markdown 1.0.0 and earlier.
130−Version
131−8.
129+Version 8.
132130This line turns into a list item.
133−Because a hard\-wrapped line in the
134−middle of a paragraph looked like a
135−list item.
131+Because a hard\-wrapped line in the middle of a paragraph looked like a list
132+item.
136133.PP
137134Here's one with a bullet.
138135* criminey.
@@ -181,8 +178,7 @@ nested
181178.RE
182179.RE
183180.LP
184−This should not be a block quote: 2
185−> 1.
181+This should not be a block quote: 2 > 1.
186182.PP
187183And a following paragraph.
188184.HLINE
@@ -315,8 +311,7 @@ Item 1, graf one.
315311.PP
316312Item 1.
317313graf two.
318−The quick brown fox jumped over the lazy dog's
319−back.
314+The quick brown fox jumped over the lazy dog's back.
320315.RE
321316.IP "2." 3
322317Item 2.
@@ -373,18 +368,14 @@ Tabs and spaces
373368.pdfhref O 2 "Tabs and spaces"
374369.pdfhref M "tabs-and-spaces"
375370.IP \[bu] 2
376−this is a list item
377−indented with tabs
371+this is a list item indented with tabs
378372.IP \[bu] 2
379−this is a list item
380−indented with spaces
373+this is a list item indented with spaces
381374.RS 2
382375.IP \[bu] 2
383−this is an example list item
384−indented with tabs
376+this is an example list item indented with tabs
385377.IP \[bu] 2
386−this is an example list item
387−indented with spaces
378+this is an example list item indented with spaces
388379.RE
389380.SH 2
390381Fancy list markers
@@ -398,8 +389,7 @@ and now 3
398389.LP
399390with a continuation
400391.IP "iv." 4
401−sublist with roman numerals,
402−starting with 4
392+sublist with roman numerals, starting with 4
403393.IP " v." 4
404394more items
405395.RS 4
@@ -495,8 +485,7 @@ Multiple blocks with italics:
495485red fruit
496486.RS
497487.PP
498−contains seeds,
499−crisp, pleasant to taste
488+contains seeds, crisp, pleasant to taste
500489.RE
501490.IP "\f[I]orange\f[]"
502491orange fruit
@@ -658,8 +647,8 @@ Superscripts: a\*{bc\*}d a\*{\f[I]hello\f[]\*} a\*{hello\~there\*}.
658647.PP
659648Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\~of\~them\*>O.
660649.PP
661−These should not be superscripts or subscripts,
662−because of the unescaped spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
650+These should not be superscripts or subscripts, because of the unescaped
651+spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
663652.HLINE
664653.SH 1
665654Smart quotes, ellipses, dashes
@@ -674,8 +663,7 @@ Smart quotes, ellipses, dashes
674663`Oak,' `elm,' and `beech' are names of trees.
675664So is `pine.'
676665.PP
677−`He said, \[lq]I want to go.\[rq]' Were you alive in the
678−70's?
666+`He said, \[lq]I want to go.\[rq]' Were you alive in the 70's?
679667.PP
680668Here is some quoted `\f[C]code\f[]' and a \[lq]\c
681669.pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \
@@ -981,18 +969,16 @@ Footnotes
981969Here is a footnote reference,\**
982970.FS
983971Here is the footnote.
984−It can go anywhere after the footnote
985−reference.
972+It can go anywhere after the footnote reference.
986973It need not be placed at the end of the document.
987974.FE
988975and another.\**
989976.FS
990977Here's the long note.
991−This one contains multiple
992−blocks.
978+This one contains multiple blocks.
993979.PP
994−Subsequent blocks are indented to show that they belong to the
995−footnote (as with list items).
980+Subsequent blocks are indented to show that they belong to the footnote (as
981+with list items).
996982.IP
997983.nf
998984\f[C]
@@ -1000,20 +986,17 @@ footnote (as with list items).
1000986\f[]
1001987.fi
1002988.LP
1003−If you want, you can indent every line, but you can also be
1004−lazy and just indent the first line of each block.
989+If you want, you can indent every line, but you can also be lazy and just
990+indent the first line of each block.
1005991.FE
1006−This should \f[I]not\f[] be a footnote reference, because it
1007−contains a space.[\[ha]my note] Here is an inline note.\**
992+This should \f[I]not\f[] be a footnote reference, because it contains a
993+space.[\[ha]my note] Here is an inline note.\**
1008994.FS
1009−This
1010−is \f[I]easier\f[] to type.
1011−Inline notes may contain
1012−\c
995+This is \f[I]easier\f[] to type.
996+Inline notes may contain \c
1013997.pdfhref W -D "http://google.com" -A "\c" \
1014998 -- "links"
1015−\& and \f[C]]\f[] verbatim characters,
1016−as well as [bracketed text].
999+\& and \f[C]]\f[] verbatim characters, as well as [bracketed text].
10171000.FE
10181001.RS
10191002.LP