git.iko.soy/typeable/pandoc
on master help sign in
PowerPoint writer: Start numbering at appopriate numbers.

Starting numbers for ordered lists were previously ignored. Now we specify the number if it is something other than 1. Closes: #5709

commit4a7dad18b109987cfa13168a9f5505c183744d99 authorJesse Rosenthal <jrosenthal@jhu.edu> dateTue 27 Aug 2019, 01:16 (7 years ago) parent62dc2f8
5 files changed+21−4
src/Text/Pandoc/Writers/Powerpoint/Output.hs+8−4 test/Tests/Writers/Powerpoint.hs+4 test/pptx/start_numbering_at.native+9 test/pptx/start_numbering_at.pptx test/pptx/start_numbering_at_templated.pptx
src/Text/Pandoc/Writers/Powerpoint/Output.hs+8−4
@@ -861,7 +861,7 @@ paragraphToElement par = do
861861 (case pPropBullet $ paraProps par of
862862 Just Bullet -> []
863863 Just (AutoNumbering attrs') ->
864− [mknode "a:buAutoNum" [("type", autoNumberingToType attrs')] ()]
864+ [mknode "a:buAutoNum" (autoNumAttrs attrs') ()]
865865 Nothing -> [mknode "a:buNone" [] ()]
866866 )
867867 paras <- concat <$> mapM paraElemToElements (paraElems par)
@@ -1872,10 +1872,14 @@ getContentType fp
18721872 Just $ presML ++ ".slideLayout+xml"
18731873 | otherwise = Nothing
18741874
1875−autoNumberingToType :: ListAttributes -> String
1876−autoNumberingToType (_, numStyle, numDelim) =
1877− typeString ++ delimString
1875+autoNumAttrs :: ListAttributes -> [(String, String)]
1876+autoNumAttrs (startNum, numStyle, numDelim) =
1877+ numAttr ++ typeAttr
18781878 where
1879+ numAttr = if startNum == 1
1880+ then []
1881+ else [("startAt", show startNum)]
1882+ typeAttr = [("type", typeString ++ delimString)]
18791883 typeString = case numStyle of
18801884 Decimal -> "arabic"
18811885 UpperAlpha -> "alphaUc"
test/Tests/Writers/Powerpoint.hs+4
@@ -59,6 +59,10 @@ tests = groupPptxTests [ pptxTests "Inline formatting"
5959 def
6060 "pptx/lists.native"
6161 "pptx/lists.pptx"
62+ , pptxTests "start ordered list at specified num"
63+ def
64+ "pptx/start_numbering_at.native"
65+ "pptx/start_numbering_at.pptx"
6266 , pptxTests "tables"
6367 def
6468 "pptx/tables.native"
test/pptx/start_numbering_at.nativenew file+9
@@ -0,0 +1,9 @@
1+[Header 2 ("example-numbering-mwe",[],[]) [Str "Example",Space,Str "numbering",Space,Str "MWE"]
2+,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "slide",Space,Str "with",Space,Str "examples",Space,Str "in",Space,Str "(1)",Space,Str "and",Space,Str "(2)"]
3+,OrderedList (1,Example,TwoParens)
4+ [[Plain [Str "First"]]
5+ ,[Plain [Str "Second"]]]
6+,Header 2 ("a-second-slide",[],[]) [Str "A",Space,Str "second",Space,Str "slide"]
7+,Para [Str "This",Space,Str "second",Space,Str "slide",Space,Str "has",Space,Str "a",Space,Str "third",Space,Str "example",Space,Str "in",Space,Str "(3)."]
8+,OrderedList (3,Example,TwoParens)
9+ [[Plain [Str "Third"]]]]
test/pptx/start_numbering_at.pptxnew file

Binary file not shown.

test/pptx/start_numbering_at_templated.pptxnew file

Binary file not shown.