diff options
author | Artyom Kazak <yom@artyom.me> | 2014-08-03 14:44:39 +0400 |
---|---|---|
committer | Artyom Kazak <yom@artyom.me> | 2014-08-04 19:57:42 +0400 |
commit | 82118b332899a90a60a0e95e8ae416d7f5398071 (patch) | |
tree | eeca7f8f3317ca6f95517c44eb3621921fd1816d /src/Text/Pandoc/Writers/LaTeX.hs | |
parent | feebab97408d7322272e4453a60d0605c8d36772 (diff) | |
download | pandoc-82118b332899a90a60a0e95e8ae416d7f5398071.tar.gz |
Use `stripPrefix` where appropriate.
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index ea704c91d..3ea070ee7 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -37,7 +37,7 @@ import Text.Pandoc.Options import Text.Pandoc.Templates import Text.Printf ( printf ) import Network.URI ( isURI, unEscapeString ) -import Data.List ( (\\), isSuffixOf, isInfixOf, +import Data.List ( (\\), isSuffixOf, isInfixOf, stripPrefix, isPrefixOf, intercalate, intersperse ) import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord ) import Data.Maybe ( fromMaybe ) @@ -761,8 +761,8 @@ inlineToLaTeX (Link txt (src, _)) = do modify $ \s -> s{ stUrl = True } src' <- stringToLaTeX URLString src return $ text $ "\\url{" ++ src' ++ "}" - [Str x] | "mailto:" `isPrefixOf` src && - escapeURI x == drop 7 src -> -- email autolink + [Str x] | Just rest <- stripPrefix "mailto:" src, + escapeURI x == rest -> -- email autolink do modify $ \s -> s{ stUrl = True } src' <- stringToLaTeX URLString src contents <- inlineListToLaTeX txt |