aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-03-16 12:50:32 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-03-16 12:50:32 -0400
commit855c8b43f0497125f8d24b113ce0df92ed7d074b (patch)
tree5dd5ba1463166b6e1104409b3de34547145ccd3b /src/Text/Pandoc/Readers
parent09b4f294bf4584f0010abc331b7e44bb26189865 (diff)
downloadpandoc-855c8b43f0497125f8d24b113ce0df92ed7d074b.tar.gz
Docx reader: Don't make numbered heads into lists.
Word uses list numbering styles to number its headings. We only call something a numbered list if it does not also heave a heading style.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index e4cfe4930..cbdd86221 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -589,12 +589,14 @@ elemToBodyPart ns element
sty <- asks envParStyles
let parstyle = elemToParagraphStyle ns element sty
parparts <- mapD (elemToParPart ns) (elChildren element)
- case pNumInfo parstyle of
- Just (numId, lvl) -> do
- num <- asks envNumbering
- let levelInfo = lookupLevel numId lvl num
- return $ ListItem parstyle numId lvl levelInfo parparts
- Nothing -> return $ Paragraph parstyle parparts
+ -- Word uses list enumeration for numbered headings, so we only
+ -- want to infer a list from the styles if it is NOT a heading.
+ case pHeading parstyle of
+ Nothing | Just (numId, lvl) <- pNumInfo parstyle -> do
+ num <- asks envNumbering
+ let levelInfo = lookupLevel numId lvl num
+ return $ ListItem parstyle numId lvl levelInfo parparts
+ _ -> return $ Paragraph parstyle parparts
elemToBodyPart ns element
| isElem ns "w" "tbl" element = do
let caption' = findChild (elemName ns "w" "tblPr") element