aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2014-08-09 22:06:07 +0100
committerJesse Rosenthal <jrosenthal@jhu.edu>2014-08-09 22:37:12 -0400
commit3bb19307f60c6cfda4bfdb5a3d53508f4abd786e (patch)
treee722e0fc872e6b92de681504a46582519de11273
parent5bedaba08075f1837779f11a7aec4435e495b216 (diff)
downloadpandoc-3bb19307f60c6cfda4bfdb5a3d53508f4abd786e.tar.gz
Docx Parse: Recognises code points in sym elements which are in the private range
-rw-r--r--src/Text/Pandoc/Readers/Docx/Parse.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs
index 5beb61f9c..b12062407 100644
--- a/src/Text/Pandoc/Readers/Docx/Parse.hs
+++ b/src/Text/Pandoc/Readers/Docx/Parse.hs
@@ -59,6 +59,7 @@ import Data.Bits ((.|.))
import qualified Data.ByteString.Lazy as B
import qualified Text.Pandoc.UTF8 as UTF8
import Control.Monad.Reader
+import Control.Applicative ((<$>))
import qualified Data.Map as M
import Text.Pandoc.Compat.Except
import Text.Pandoc.Readers.Docx.OMath (readOMML)
@@ -681,13 +682,15 @@ elemToRunElem ns element
-- The char attribute is a hex string
getSymChar :: NameSpaces -> Element -> RunElem
getSymChar ns element
- | Just s <- getCodepoint
+ | Just s <- lowerFromPrivate <$> getCodepoint
, Just font <- getFont =
let [(char, _)] = readLitChar ("\\x" ++ s) in
TextRun . maybe "" (:[]) $ getUnicode font char
where
getCodepoint = findAttr (elemName ns "w" "char") element
getFont = stringToFont =<< findAttr (elemName ns "w" "font") element
+ lowerFromPrivate ('F':xs) = '0':xs
+ lowerFromPrivate xs = xs
getSymChar _ _ = TextRun ""
stringToFont :: String -> Maybe Font