diff options
Diffstat (limited to 'src/Text/Pandoc/Readers/LaTeX')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/Lang.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/Parsing.hs | 14 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/SIunitx.hs | 6 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Lang.hs b/src/Text/Pandoc/Readers/LaTeX/Lang.hs index 55965c995..814b2fe79 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Lang.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Lang.hs @@ -152,4 +152,4 @@ babelLangToBCP47 s = "newzealand" -> Just $ Lang "en" "" "NZ" [] "american" -> Just $ Lang "en" "" "US" [] "classiclatin" -> Just $ Lang "la" "" "" ["x-classic"] - _ -> fmap ($ "") $ M.lookup s polyglossiaLangToBCP47 + _ -> ($ "") <$> M.lookup s polyglossiaLangToBCP47 diff --git a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs index 10e48b45f..c349fe3b1 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Parsing.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Parsing.hs @@ -1,8 +1,8 @@ {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE ViewPatterns #-} {- | Module : Text.Pandoc.Readers.LaTeX.Parsing Copyright : Copyright (C) 2006-2020 John MacFarlane @@ -736,14 +736,14 @@ keyval = try $ do (mconcat <$> many1 ( (untokenize . snd <$> withRaw braced) <|> - (untokenize <$> (many1 + (untokenize <$> many1 (satisfyTok - (\t -> case t of + (\case Tok _ Symbol "]" -> False Tok _ Symbol "," -> False Tok _ Symbol "{" -> False Tok _ Symbol "}" -> False - _ -> True)))))) + _ -> True))))) optional (symbol ',') sp return (key, T.strip val) @@ -756,8 +756,7 @@ verbEnv name = withVerbatimMode $ do optional blankline res <- manyTill anyTok (end_ name) return $ stripTrailingNewline - $ untokenize - $ res + $ untokenize res -- Strip single final newline and any spaces following it. -- Input is unchanged if it doesn't end with newline + @@ -819,8 +818,7 @@ overlaySpecification = try $ do overlayTok :: PandocMonad m => LP m Tok overlayTok = - satisfyTok (\t -> - case t of + satisfyTok (\case Tok _ Word _ -> True Tok _ Spaces _ -> True Tok _ Symbol c -> c `elem` ["-","+","@","|",":",","] diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs index 49a6d7301..436330d85 100644 --- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs +++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs @@ -103,9 +103,9 @@ doSIang = do ps <- T.splitOn ";" . untokenize <$> braced case ps ++ repeat "" of (d:m:s:_) -> return $ - (if T.null d then mempty else (str d <> str "\xb0")) <> - (if T.null m then mempty else (str m <> str "\x2032")) <> - (if T.null s then mempty else (str s <> str "\x2033")) + (if T.null d then mempty else str d <> str "\xb0") <> + (if T.null m then mempty else str m <> str "\x2032") <> + (if T.null s then mempty else str s <> str "\x2033") _ -> return mempty -- converts e.g. \SIrange{100}{200}{\ms} to "100 ms--200 ms" |