diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-12-10 16:38:49 -0500 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-12-10 19:24:56 -0500 |
commit | 2cbd8a3351accb11fa937bb2ea571c569cf6da1f (patch) | |
tree | bc20a08da97b3af4ac15fed04c710221d3010b7b /src | |
parent | 9366388c05203c2b39df62727757df01be2545ee (diff) | |
download | pandoc-2cbd8a3351accb11fa937bb2ea571c569cf6da1f.tar.gz |
Docx writer: Make Level into a real type.
It had previously been an alias for a tuple.
Diffstat (limited to 'src')
-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 |