git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Improve handling of accents.
d62c4a9John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+17−15
@@ -770,11 +770,13 @@ keyval = try $ do
770keyvals :: PandocMonad m => LP m [(String, String)]
770keyvals :: PandocMonad m => LP m [(String, String)]
771keyvals = try $ symbol '[' >> manyTill keyval (symbol ']')
771keyvals = try $ symbol '[' >> manyTill keyval (symbol ']')
772
772
773−accent :: (Char -> String) -> Inlines -> LP m Inlines
773+accent :: PandocMonad m => Char -> (Char -> String) -> LP m Inlines
774−accent f ils =
774+accent c f = try $ do
775+ ils <- tok
775 case toList ils of
776 case toList ils of
776 (Str (x:xs) : ys) -> return $ fromList (Str (f x ++ xs) : ys)
777 (Str (x:xs) : ys) -> return $ fromList (Str (f x ++ xs) : ys)
777− [] -> mzero
778+ [Space] -> return $ str [c]
779+ [] -> return $ str [c]
778 _ -> return ils
780 _ -> return ils
779
781
780grave :: Char -> String
782grave :: Char -> String
@@ -1279,18 +1281,18 @@ inlineCommands = M.fromList $
1279 , ("copyright", lit "©")
1281 , ("copyright", lit "©")
1280 , ("textasciicircum", lit "^")
1282 , ("textasciicircum", lit "^")
1281 , ("textasciitilde", lit "~")
1283 , ("textasciitilde", lit "~")
1282− , ("H", try $ tok >>= accent hungarumlaut)
1284+ , ("H", accent '\779' hungarumlaut)
1283− , ("`", option (str "`") $ try $ tok >>= accent grave)
1285+ , ("`", accent '`' grave)
1284− , ("'", option (str "'") $ try $ tok >>= accent acute)
1286+ , ("'", accent '\'' acute)
1285− , ("^", option (str "^") $ try $ tok >>= accent circ)
1287+ , ("^", accent '^' circ)
1286− , ("~", option (str "~") $ try $ tok >>= accent tilde)
1288+ , ("~", accent '~' tilde)
1287− , ("\"", option (str "\"") $ try $ tok >>= accent umlaut)
1289+ , ("\"", accent '\776' umlaut)
1288− , (".", option (str ".") $ try $ tok >>= accent dot)
1290+ , (".", accent '\775' dot)
1289− , ("=", option (str "=") $ try $ tok >>= accent macron)
1291+ , ("=", accent '\772' macron)
1290− , ("c", option (str "c") $ try $ tok >>= accent cedilla)
1292+ , ("c", accent '\807' cedilla)
1291− , ("v", option (str "v") $ try $ tok >>= accent hacek)
1293+ , ("v", accent 'ˇ' hacek)
1292− , ("u", option (str "u") $ try $ tok >>= accent breve)
1294+ , ("u", accent '\774' breve)
1293− , ("k", option (str "k") $ try $ tok >>= accent ogonek)
1295+ , ("k", accent '\808' ogonek)
1294 , ("i", lit "i")
1296 , ("i", lit "i")
1295 , ("\\", linebreak <$ (do inTableCell <- sInTableCell <$> getState
1297 , ("\\", linebreak <$ (do inTableCell <- sInTableCell <$> getState
1296 guard $ not inTableCell
1298 guard $ not inTableCell