diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 16:59:38 +0200 | 
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 16:59:38 +0200 | 
| commit | e30d2c700a94177edf223b40999c05f95bc85742 (patch) | |
| tree | d6129a8ad207429bd447b65995ee5b74820cd5d1 | |
| parent | 1b967d90365090a8d55e3c400262c8af51a60bf7 (diff) | |
| download | pandoc-e30d2c700a94177edf223b40999c05f95bc85742.tar.gz | |
Ms writer: Use @ instead of | for inline math delimiter.
The `|` delimiter had a bad interaction with tbl.
See discussion in #1839.
| -rw-r--r-- | data/templates/default.ms | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Ms.hs | 6 | ||||
| -rw-r--r-- | test/tables.ms | 152 | ||||
| -rw-r--r-- | test/writer.ms | 22 | 
4 files changed, 91 insertions, 91 deletions
| diff --git a/data/templates/default.ms b/data/templates/default.ms index feca08693..276a41880 100644 --- a/data/templates/default.ms +++ b/data/templates/default.ms @@ -56,7 +56,7 @@ $else$  $endif$  $if(has-inline-math)$  .EQ -delim || +delim @@  .EN  $endif$  $if(title)$ diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs index ce3907bbe..60e1f6041 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -297,7 +297,7 @@ blockToMs opts (Table caption alignments widths headers rows) =                          alignments iwidths) ++ "."    colheadings <- mapM (blockListToMs opts) headers    let makeRow cols = text "T{" $$ -                     (vcat $ intersperse (text "T}@T{") cols) $$ +                     (vcat $ intersperse (text "T}\tT{") cols) $$                       text "T}"    let colheadings' = if all null headers                          then empty @@ -307,7 +307,7 @@ blockToMs opts (Table caption alignments widths headers rows) =                           return $ makeRow cols) rows    setFirstPara    return $ text ".PP" $$ caption' $$ -           text ".TS" $$ text "tab(@);" $$ coldescriptions $$ +           text ".TS" $$ text "delim(@@) tab(\t);" $$ coldescriptions $$             colheadings' $$ vcat body $$ text ".TE"  blockToMs opts (BulletList items) = do @@ -453,7 +453,7 @@ inlineToMs opts (Math InlineMath str) = do    res <- convertMath writeEqn InlineMath str    case res of         Left il -> inlineToMs opts il -       Right r -> return $ text "|" <> text (escapeBar r) <> text "|" +       Right r -> return $ text "@" <> text (escapeBar r) <> text "@"  inlineToMs opts (Math DisplayMath str) = do    res <- convertMath writeEqn InlineMath str    case res of diff --git a/test/tables.ms b/test/tables.ms index e0784a5ad..e995955be 100644 --- a/test/tables.ms +++ b/test/tables.ms @@ -3,43 +3,43 @@ Simple table with caption:  .PP  Demonstration of simple table syntax.  .TS -tab(@); +delim(@@) tab(	);  r l c l.  T{  Right -T}@T{ +T}	T{  Left -T}@T{ +T}	T{  Center -T}@T{ +T}	T{  Default  T}  _  T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12  T}  T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123  T}  T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1  T}  .TE @@ -47,43 +47,43 @@ T}  Simple table without caption:  .PP  .TS -tab(@); +delim(@@) tab(	);  r l c l.  T{  Right -T}@T{ +T}	T{  Left -T}@T{ +T}	T{  Center -T}@T{ +T}	T{  Default  T}  _  T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12  T}  T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123  T}  T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1  T}  .TE @@ -92,43 +92,43 @@ Simple table indented two spaces:  .PP  Demonstration of simple table syntax.  .TS -tab(@); +delim(@@) tab(	);  r l c l.  T{  Right -T}@T{ +T}	T{  Left -T}@T{ +T}	T{  Center -T}@T{ +T}	T{  Default  T}  _  T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12  T}  T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123  T}  T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1  T}  .TE @@ -138,38 +138,38 @@ Multiline table with caption:  Here's the caption.  It may span multiple lines.  .TS -tab(@); +delim(@@) tab(	);  cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).  T{  Centered  Header -T}@T{ +T}	T{  Left  Aligned -T}@T{ +T}	T{  Right  Aligned -T}@T{ +T}	T{  Default aligned  T}  _  T{  First -T}@T{ +T}	T{  row -T}@T{ +T}	T{  12.0 -T}@T{ +T}	T{  Example of a row that spans  multiple lines.  T}  T{  Second -T}@T{ +T}	T{  row -T}@T{ +T}	T{  5.0 -T}@T{ +T}	T{  Here's another one.  Note  the blank line between rows. @@ -179,38 +179,38 @@ T}  Multiline table without caption:  .PP  .TS -tab(@); +delim(@@) tab(	);  cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).  T{  Centered  Header -T}@T{ +T}	T{  Left  Aligned -T}@T{ +T}	T{  Right  Aligned -T}@T{ +T}	T{  Default aligned  T}  _  T{  First -T}@T{ +T}	T{  row -T}@T{ +T}	T{  12.0 -T}@T{ +T}	T{  Example of a row that spans  multiple lines.  T}  T{  Second -T}@T{ +T}	T{  row -T}@T{ +T}	T{  5.0 -T}@T{ +T}	T{  Here's another one.  Note  the blank line between rows. @@ -220,33 +220,33 @@ T}  Table without column headers:  .PP  .TS -tab(@); +delim(@@) tab(	);  r l c r.  T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12 -T}@T{ +T}	T{  12  T}  T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123 -T}@T{ +T}	T{  123  T}  T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1 -T}@T{ +T}	T{  1  T}  .TE @@ -254,25 +254,25 @@ T}  Multiline table without column headers:  .PP  .TS -tab(@); +delim(@@) tab(	);  cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).  T{  First -T}@T{ +T}	T{  row -T}@T{ +T}	T{  12.0 -T}@T{ +T}	T{  Example of a row that spans  multiple lines.  T}  T{  Second -T}@T{ +T}	T{  row -T}@T{ +T}	T{  5.0 -T}@T{ +T}	T{  Here's another one.  Note  the blank line between rows. diff --git a/test/writer.ms b/test/writer.ms index 3668d1292..cd8de4342 100644 --- a/test/writer.ms +++ b/test/writer.ms @@ -48,7 +48,7 @@  .pdfinfo /Author "John MacFarlane; Anonymous"  .hy  .EQ -delim || +delim @@  .EN  .TL  Pandoc Test Suite @@ -627,7 +627,7 @@ Superscripts: a\*{bc\*}d a\*{\f[I]hello\f[]\*} a\*{hello\ there\*}.  Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O.  .PP  These should not be superscripts or subscripts, -because of the unescaped spaces: a^b c^d, a~b c~d. +because of the unescaped spaces: a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.  .HLINE  .SH 1  Smart quotes, ellipses, dashes @@ -660,26 +660,26 @@ LaTeX  .pdfhref M "latex"  .IP \[bu] 2  .IP \[bu] 2 -|2 + 2 = 4| +@2 + 2 = 4@  .IP \[bu] 2 -|x \[u2208] y| +@x \[u2208] y@  .IP \[bu] 2 -|alpha \[u2227] omega| +@alpha \[u2227] omega@  .IP \[bu] 2 -|223| +@223@  .IP \[bu] 2 -|p|\-Tree +@p@\-Tree  .IP \[bu] 2  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 -Here's one that has a line break in it: |alpha + omega times x sup 2|. +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 -To get the famous equation, write \f[C]$e\ =\ mc^2$\f[]. +To get the famous equation, write \f[C]$e\ =\ mc\[ha]2$\f[].  .IP \[bu] 2  $22,000 is a \f[I]lot\f[] of money.  So is $34,000. @@ -719,7 +719,7 @@ This & that.  .PP  Backslash: \\  .PP -Backtick: ` +Backtick: \[aq]  .PP  Asterisk: *  .PP @@ -968,7 +968,7 @@ If you want, you can indent every line, but you can also be  lazy and just indent the first line of each block.  .FE  This should \f[I]not\f[] be a footnote reference, because it -contains a space.[^my note] Here is an inline note.\** +contains a space.[\[ha]my note] Here is an inline note.\**  .FS  This  is \f[I]easier\f[] to type. | 
