diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/Odt/ContentReader.hs index 5520d039f..998999d25 100644 --- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs +++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs @@ -661,16 +661,23 @@ read_list = matchingElement NsText "list" $ constructList -- $ liftA bulletList $ matchChildContent' [ read_list_item + , read_list_header ] -- read_list_item :: ElementMatcher [Blocks] -read_list_item = matchingElement NsText "list-item" - $ liftA (compactify.(:[])) - ( matchChildContent' [ read_paragraph - , read_header - , read_list - ] - ) +read_list_item = read_list_element "list-item" + +read_list_header :: ElementMatcher [Blocks] +read_list_header = read_list_element "list-header" + +read_list_element :: ElementName -> ElementMatcher [Blocks] +read_list_element listElement = matchingElement NsText listElement + $ liftA (compactify.(:[])) + ( matchChildContent' [ read_paragraph + , read_header + , read_list + ] + ) ---------------------- diff --git a/test/Tests/Readers/Odt.hs b/test/Tests/Readers/Odt.hs index f731dacdc..8dcd7b29b 100644 --- a/test/Tests/Readers/Odt.hs +++ b/test/Tests/Readers/Odt.hs @@ -171,6 +171,7 @@ namesOfTestsComparingToNative = [ "blockquote" , "orderedListMixed" , "orderedListRoman" , "orderedListSimple" + , "orderedListHeader" , "referenceToChapter" , "referenceToListItem" , "referenceToText" @@ -182,4 +183,5 @@ namesOfTestsComparingToNative = [ "blockquote" , "tableWithContents" , "unicode" , "unorderedList" + , "unorderedListHeader" ] diff --git a/test/odt/native/orderedListHeader.native b/test/odt/native/orderedListHeader.native new file mode 100644 index 000000000..926eb5957 --- /dev/null +++ b/test/odt/native/orderedListHeader.native @@ -0,0 +1,80 @@ +[ OrderedList + ( 1 , Decimal , Period ) + [ [ Plain + [ Str "A" + , Space + , Str "list" + , Space + , Str "item" + , Space + , Str "(list-header)" + ] + ] + , [ Plain [ Str "A" , Space , Str "second" ] ] + , [ Para [ Str "A" , Space , Str "third" ] + , OrderedList + ( 1 , Decimal , Period ) + [ [ Para + [ Str "New" + , Space + , Str "level!" + , Space + , Str "(list-header)" + ] + , OrderedList + ( 1 , Decimal , Period ) + [ [ Plain + [ Str "And" + , Space + , Str "another!" + , Space + , Str "(list-header)" + ] + ] + , [ 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." + , Space + , Str "(list-header)" + ] + ] + , [ Plain + [ Str "Because" , Space , Str "we" , Space , Str "can." ] + ] + ] +] diff --git a/test/odt/native/unorderedListHeader.native b/test/odt/native/unorderedListHeader.native new file mode 100644 index 000000000..05db5838b --- /dev/null +++ b/test/odt/native/unorderedListHeader.native @@ -0,0 +1,50 @@ +[ BulletList + [ [ Plain + [ Str "A" + , Space + , Str "list" + , Space + , Str "item" + , Space + , Str "(list-header)" + ] + ] + , [ Plain [ Str "A" , Space , Str "second" ] ] + , [ Para [ Str "A" , Space , Str "third" ] + , BulletList + [ [ Para + [ Str "New" + , Space + , Str "level!" + , Space + , Str "(list-header)" + ] + , BulletList + [ [ Plain + [ Str "And" + , Space + , Str "another!" + , Space + , Str "(list-header)" + ] + ] + , [ 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?" ] ] + ] +] diff --git a/test/odt/odt/orderedListHeader.odt b/test/odt/odt/orderedListHeader.odt new file mode 100644 index 000000000..e99a898c8 Binary files /dev/null and b/test/odt/odt/orderedListHeader.odt differ diff --git a/test/odt/odt/unorderedListHeader.odt b/test/odt/odt/unorderedListHeader.odt new file mode 100644 index 000000000..3f5980ef7 Binary files /dev/null and b/test/odt/odt/unorderedListHeader.odt differ