Docx reader: Don't drop smartTag contents.
This just parses inside smartTags and yields their contents, ignoring the attributes of the smartTag. @jkr, you may want to adjust this, but I wanted to get a fix in as fast as possible for the dropped content. Closes #2242; see also #3412.
This commit is contained in:
parent
5cd475be70
commit
23e6495624
2 changed files with 8 additions and 0 deletions
|
@ -411,6 +411,9 @@ parPartToInlines (ExternalHyperLink target runs) = do
|
||||||
return $ link target "" ils
|
return $ link target "" ils
|
||||||
parPartToInlines (PlainOMath exps) = do
|
parPartToInlines (PlainOMath exps) = do
|
||||||
return $ math $ writeTeX exps
|
return $ math $ writeTeX exps
|
||||||
|
parPartToInlines (SmartTag runs) = do
|
||||||
|
ils <- smushInlines <$> mapM runToInlines runs
|
||||||
|
return ils
|
||||||
|
|
||||||
isAnchorSpan :: Inline -> Bool
|
isAnchorSpan :: Inline -> Bool
|
||||||
isAnchorSpan (Span (_, classes, kvs) _) =
|
isAnchorSpan (Span (_, classes, kvs) _) =
|
||||||
|
|
|
@ -218,6 +218,7 @@ data ParPart = PlainRun Run
|
||||||
| Drawing FilePath String String B.ByteString Extent -- title, alt
|
| Drawing FilePath String String B.ByteString Extent -- title, alt
|
||||||
| Chart -- placeholder for now
|
| Chart -- placeholder for now
|
||||||
| PlainOMath [Exp]
|
| PlainOMath [Exp]
|
||||||
|
| SmartTag [Run]
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
data Run = Run RunStyle [RunElem]
|
data Run = Run RunStyle [RunElem]
|
||||||
|
@ -708,6 +709,10 @@ elemToParPart ns element
|
||||||
, Just cDate <- findAttr (elemName ns "w" "date") element = do
|
, Just cDate <- findAttr (elemName ns "w" "date") element = do
|
||||||
runs <- mapD (elemToRun ns) (elChildren element)
|
runs <- mapD (elemToRun ns) (elChildren element)
|
||||||
return $ Deletion cId cAuthor cDate runs
|
return $ Deletion cId cAuthor cDate runs
|
||||||
|
elemToParPart ns element
|
||||||
|
| isElem ns "w" "smartTag" element = do
|
||||||
|
runs <- mapD (elemToRun ns) (elChildren element)
|
||||||
|
return $ SmartTag runs
|
||||||
elemToParPart ns element
|
elemToParPart ns element
|
||||||
| isElem ns "w" "bookmarkStart" element
|
| isElem ns "w" "bookmarkStart" element
|
||||||
, Just bmId <- findAttr (elemName ns "w" "id") element
|
, Just bmId <- findAttr (elemName ns "w" "id") element
|
||||||
|
|
Loading…
Add table
Reference in a new issue