diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index c123a0018..1f7f07e36 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -136,7 +136,7 @@ unwrapSDT :: NameSpaces -> Content -> [Content] unwrapSDT ns (Elem element) | isElem ns "w" "sdt" element , Just sdtContent <- findChildByName ns "w" "sdtContent" element - = map Elem $ elChildren sdtContent + = concatMap (unwrapSDT ns) $ map Elem $ elChildren sdtContent unwrapSDT _ content = [content] unwrapSDTchild :: NameSpaces -> Content -> Content diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs index cef80d6d1..0ba765c93 100644 --- a/test/Tests/Readers/Docx.hs +++ b/test/Tests/Readers/Docx.hs @@ -178,6 +178,10 @@ tests = [ testGroup "inlines" "inlines inside of Structured Document Tags" "docx/sdt_elements.docx" "docx/sdt_elements.native" + , testCompare + "nested Structured Document Tags" + "docx/nested_sdt.docx" + "docx/nested_sdt.native" , testCompare "remove anchor spans with nothing pointing to them" "docx/unused_anchors.docx" diff --git a/test/docx/nested_sdt.docx b/test/docx/nested_sdt.docx new file mode 100644 index 000000000..1a0827db3 Binary files /dev/null and b/test/docx/nested_sdt.docx differ diff --git a/test/docx/nested_sdt.native b/test/docx/nested_sdt.native new file mode 100644 index 000000000..d0adc05ac --- /dev/null +++ b/test/docx/nested_sdt.native @@ -0,0 +1,3 @@ +[Para [Str "Test",Space,Str "Paragraph1"] +,Para [Str "Test",Space,Str "Paragraph2"] +,Para [Str "Test",Space,Str "Paragraph3"]]