Docx reader: Single-item headers in ordered lists are headers.
When users number their headers, Word understands that as a single item enumerated list. We make the assumption that such a list is, in fact, a header.
This commit is contained in:
parent
db90667a79
commit
7fe54505df
1 changed files with 6 additions and 4 deletions
|
@ -160,8 +160,14 @@ flatToBullets' num xs@(b : elems)
|
||||||
flatToBullets :: [Block] -> [Block]
|
flatToBullets :: [Block] -> [Block]
|
||||||
flatToBullets elems = flatToBullets' (-1) elems
|
flatToBullets elems = flatToBullets' (-1) elems
|
||||||
|
|
||||||
|
singleItemHeaderToHeader :: Block -> Block
|
||||||
|
singleItemHeaderToHeader (OrderedList _ [[h@(Header _ _ _)]]) = h
|
||||||
|
singleItemHeaderToHeader blk = blk
|
||||||
|
|
||||||
|
|
||||||
blocksToBullets :: [Block] -> [Block]
|
blocksToBullets :: [Block] -> [Block]
|
||||||
blocksToBullets blks =
|
blocksToBullets blks =
|
||||||
|
map singleItemHeaderToHeader $
|
||||||
bottomUp removeListDivs $
|
bottomUp removeListDivs $
|
||||||
flatToBullets $ (handleListParagraphs blks)
|
flatToBullets $ (handleListParagraphs blks)
|
||||||
|
|
||||||
|
@ -221,7 +227,3 @@ removeListDivs = concatMap removeListDivs'
|
||||||
|
|
||||||
blocksToDefinitions :: [Block] -> [Block]
|
blocksToDefinitions :: [Block] -> [Block]
|
||||||
blocksToDefinitions = blocksToDefinitions' [] []
|
blocksToDefinitions = blocksToDefinitions' [] []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue