diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 367cb74cc..527438fac 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -1219,7 +1219,7 @@ elemToParPart' ns element (matchQName "drawingml" "chart" (Just "c") "chart") drawingElem = return [Chart] elemToParPart' ns element - | isElem ns "w" "r" element = do + | isElem ns "w" "r" element || isElem ns "w" "customXml" element = do runs <- elemToRun ns element return $ map PlainRun runs elemToParPart' ns element @@ -1364,6 +1364,9 @@ elemToRun ns element runElems <- elemToRunElems ns element runStyle <- elemToRunStyleD ns element return [Run runStyle runElems] +elemToRun ns element + | isElem ns "w" "customXml" element = + mconcat <$> mapM (elemToRun ns) (elChildren element) elemToRun _ _ = throwError WrongElem getParentStyleValue :: (ParStyle -> Maybe a) -> ParStyle -> Maybe a diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs index a03eb1589..bc3408842 100644 --- a/test/Tests/Readers/Docx.hs +++ b/test/Tests/Readers/Docx.hs @@ -219,6 +219,10 @@ tests = [ testGroup "document" "nested Smart Tags" "docx/nested_smart_tags.docx" "docx/nested_smart_tags.native" + , testCompare + "inline customXml elements" + "docx/custom_xml.docx" + "docx/custom_xml.native" , testCompare "remove anchor spans with nothing pointing to them" "docx/unused_anchors.docx" diff --git a/test/docx/custom_xml.docx b/test/docx/custom_xml.docx new file mode 100644 index 000000000..31221f595 Binary files /dev/null and b/test/docx/custom_xml.docx differ diff --git a/test/docx/custom_xml.native b/test/docx/custom_xml.native new file mode 100644 index 000000000..5c46b5c4a --- /dev/null +++ b/test/docx/custom_xml.native @@ -0,0 +1,36 @@ +[ Para + [ Str "This" + , Space + , Str "is" + , Space + , Str "some" + , Space + , Str "sample" + , Space + , Str "content" + , Space + , Str "that" + , Space + , Str "will" + , Space + , Str "be" + , Space + , Str "wrapped" + , Space + , Str "inside" + , Space + , Str "a" + , Space + , Str "customXml" + , Space + , Str "element" + , Space + , Str "in" + , Space + , Str "the" + , Space + , Str "OpenXML" + , Space + , Str "structure." + ] +]