diff options
author | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2016-10-14 13:56:24 +0200 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2016-10-14 13:56:24 +0200 |
commit | 9282fadc6bc6c56a7f81ba48b75c827dc92eae2e (patch) | |
tree | 4d7e8e0853137c666ab8b14ff81a00084e78c235 | |
parent | edc951ee7d43f9ef548686ef9ba82380f7235d2b (diff) | |
download | pandoc-9282fadc6bc6c56a7f81ba48b75c827dc92eae2e.tar.gz |
Added tests and a corner case for starting number
Review revealed that we didn't handle the case
when the starting point is an empty string. While
this is not a valid .odt file, we simply added
a special case to deal with it.
Also added tests for the new feature.
-rw-r--r-- | src/Text/Pandoc/Readers/Odt/StyleReader.hs | 1 | ||||
-rw-r--r-- | tests/odt/native/orderedListMixed.native | 2 | ||||
-rw-r--r-- | tests/odt/native/orderedListRoman.native | 2 | ||||
-rw-r--r-- | tests/odt/native/orderedListSimple.native | 2 | ||||
-rw-r--r-- | tests/odt/odt/orderedListMixed.odt | bin | 10580 -> 11970 bytes | |||
-rw-r--r-- | tests/odt/odt/orderedListRoman.odt | bin | 10622 -> 11730 bytes | |||
-rw-r--r-- | tests/odt/odt/orderedListSimple.odt | bin | 10570 -> 11817 bytes |
7 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/Odt/StyleReader.hs index 77f47db29..26ba6df82 100644 --- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs +++ b/src/Text/Pandoc/Readers/Odt/StyleReader.hs @@ -591,6 +591,7 @@ readListLevelStyle levelType = readAttr NsText "level" toListLevelStyle _ p s LinfNone b = ListLevelStyle LltBullet p s LinfNone (startValue b) toListLevelStyle _ p s f@(LinfString _) b = ListLevelStyle LltBullet p s f (startValue b) toListLevelStyle t p s f b = ListLevelStyle t p s f (startValue b) + startValue (Just "") = 1 startValue (Just v) = if all isDigit v then read v else 1 diff --git a/tests/odt/native/orderedListMixed.native b/tests/odt/native/orderedListMixed.native index a50f5e2ad..c2c8586af 100644 --- a/tests/odt/native/orderedListMixed.native +++ b/tests/odt/native/orderedListMixed.native @@ -1 +1 @@ -Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,Decimal,Period) [[Plain [Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,Decimal,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,LowerAlpha,OneParen) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]]]
\ No newline at end of file +Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,Decimal,Period) [[Plain [Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,Decimal,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,LowerAlpha,OneParen) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]],Para [],OrderedList (4,Decimal,Period) [[Plain [Str "Start",Space,Str "new",Space,Str "list,",Space,Str "but",Space,Str "a",Space,Str "different",Space,Str "starting",Space,Str "point."]] ,[Plain [Str "Because",Space,Str "we",Space,Str "can."]]]]
\ No newline at end of file diff --git a/tests/odt/native/orderedListRoman.native b/tests/odt/native/orderedListRoman.native index f186e0735..73bbbf1c9 100644 --- a/tests/odt/native/orderedListRoman.native +++ b/tests/odt/native/orderedListRoman.native @@ -1 +1 @@ -Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,UpperRoman,Period) [[Plain[Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,UpperRoman,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,UpperRoman,Period) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]]]
\ No newline at end of file +Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,UpperRoman,Period) [[Plain[Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,UpperRoman,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,UpperRoman,Period) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]],Para [],OrderedList (4,UpperRoman,Period) [[Plain [Str "Start",Space,Str "new",Space,Str "list,",Space,Str "but",Space,Str "a",Space,Str "different",Space,Str "starting",Space,Str "point."]] ,[Plain [Str "Because",Space,Str "we",Space,Str "can."]]]]
\ No newline at end of file diff --git a/tests/odt/native/orderedListSimple.native b/tests/odt/native/orderedListSimple.native index 90a51856a..0b1f85231 100644 --- a/tests/odt/native/orderedListSimple.native +++ b/tests/odt/native/orderedListSimple.native @@ -1 +1 @@ -Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,Decimal,Period) [[Plain [Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,Decimal,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,Decimal,Period) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]]]
\ No newline at end of file +Pandoc (Meta {unMeta = fromList []}) [OrderedList (1,Decimal,Period) [[Plain [Str "A",Space,Str "list",Space,Str "item"]],[Plain [Str "A",Space,Str "second"]],[Para [Str "A",Space,Str "third"],OrderedList (1,Decimal,Period) [[Para [Str "New",Space,Str "level!"],OrderedList (1,Decimal,Period) [[Plain [Str "And",Space,Str "another!"]],[Plain [Str "It's",Space,Str "great",Space,Str "up",Space,Str "here!"]]]],[Plain [Str "Oh",Space,Str "noes"]],[Plain [Str "We",Space,Str "fell!"]]]],[Plain [Str "Maybe",Space,Str "someone"]],[Plain [Str "Pushed",Space,Str "us?"]]],Para [],OrderedList (4,Decimal,Period) [[Plain [Str "Start",Space,Str "new",Space,Str "list,",Space,Str "but",Space,Str "a",Space,Str "different",Space,Str "starting",Space,Str "point."]] ,[Plain [Str "Because",Space,Str "we",Space,Str "can."]]]]
\ No newline at end of file diff --git a/tests/odt/odt/orderedListMixed.odt b/tests/odt/odt/orderedListMixed.odt Binary files differindex 1aa50ff06..2b593d635 100644 --- a/tests/odt/odt/orderedListMixed.odt +++ b/tests/odt/odt/orderedListMixed.odt diff --git a/tests/odt/odt/orderedListRoman.odt b/tests/odt/odt/orderedListRoman.odt Binary files differindex 7266e89bc..0acfe92ce 100644 --- a/tests/odt/odt/orderedListRoman.odt +++ b/tests/odt/odt/orderedListRoman.odt diff --git a/tests/odt/odt/orderedListSimple.odt b/tests/odt/odt/orderedListSimple.odt Binary files differindex 4fe543794..7af312fcc 100644 --- a/tests/odt/odt/orderedListSimple.odt +++ b/tests/odt/odt/orderedListSimple.odt |