diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Parse.hs | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 621239bc7..31f332c89 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -655,7 +655,7 @@ bodyPartToBlocks (ListItem pPr numId lvl (Just levelInfo) parparts) = do -- since Docx expects us to pick up where we left off. listState <- gets docxListState let startFromState = M.lookup (numId, lvl) listState - (_, fmt,txt, startFromLevelInfo) = levelInfo + Level _ fmt txt startFromLevelInfo = levelInfo start = case startFromState of Just n -> n + 1 Nothing -> fromMaybe 1 startFromLevelInfo diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index b4e52de14..358c7bf42 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -56,6 +56,7 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..) , ChangeType(..) , ChangeInfo(..) , FieldInfo(..) + , Level(..) , archiveToDocx , archiveToDocxWithWarnings ) where @@ -195,7 +196,8 @@ data AbstractNumb = AbstractNumb String [Level] deriving Show -- (ilvl, format, string, start) -type Level = (String, String, String, Maybe Integer) +data Level = Level String String String (Maybe Integer) + deriving Show data DocumentLocation = InDocument | InFootnote | InEndnote deriving (Eq,Show) @@ -505,7 +507,7 @@ lookupLevel :: String -> String -> Numbering -> Maybe Level lookupLevel numId ilvl (Numbering _ numbs absNumbs) = do absNumId <- lookup numId $ map (\(Numb nid absnumid) -> (nid, absnumid)) numbs lvls <- lookup absNumId $ map (\(AbstractNumb aid ls) -> (aid, ls)) absNumbs - lookup ilvl $ map (\l@(i, _, _, _) -> (i, l)) lvls + lookup ilvl $ map (\l@(Level i _ _ _) -> (i, l)) lvls numElemToNum :: NameSpaces -> Element -> Maybe Numb @@ -537,7 +539,7 @@ levelElemToLevel ns element let start = findChildByName ns "w" "start" element >>= findAttrByName ns "w" "val" >>= (\s -> listToMaybe (map fst (reads s :: [(Integer, String)]))) - return (ilvl, fmt, txt, start) + return (Level ilvl fmt txt start) levelElemToLevel _ _ = Nothing archiveToNumbering' :: Archive -> Maybe Numbering |