diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-04 22:07:02 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-04 22:07:02 -0700 |
commit | 2de2842bddf06847560f975933837923cba83db1 (patch) | |
tree | 84204f6658e47a4b84b8d14b8ad0f3bb51cd5d8d /src/Text/Pandoc/Writers/LaTeX.hs | |
parent | 39b59b7603c1e183dd20bb062b6279c2acc4ebd5 (diff) | |
parent | 675b15458a03371ef4d72d52218319a4cf09216d (diff) |
Merge pull request #1486 from Aelve/minor
Very minor cleanup and readability changes
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index ea704c91d..d140932a7 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -1,4 +1,5 @@ -{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} +{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, + PatternGuards #-} {- Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu> @@ -37,7 +38,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 +762,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 |