git.iko.soy/typeable/pandoc
on master help sign in
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.

commit7fe54505df35157e63548b493504a34bfa624427 authorJesse Rosenthal <jrosenthal@jhu.edu> dateThu 4 Sep 2014, 16:35 (12 years ago) parentdb90667
1 file changed+6−4
src/Text/Pandoc/Readers/Docx/Lists.hs+6−4
src/Text/Pandoc/Readers/Docx/Lists.hs+6−4
@@ -160,8 +160,14 @@ flatToBullets' num xs@(b : elems)
160160flatToBullets :: [Block] -> [Block]
161161flatToBullets elems = flatToBullets' (-1) elems
162162
163+singleItemHeaderToHeader :: Block -> Block
164+singleItemHeaderToHeader (OrderedList _ [[h@(Header _ _ _)]]) = h
165+singleItemHeaderToHeader blk = blk
166+
167+
163168blocksToBullets :: [Block] -> [Block]
164169blocksToBullets blks =
170+ map singleItemHeaderToHeader $
165171 bottomUp removeListDivs $
166172 flatToBullets $ (handleListParagraphs blks)
167173
@@ -221,7 +227,3 @@ removeListDivs = concatMap removeListDivs'
221227
222228blocksToDefinitions :: [Block] -> [Block]
223229blocksToDefinitions = blocksToDefinitions' [] []
224−
225−
226−
227−