summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Docx/Util.hs
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-11-02 11:51:53 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2016-11-02 12:10:45 -0400
commit1138ae6656784c1ca82511b0f27675f8cbc19cf8 (patch)
treec46c4d02b1bb6f12d13165e537cbbbfa5686a179 /src/Text/Pandoc/Readers/Docx/Util.hs
parentbdda4b185bdab5e4eb56a1ce422f4efebdb5ace9 (diff)
Docx reader utils: handle empty namespace in elemName
Previously, if given an empty namespace: (elemName ns "" "foo") `elemName` would output a QName with a `Just ""` namespace. This is never what we want. Now we output a `Nothing`. If someone *does* want a `Just ""` in the namespace, they can enter the QName value explicitly.
Diffstat (limited to 'src/Text/Pandoc/Readers/Docx/Util.hs')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Util.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Util.hs b/src/Text/Pandoc/Readers/Docx/Util.hs
index 891f107b0..33d69ccf3 100644
--- a/src/Text/Pandoc/Readers/Docx/Util.hs
+++ b/src/Text/Pandoc/Readers/Docx/Util.hs
@@ -18,7 +18,8 @@ attrToNSPair (Attr (QName s _ (Just "xmlns")) val) = Just (s, val)
attrToNSPair _ = Nothing
elemName :: NameSpaces -> String -> String -> QName
-elemName ns prefix name = QName name (lookup prefix ns) (Just prefix)
+elemName ns prefix name =
+ QName name (lookup prefix ns) (if null prefix then Nothing else Just prefix)
isElem :: NameSpaces -> String -> String -> Element -> Bool
isElem ns prefix name element =