diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-09-04 16:35:57 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-09-04 16:35:57 -0400 |
commit | 7fe54505df35157e63548b493504a34bfa624427 (patch) | |
tree | fc36a65c812261b2c8801cefb00116bd1712d143 /src/Text/Pandoc/Readers | |
parent | db90667a79bb4e3fc8c0307ddd5fc52533d61337 (diff) | |
download | pandoc-7fe54505df35157e63548b493504a34bfa624427.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Lists.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Lists.hs b/src/Text/Pandoc/Readers/Docx/Lists.hs index ea195c14a..c265ad074 100644 --- a/src/Text/Pandoc/Readers/Docx/Lists.hs +++ b/src/Text/Pandoc/Readers/Docx/Lists.hs @@ -160,8 +160,14 @@ flatToBullets' num xs@(b : elems) flatToBullets :: [Block] -> [Block] flatToBullets elems = flatToBullets' (-1) elems +singleItemHeaderToHeader :: Block -> Block +singleItemHeaderToHeader (OrderedList _ [[h@(Header _ _ _)]]) = h +singleItemHeaderToHeader blk = blk + + blocksToBullets :: [Block] -> [Block] blocksToBullets blks = + map singleItemHeaderToHeader $ bottomUp removeListDivs $ flatToBullets $ (handleListParagraphs blks) @@ -221,7 +227,3 @@ removeListDivs = concatMap removeListDivs' blocksToDefinitions :: [Block] -> [Block] blocksToDefinitions = blocksToDefinitions' [] [] - - - - |