git.iko.soy/typeable/pandoc
on master help sign in
Removed 'gsub' entirely and replaced its uses with 'substitute'.
1121e87fiddlosopher
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -291,7 +291,7 @@ authors = try (do
291 authors <- manyTill anyChar (char '}')
291 authors <- manyTill anyChar (char '}')
292 spaces
292 spaces
293 let authors' = map removeLeadingTrailingSpace $ lines $
293 let authors' = map removeLeadingTrailingSpace $ lines $
294− gsub "\\\\\\\\" "\n" authors
294+ substitute "\\\\" "\n" authors
295 updateState (\state -> state { stateAuthors = authors' })
295 updateState (\state -> state { stateAuthors = authors' })
296 return Null)
296 return Null)
297
297
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -887,7 +887,7 @@ titleWith startChar endChar = try (do
887 char endChar
887 char endChar
888 skipSpaces
888 skipSpaces
889 notFollowedBy (noneOf ")\n")))
889 notFollowedBy (noneOf ")\n")))
890− let tit' = gsub "\"" "&quot;" tit
890+ let tit' = substitute "\"" "&quot;" tit
891 return tit')
891 return tit')
892
892
893title = choice [ titleWith '(' ')',
893title = choice [ titleWith '(' ')',
src/Text/Pandoc/Shared.hs−8
@@ -33,7 +33,6 @@ module Text.Pandoc.Shared (
33 splitByIndices,
33 splitByIndices,
34 substitute,
34 substitute,
35 -- * Text processing
35 -- * Text processing
36− gsub,
37 joinWithSep,
36 joinWithSep,
38 tabsToSpaces,
37 tabsToSpaces,
39 backslashEscape,
38 backslashEscape,
@@ -220,13 +219,6 @@ tabsInLine num tabstop (c:cs) =
220 else nextnumraw in
219 else nextnumraw in
221 replacement ++ (tabsInLine nextnum tabstop cs)
220 replacement ++ (tabsInLine nextnum tabstop cs)
222
221
223−-- | Substitute string for every occurrence of regular expression.
224−gsub :: String -- ^ Regular expression (as string) to substitute for
225− -> String -- ^ String to substitute for the regex
226− -> String -- ^ String to be substituted in
227− -> String
228−gsub regex replacement str = subRegex (mkRegex regex) str replacement
229−
230-- | Escape designated characters with backslash.
222-- | Escape designated characters with backslash.
231backslashEscape :: [Char] -- ^ list of special characters to escape
223backslashEscape :: [Char] -- ^ list of special characters to escape
232 -> String -- ^ string input
224 -> String -- ^ string input
src/Text/Pandoc/Writers/HTML.hs+1−1
@@ -87,7 +87,7 @@ obfuscateLink opts txt src =
87 src' = map toLower src in
87 src' = map toLower src in
88 case (matchRegex emailRegex src') of
88 case (matchRegex emailRegex src') of
89 (Just [name, domain]) ->
89 (Just [name, domain]) ->
90− let domain' = gsub "\\." " dot " domain
90+ let domain' = substitute "." " dot " domain
91 at' = obfuscateChar '@' in
91 at' = obfuscateChar '@' in
92 let linkText = if src' == ("mailto:" ++ text')
92 let linkText = if src' == ("mailto:" ++ text')
93 then "e"
93 then "e"
src/Text/Pandoc/Writers/Markdown.hs+1−1
@@ -55,7 +55,7 @@ escapeString = backslashEscape "`<\\*_^"
55
55
56-- | Escape embedded \" in link title.
56-- | Escape embedded \" in link title.
57escapeLinkTitle :: String -> String
57escapeLinkTitle :: String -> String
58−escapeLinkTitle = gsub "\"" "\\\\\""
58+escapeLinkTitle = substitute "\"" "\\\""
59
59
60-- | Take list of inline elements and return wrapped doc.
60-- | Take list of inline elements and return wrapped doc.
61wrappedMarkdown :: [Inline] -> Doc
61wrappedMarkdown :: [Inline] -> Doc
src/Text/Pandoc/Writers/RTF.hs+1−1
@@ -59,7 +59,7 @@ handleUnicode (c:cs) = if (ord c) > 127
59 else c:(handleUnicode cs)
59 else c:(handleUnicode cs)
60
60
61escapeSpecial = backslashEscape "{\\}"
61escapeSpecial = backslashEscape "{\\}"
62−escapeTab = gsub "\\\\t" "\\\\tab "
62+escapeTab = substitute "\\t" "\\tab "
63
63
64-- | Escape strings as needed for rich text format.
64-- | Escape strings as needed for rich text format.
65stringToRTF :: String -> String
65stringToRTF :: String -> String