git.iko.soy/typeable/pandoc
on master help sign in
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.

commit23e6495624682f0c8d130a3f6db5dc60056015fa authorJohn MacFarlane <jgm@berkeley.edu> dateFri 3 Feb 2017, 11:57 (10 years ago) parent5cd475b
2 files changed+8
src/Text/Pandoc/Readers/Docx.hs+3 src/Text/Pandoc/Readers/Docx/Parse.hs+5
src/Text/Pandoc/Readers/Docx.hs+3
@@ -411,6 +411,9 @@ parPartToInlines (ExternalHyperLink target runs) = do
411411 return $ link target "" ils
412412parPartToInlines (PlainOMath exps) = do
413413 return $ math $ writeTeX exps
414+parPartToInlines (SmartTag runs) = do
415+ ils <- smushInlines <$> mapM runToInlines runs
416+ return ils
414417
415418isAnchorSpan :: Inline -> Bool
416419isAnchorSpan (Span (_, classes, kvs) _) =
src/Text/Pandoc/Readers/Docx/Parse.hs+5
@@ -218,6 +218,7 @@ data ParPart = PlainRun Run
218218 | Drawing FilePath String String B.ByteString Extent -- title, alt
219219 | Chart -- placeholder for now
220220 | PlainOMath [Exp]
221+ | SmartTag [Run]
221222 deriving Show
222223
223224data Run = Run RunStyle [RunElem]
@@ -708,6 +709,10 @@ elemToParPart ns element
708709 , Just cDate <- findAttr (elemName ns "w" "date") element = do
709710 runs <- mapD (elemToRun ns) (elChildren element)
710711 return $ Deletion cId cAuthor cDate runs
712+elemToParPart ns element
713+ | isElem ns "w" "smartTag" element = do
714+ runs <- mapD (elemToRun ns) (elChildren element)
715+ return $ SmartTag runs
711716elemToParPart ns element
712717 | isElem ns "w" "bookmarkStart" element
713718 , Just bmId <- findAttr (elemName ns "w" "id") element