git.iko.soy/typeable/pandoc
on master help sign in
Removed 'gsub' entirely and replaced its uses with 'substitute'.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@501 788f1e2b-df1e-0410-8736-df70ead52e1b

commit1121e8738b3d2a60c5762be03a2f6b33adae77ab authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateMon 22 Jan 2007, 22:52 (20 years ago) parent8f07505
6 files changed+5−13
src/Text/Pandoc/Readers/LaTeX.hs+1−1 src/Text/Pandoc/Readers/Markdown.hs+1−1 src/Text/Pandoc/Shared.hs−8 src/Text/Pandoc/Writers/HTML.hs+1−1 src/Text/Pandoc/Writers/Markdown.hs+1−1 src/Text/Pandoc/Writers/RTF.hs+1−1
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -291,7 +291,7 @@ authors = try (do
291291 authors <- manyTill anyChar (char '}')
292292 spaces
293293 let authors' = map removeLeadingTrailingSpace $ lines $
294− gsub "\\\\\\\\" "\n" authors
294+ substitute "\\\\" "\n" authors
295295 updateState (\state -> state { stateAuthors = authors' })
296296 return Null)
297297
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -887,7 +887,7 @@ titleWith startChar endChar = try (do
887887 char endChar
888888 skipSpaces
889889 notFollowedBy (noneOf ")\n")))
890− let tit' = gsub "\"" "&quot;" tit
890+ let tit' = substitute "\"" "&quot;" tit
891891 return tit')
892892
893893title = choice [ titleWith '(' ')',
src/Text/Pandoc/Shared.hs−8
@@ -33,7 +33,6 @@ module Text.Pandoc.Shared (
3333 splitByIndices,
3434 substitute,
3535 -- * Text processing
36− gsub,
3736 joinWithSep,
3837 tabsToSpaces,
3938 backslashEscape,
@@ -220,13 +219,6 @@ tabsInLine num tabstop (c:cs) =
220219 else nextnumraw in
221220 replacement ++ (tabsInLine nextnum tabstop cs)
222221
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−
230222-- | Escape designated characters with backslash.
231223backslashEscape :: [Char] -- ^ list of special characters to escape
232224 -> String -- ^ string input
src/Text/Pandoc/Writers/HTML.hs+1−1
@@ -87,7 +87,7 @@ obfuscateLink opts txt src =
8787 src' = map toLower src in
8888 case (matchRegex emailRegex src') of
8989 (Just [name, domain]) ->
90− let domain' = gsub "\\." " dot " domain
90+ let domain' = substitute "." " dot " domain
9191 at' = obfuscateChar '@' in
9292 let linkText = if src' == ("mailto:" ++ text')
9393 then "e"
src/Text/Pandoc/Writers/Markdown.hs+1−1
@@ -55,7 +55,7 @@ escapeString = backslashEscape "`<\\*_^"
5555
5656-- | Escape embedded \" in link title.
5757escapeLinkTitle :: String -> String
58−escapeLinkTitle = gsub "\"" "\\\\\""
58+escapeLinkTitle = substitute "\"" "\\\""
5959
6060-- | Take list of inline elements and return wrapped doc.
6161wrappedMarkdown :: [Inline] -> Doc
src/Text/Pandoc/Writers/RTF.hs+1−1
@@ -59,7 +59,7 @@ handleUnicode (c:cs) = if (ord c) > 127
5959 else c:(handleUnicode cs)
6060
6161escapeSpecial = backslashEscape "{\\}"
62−escapeTab = gsub "\\\\t" "\\\\tab "
62+escapeTab = substitute "\\t" "\\tab "
6363
6464-- | Escape strings as needed for rich text format.
6565stringToRTF :: String -> String