git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: Use @ instead of | for inline math delimiter.

The `|` delimiter had a bad interaction with tbl. See discussion in #1839.

commite30d2c700a94177edf223b40999c05f95bc85742 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 26 Mar 2017, 16:59 (10 years ago) parent1b967d9
4 files changed+91−91
data/templates/default.ms+1−1 src/Text/Pandoc/Writers/Ms.hs+3−3 test/tables.ms+76−76 test/writer.ms+11−11
data/templates/default.ms+1−1
@@ -56,7 +56,7 @@ $else$
5656$endif$
5757$if(has-inline-math)$
5858.EQ
59−delim ||
59+delim @@
6060.EN
6161$endif$
6262$if(title)$
src/Text/Pandoc/Writers/Ms.hs+3−3
@@ -297,7 +297,7 @@ blockToMs opts (Table caption alignments widths headers rows) =
297297 alignments iwidths) ++ "."
298298 colheadings <- mapM (blockListToMs opts) headers
299299 let makeRow cols = text "T{" $$
300− (vcat $ intersperse (text "T}@T{") cols) $$
300+ (vcat $ intersperse (text "T}\tT{") cols) $$
301301 text "T}"
302302 let colheadings' = if all null headers
303303 then empty
@@ -307,7 +307,7 @@ blockToMs opts (Table caption alignments widths headers rows) =
307307 return $ makeRow cols) rows
308308 setFirstPara
309309 return $ text ".PP" $$ caption' $$
310− text ".TS" $$ text "tab(@);" $$ coldescriptions $$
310+ text ".TS" $$ text "delim(@@) tab(\t);" $$ coldescriptions $$
311311 colheadings' $$ vcat body $$ text ".TE"
312312
313313blockToMs opts (BulletList items) = do
@@ -453,7 +453,7 @@ inlineToMs opts (Math InlineMath str) = do
453453 res <- convertMath writeEqn InlineMath str
454454 case res of
455455 Left il -> inlineToMs opts il
456− Right r -> return $ text "|" <> text (escapeBar r) <> text "|"
456+ Right r -> return $ text "@" <> text (escapeBar r) <> text "@"
457457inlineToMs opts (Math DisplayMath str) = do
458458 res <- convertMath writeEqn InlineMath str
459459 case res of
test/tables.ms+76−76
@@ -3,43 +3,43 @@ Simple table with caption:
33.PP
44Demonstration of simple table syntax.
55.TS
6−tab(@);
6+delim(@@) tab( );
77r l c l.
88T{
99Right
10−T}@T{
10+T} T{
1111Left
12−T}@T{
12+T} T{
1313Center
14−T}@T{
14+T} T{
1515Default
1616T}
1717_
1818T{
191912
20−T}@T{
20+T} T{
212112
22−T}@T{
22+T} T{
232312
24−T}@T{
24+T} T{
252512
2626T}
2727T{
2828123
29−T}@T{
29+T} T{
3030123
31−T}@T{
31+T} T{
3232123
33−T}@T{
33+T} T{
3434123
3535T}
3636T{
37371
38−T}@T{
38+T} T{
39391
40−T}@T{
40+T} T{
41411
42−T}@T{
42+T} T{
43431
4444T}
4545.TE
@@ -47,43 +47,43 @@ T}
4747Simple table without caption:
4848.PP
4949.TS
50−tab(@);
50+delim(@@) tab( );
5151r l c l.
5252T{
5353Right
54−T}@T{
54+T} T{
5555Left
56−T}@T{
56+T} T{
5757Center
58−T}@T{
58+T} T{
5959Default
6060T}
6161_
6262T{
636312
64−T}@T{
64+T} T{
656512
66−T}@T{
66+T} T{
676712
68−T}@T{
68+T} T{
696912
7070T}
7171T{
7272123
73−T}@T{
73+T} T{
7474123
75−T}@T{
75+T} T{
7676123
77−T}@T{
77+T} T{
7878123
7979T}
8080T{
81811
82−T}@T{
82+T} T{
83831
84−T}@T{
84+T} T{
85851
86−T}@T{
86+T} T{
87871
8888T}
8989.TE
@@ -92,43 +92,43 @@ Simple table indented two spaces:
9292.PP
9393Demonstration of simple table syntax.
9494.TS
95−tab(@);
95+delim(@@) tab( );
9696r l c l.
9797T{
9898Right
99−T}@T{
99+T} T{
100100Left
101−T}@T{
101+T} T{
102102Center
103−T}@T{
103+T} T{
104104Default
105105T}
106106_
107107T{
10810812
109−T}@T{
109+T} T{
11011012
111−T}@T{
111+T} T{
11211212
113−T}@T{
113+T} T{
11411412
115115T}
116116T{
117117123
118−T}@T{
118+T} T{
119119123
120−T}@T{
120+T} T{
121121123
122−T}@T{
122+T} T{
123123123
124124T}
125125T{
1261261
127−T}@T{
127+T} T{
1281281
129−T}@T{
129+T} T{
1301301
131−T}@T{
131+T} T{
1321321
133133T}
134134.TE
@@ -138,38 +138,38 @@ Multiline table with caption:
138138Here's the caption.
139139It may span multiple lines.
140140.TS
141−tab(@);
141+delim(@@) tab( );
142142cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
143143T{
144144Centered
145145Header
146−T}@T{
146+T} T{
147147Left
148148Aligned
149−T}@T{
149+T} T{
150150Right
151151Aligned
152−T}@T{
152+T} T{
153153Default aligned
154154T}
155155_
156156T{
157157First
158−T}@T{
158+T} T{
159159row
160−T}@T{
160+T} T{
16116112.0
162−T}@T{
162+T} T{
163163Example of a row that spans
164164multiple lines.
165165T}
166166T{
167167Second
168−T}@T{
168+T} T{
169169row
170−T}@T{
170+T} T{
1711715.0
172−T}@T{
172+T} T{
173173Here's another one.
174174Note
175175the blank line between rows.
@@ -179,38 +179,38 @@ T}
179179Multiline table without caption:
180180.PP
181181.TS
182−tab(@);
182+delim(@@) tab( );
183183cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
184184T{
185185Centered
186186Header
187−T}@T{
187+T} T{
188188Left
189189Aligned
190−T}@T{
190+T} T{
191191Right
192192Aligned
193−T}@T{
193+T} T{
194194Default aligned
195195T}
196196_
197197T{
198198First
199−T}@T{
199+T} T{
200200row
201−T}@T{
201+T} T{
20220212.0
203−T}@T{
203+T} T{
204204Example of a row that spans
205205multiple lines.
206206T}
207207T{
208208Second
209−T}@T{
209+T} T{
210210row
211−T}@T{
211+T} T{
2122125.0
213−T}@T{
213+T} T{
214214Here's another one.
215215Note
216216the blank line between rows.
@@ -220,33 +220,33 @@ T}
220220Table without column headers:
221221.PP
222222.TS
223−tab(@);
223+delim(@@) tab( );
224224r l c r.
225225T{
22622612
227−T}@T{
227+T} T{
22822812
229−T}@T{
229+T} T{
23023012
231−T}@T{
231+T} T{
23223212
233233T}
234234T{
235235123
236−T}@T{
236+T} T{
237237123
238−T}@T{
238+T} T{
239239123
240−T}@T{
240+T} T{
241241123
242242T}
243243T{
2442441
245−T}@T{
245+T} T{
2462461
247−T}@T{
247+T} T{
2482481
249−T}@T{
249+T} T{
2502501
251251T}
252252.TE
@@ -254,25 +254,25 @@ T}
254254Multiline table without column headers:
255255.PP
256256.TS
257−tab(@);
257+delim(@@) tab( );
258258cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
259259T{
260260First
261−T}@T{
261+T} T{
262262row
263−T}@T{
263+T} T{
26426412.0
265−T}@T{
265+T} T{
266266Example of a row that spans
267267multiple lines.
268268T}
269269T{
270270Second
271−T}@T{
271+T} T{
272272row
273−T}@T{
273+T} T{
2742745.0
275−T}@T{
275+T} T{
276276Here's another one.
277277Note
278278the blank line between rows.
test/writer.ms+11−11
@@ -48,7 +48,7 @@
4848.pdfinfo /Author "John MacFarlane; Anonymous"
4949.hy
5050.EQ
51−delim ||
51+delim @@
5252.EN
5353.TL
5454Pandoc Test Suite
@@ -627,7 +627,7 @@ Superscripts: a\*{bc\*}d a\*{\f[I]hello\f[]\*} a\*{hello\ there\*}.
627627Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O.
628628.PP
629629These should not be superscripts or subscripts,
630−because of the unescaped spaces: a^b c^d, a~b c~d.
630+because of the unescaped spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.
631631.HLINE
632632.SH 1
633633Smart quotes, ellipses, dashes
@@ -660,26 +660,26 @@ LaTeX
660660.pdfhref M "latex"
661661.IP \[bu] 2
662662.IP \[bu] 2
663−|2 + 2 = 4|
663+@2 + 2 = 4@
664664.IP \[bu] 2
665−|x \[u2208] y|
665+@x \[u2208] y@
666666.IP \[bu] 2
667−|alpha \[u2227] omega|
667+@alpha \[u2227] omega@
668668.IP \[bu] 2
669−|223|
669+@223@
670670.IP \[bu] 2
671−|p|\-Tree
671+@p@\-Tree
672672.IP \[bu] 2
673673Here's some display math:
674674.EQ
675675d over {d x} f ( x ) = lim sub {h -> 0} {f ( x + h ) \[u2212] f ( x )} over h
676676.EN
677677.IP \[bu] 2
678−Here's one that has a line break in it: |alpha + omega times x sup 2|.
678+Here's one that has a line break in it: @alpha + omega times x sup 2@.
679679.LP
680680These shouldn't be math:
681681.IP \[bu] 2
682−To get the famous equation, write \f[C]$e\ =\ mc^2$\f[].
682+To get the famous equation, write \f[C]$e\ =\ mc\[ha]2$\f[].
683683.IP \[bu] 2
684684$22,000 is a \f[I]lot\f[] of money.
685685So is $34,000.
@@ -719,7 +719,7 @@ This & that.
719719.PP
720720Backslash: \\
721721.PP
722−Backtick: `
722+Backtick: \[aq]
723723.PP
724724Asterisk: *
725725.PP
@@ -968,7 +968,7 @@ If you want, you can indent every line, but you can also be
968968lazy and just indent the first line of each block.
969969.FE
970970This should \f[I]not\f[] be a footnote reference, because it
971−contains a space.[^my note] Here is an inline note.\**
971+contains a space.[\[ha]my note] Here is an inline note.\**
972972.FS
973973This
974974is \f[I]easier\f[] to type.