aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilan Bracke <mbracke@antidot.net>2021-06-24 09:27:28 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2021-10-18 19:15:40 -0700
commit465c28d28e1017040a41653edb6248056f178d3b (patch)
tree53c7255d8b1a8274289832b2056dfd3b9e206e6c /src
parent6acc82c5d2885c596c52e6c35bed8fe08f535066 (diff)
downloadpandoc-465c28d28e1017040a41653edb6248056f178d3b.tar.gz
Docx reader: fix handling of empty fields
Some fields only have an instrText and no content, Pandoc didn't understand these, causing other fields to be misunderstood because it seemed like a field was still open when it wasn't.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index a97d4b3d1..0021741ed 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -844,6 +844,10 @@ elemToParPart ns element
FldCharFieldInfo info : ancestors | fldCharType == "separate" -> do
modify $ \st -> st {stateFldCharState = FldCharContent info [] : ancestors}
return NullParPart
+ -- Some fields have no content, since Pandoc doesn't understand any of those fields, we can just close it.
+ FldCharFieldInfo _ : ancestors | fldCharType == "end" -> do
+ modify $ \st -> st {stateFldCharState = ancestors}
+ return NullParPart
[FldCharContent info children] | fldCharType == "end" -> do
modify $ \st -> st {stateFldCharState = []}
return $ Field info $ reverse children