diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-02 11:51:53 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-02 12:10:45 -0400 |
commit | 1138ae6656784c1ca82511b0f27675f8cbc19cf8 (patch) | |
tree | c46c4d02b1bb6f12d13165e537cbbbfa5686a179 /src/Text/Pandoc | |
parent | bdda4b185bdab5e4eb56a1ce422f4efebdb5ace9 (diff) | |
download | pandoc-1138ae6656784c1ca82511b0f27675f8cbc19cf8.tar.gz |
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')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Util.hs | 3 |
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 = |