git.iko.soy/typeable/pandoc
on master help sign in
Ms writer: fix definition lists so indent even when...

paragraph indent is set to 0 (as is the default). Also ensure indent for display math that falls back to TeX.

commit87875763c8ea81c07ad01972e3740c3f3cdbd0c0 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 7 Mar 2020, 21:54 (7 years ago) parent2ab83a5
2 files changed+43−42
src/Text/Pandoc/Writers/Ms.hs+4−3 test/writer.ms+39−39
src/Text/Pandoc/Writers/Ms.hs+4−3
@@ -321,8 +321,9 @@ definitionListItemToMs opts (label, defs) = do
321321 rest' <- liftM vcat $
322322 mapM (\item -> blockToMs opts item) rest
323323 first' <- blockToMs opts first
324− return $ first' $$ literal ".RS" $$ rest' $$ literal ".RE"
325− return $ nowrap (literal ".IP " <> doubleQuotes labelText) $$ contents
324+ return $ first' $$ literal ".RS 3" $$ rest' $$ literal ".RE"
325+ return $ nowrap (literal ".IP " <> doubleQuotes labelText <> " 3") $$
326+ contents
326327
327328-- | Convert list of Pandoc block elements to ms.
328329blockListToMs :: PandocMonad m
@@ -400,7 +401,7 @@ inlineToMs opts (Math DisplayMath str) = do
400401 case res of
401402 Left il -> do
402403 contents <- inlineToMs opts il
403− return $ cr <> literal ".RS" $$ contents $$ literal ".RE"
404+ return $ cr <> literal ".RS 3" $$ contents $$ literal ".RE"
404405 Right r -> return $
405406 cr <> literal ".EQ" $$ literal r $$ literal ".EN" <> cr
406407inlineToMs _ il@(RawInline f str)
test/writer.ms+39−39
@@ -445,57 +445,57 @@ Definition Lists
445445.pdfhref M "definition-lists"
446446.LP
447447Tight using spaces:
448−.IP "\f[B]apple\f[R]"
448+.IP "\f[B]apple\f[R]" 3
449449red fruit
450−.RS
450+.RS 3
451451.RE
452−.IP "\f[B]orange\f[R]"
452+.IP "\f[B]orange\f[R]" 3
453453orange fruit
454−.RS
454+.RS 3
455455.RE
456−.IP "\f[B]banana\f[R]"
456+.IP "\f[B]banana\f[R]" 3
457457yellow fruit
458−.RS
458+.RS 3
459459.RE
460460.LP
461461Tight using tabs:
462−.IP "\f[B]apple\f[R]"
462+.IP "\f[B]apple\f[R]" 3
463463red fruit
464−.RS
464+.RS 3
465465.RE
466−.IP "\f[B]orange\f[R]"
466+.IP "\f[B]orange\f[R]" 3
467467orange fruit
468−.RS
468+.RS 3
469469.RE
470−.IP "\f[B]banana\f[R]"
470+.IP "\f[B]banana\f[R]" 3
471471yellow fruit
472−.RS
472+.RS 3
473473.RE
474474.LP
475475Loose:
476−.IP "\f[B]apple\f[R]"
476+.IP "\f[B]apple\f[R]" 3
477477red fruit
478−.RS
478+.RS 3
479479.RE
480−.IP "\f[B]orange\f[R]"
480+.IP "\f[B]orange\f[R]" 3
481481orange fruit
482−.RS
482+.RS 3
483483.RE
484−.IP "\f[B]banana\f[R]"
484+.IP "\f[B]banana\f[R]" 3
485485yellow fruit
486−.RS
486+.RS 3
487487.RE
488488.LP
489489Multiple blocks with italics:
490−.IP "\f[B]\f[BI]apple\f[B]\f[R]"
490+.IP "\f[B]\f[BI]apple\f[B]\f[R]" 3
491491red fruit
492−.RS
492+.RS 3
493493.PP
494494contains seeds, crisp, pleasant to taste
495495.RE
496−.IP "\f[B]\f[BI]orange\f[B]\f[R]"
496+.IP "\f[B]\f[BI]orange\f[B]\f[R]" 3
497497orange fruit
498−.RS
498+.RS 3
499499.IP
500500.nf
501501\f[C]
@@ -509,48 +509,48 @@ orange block quote
509509.RE
510510.LP
511511Multiple definitions, tight:
512−.IP "\f[B]apple\f[R]"
512+.IP "\f[B]apple\f[R]" 3
513513red fruit
514−.RS
514+.RS 3
515515.RE
516516computer
517−.RS
517+.RS 3
518518.RE
519−.IP "\f[B]orange\f[R]"
519+.IP "\f[B]orange\f[R]" 3
520520orange fruit
521−.RS
521+.RS 3
522522.RE
523523bank
524−.RS
524+.RS 3
525525.RE
526526.LP
527527Multiple definitions, loose:
528−.IP "\f[B]apple\f[R]"
528+.IP "\f[B]apple\f[R]" 3
529529red fruit
530−.RS
530+.RS 3
531531.RE
532532computer
533−.RS
533+.RS 3
534534.RE
535−.IP "\f[B]orange\f[R]"
535+.IP "\f[B]orange\f[R]" 3
536536orange fruit
537−.RS
537+.RS 3
538538.RE
539539bank
540−.RS
540+.RS 3
541541.RE
542542.LP
543543Blank line after term, indented marker, alternate markers:
544−.IP "\f[B]apple\f[R]"
544+.IP "\f[B]apple\f[R]" 3
545545red fruit
546−.RS
546+.RS 3
547547.RE
548548computer
549−.RS
549+.RS 3
550550.RE
551−.IP "\f[B]orange\f[R]"
551+.IP "\f[B]orange\f[R]" 3
552552orange fruit
553−.RS
553+.RS 3
554554.IP " 1." 4
555555sublist
556556.IP " 2." 4