git.iko.soy/typeable/pandoc
on master help sign in
Docx Parse: Recognises code points in sym elements which are in the private range
commit3bb19307f60c6cfda4bfdb5a3d53508f4abd786e authorMatthew Pickering <matthewtpickering@gmail.com> dateSat 9 Aug 2014, 22:06 (12 years ago) parent5bedaba
1 file changed+4−1
src/Text/Pandoc/Readers/Docx/Parse.hs+4−1
src/Text/Pandoc/Readers/Docx/Parse.hs+4−1
@@ -59,6 +59,7 @@ import Data.Bits ((.|.))
5959import qualified Data.ByteString.Lazy as B
6060import qualified Text.Pandoc.UTF8 as UTF8
6161import Control.Monad.Reader
62+import Control.Applicative ((<$>))
6263import qualified Data.Map as M
6364import Text.Pandoc.Compat.Except
6465import Text.Pandoc.Readers.Docx.OMath (readOMML)
@@ -681,13 +682,15 @@ elemToRunElem ns element
681682-- The char attribute is a hex string
682683getSymChar :: NameSpaces -> Element -> RunElem
683684getSymChar ns element
684− | Just s <- getCodepoint
685+ | Just s <- lowerFromPrivate <$> getCodepoint
685686 , Just font <- getFont =
686687 let [(char, _)] = readLitChar ("\\x" ++ s) in
687688 TextRun . maybe "" (:[]) $ getUnicode font char
688689 where
689690 getCodepoint = findAttr (elemName ns "w" "char") element
690691 getFont = stringToFont =<< findAttr (elemName ns "w" "font") element
692+ lowerFromPrivate ('F':xs) = '0':xs
693+ lowerFromPrivate xs = xs
691694getSymChar _ _ = TextRun ""
692695
693696stringToFont :: String -> Maybe Font