diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Parse.hs | 25 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 582b4be13..104e17c18 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -460,8 +460,6 @@ parPartToInlines' (ExternalHyperLink target runs) = do return $ link target "" ils parPartToInlines' (PlainOMath exps) = return $ math $ writeTeX exps -parPartToInlines' (SmartTag runs) = - smushInlines <$> mapM runToInlines runs parPartToInlines' (Field info runs) = case info of HyperlinkField url -> parPartToInlines' $ ExternalHyperLink url runs diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 1f7f07e36..dcf2e0493 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -132,21 +132,23 @@ mapD f xs = in concatMapM handler xs -unwrapSDT :: NameSpaces -> Content -> [Content] -unwrapSDT ns (Elem element) +unwrap :: NameSpaces -> Content -> [Content] +unwrap ns (Elem element) | isElem ns "w" "sdt" element , Just sdtContent <- findChildByName ns "w" "sdtContent" element - = concatMap (unwrapSDT ns) $ map Elem $ elChildren sdtContent -unwrapSDT _ content = [content] + = concatMap (unwrap ns) $ map Elem $ elChildren sdtContent + | isElem ns "w" "smartTag" element + = concatMap (unwrap ns) $ map Elem $ elChildren element +unwrap _ content = [content] -unwrapSDTchild :: NameSpaces -> Content -> Content -unwrapSDTchild ns (Elem element) = - Elem $ element { elContent = concatMap (unwrapSDT ns) (elContent element) } -unwrapSDTchild _ content = content +unwrapChild :: NameSpaces -> Content -> Content +unwrapChild ns (Elem element) = + Elem $ element { elContent = concatMap (unwrap ns) (elContent element) } +unwrapChild _ content = content walkDocument' :: NameSpaces -> XMLC.Cursor -> XMLC.Cursor walkDocument' ns cur = - let modifiedCur = XMLC.modifyContent (unwrapSDTchild ns) cur + let modifiedCur = XMLC.modifyContent (unwrapChild ns) cur in case XMLC.nextDF modifiedCur of Just cur' -> walkDocument' ns cur' @@ -275,7 +277,6 @@ data ParPart = PlainRun Run | Drawing FilePath String String B.ByteString Extent -- title, alt | Chart -- placeholder for now | PlainOMath [Exp] - | SmartTag [Run] | Field FieldInfo [Run] | NullParPart -- when we need to return nothing, but -- not because of an error. @@ -826,10 +827,6 @@ elemToParPart ns element runs <- mapD (elemToRun ns) (elChildren element) return $ ChangedRuns change runs elemToParPart ns element - | isElem ns "w" "smartTag" element = do - runs <- mapD (elemToRun ns) (elChildren element) - return $ SmartTag runs -elemToParPart ns element | isElem ns "w" "bookmarkStart" element , Just bmId <- findAttrByName ns "w" "id" element , Just bmName <- findAttrByName ns "w" "name" element = |