Odt: Add list-header

The list-header is a type of list-item.
Therefore, it will be treated exactly like one.
This commit is contained in:
Tuong Nguyen Manh 2022-01-02 11:28:38 +01:00 committed by John MacFarlane
parent 808bcb5d3b
commit 32297d5677
6 changed files with 146 additions and 7 deletions

View file

@ -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
]
)
----------------------

View file

@ -171,6 +171,7 @@ namesOfTestsComparingToNative = [ "blockquote"
, "orderedListMixed"
, "orderedListRoman"
, "orderedListSimple"
, "orderedListHeader"
, "referenceToChapter"
, "referenceToListItem"
, "referenceToText"
@ -182,4 +183,5 @@ namesOfTestsComparingToNative = [ "blockquote"
, "tableWithContents"
, "unicode"
, "unorderedList"
, "unorderedListHeader"
]

View file

@ -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." ]
]
]
]

View file

@ -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?" ] ]
]
]

Binary file not shown.

Binary file not shown.