diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-22 22:52:39 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-22 22:52:39 +0000 |
commit | 1121e8738b3d2a60c5762be03a2f6b33adae77ab (patch) | |
tree | eeb7fd188c585f099a65a5d55f675cae5cbb3b89 /src/Text/Pandoc | |
parent | 8f0750574ac1702d27bf9a98ccce3962ad0b587c (diff) | |
download | pandoc-1121e8738b3d2a60c5762be03a2f6b33adae77ab.tar.gz |
Removed 'gsub' entirely and replaced its uses with 'substitute'.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@501 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 8 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/RTF.hs | 2 |
6 files changed, 5 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 9e966cc04..38777b003 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -291,7 +291,7 @@ authors = try (do authors <- manyTill anyChar (char '}') spaces let authors' = map removeLeadingTrailingSpace $ lines $ - gsub "\\\\\\\\" "\n" authors + substitute "\\\\" "\n" authors updateState (\state -> state { stateAuthors = authors' }) return Null) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index aae635663..f32a29274 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -887,7 +887,7 @@ titleWith startChar endChar = try (do char endChar skipSpaces notFollowedBy (noneOf ")\n"))) - let tit' = gsub "\"" """ tit + let tit' = substitute "\"" """ tit return tit') title = choice [ titleWith '(' ')', diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index adaffb9da..1df2b4d38 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -33,7 +33,6 @@ module Text.Pandoc.Shared ( splitByIndices, substitute, -- * Text processing - gsub, joinWithSep, tabsToSpaces, backslashEscape, @@ -220,13 +219,6 @@ tabsInLine num tabstop (c:cs) = else nextnumraw in replacement ++ (tabsInLine nextnum tabstop cs) --- | Substitute string for every occurrence of regular expression. -gsub :: String -- ^ Regular expression (as string) to substitute for - -> String -- ^ String to substitute for the regex - -> String -- ^ String to be substituted in - -> String -gsub regex replacement str = subRegex (mkRegex regex) str replacement - -- | Escape designated characters with backslash. backslashEscape :: [Char] -- ^ list of special characters to escape -> String -- ^ string input diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index d38a57556..5465e125d 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -87,7 +87,7 @@ obfuscateLink opts txt src = src' = map toLower src in case (matchRegex emailRegex src') of (Just [name, domain]) -> - let domain' = gsub "\\." " dot " domain + let domain' = substitute "." " dot " domain at' = obfuscateChar '@' in let linkText = if src' == ("mailto:" ++ text') then "e" diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 0e7704510..297f2dc36 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -55,7 +55,7 @@ escapeString = backslashEscape "`<\\*_^" -- | Escape embedded \" in link title. escapeLinkTitle :: String -> String -escapeLinkTitle = gsub "\"" "\\\\\"" +escapeLinkTitle = substitute "\"" "\\\"" -- | Take list of inline elements and return wrapped doc. wrappedMarkdown :: [Inline] -> Doc diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs index b53e39cb2..86991368b 100644 --- a/src/Text/Pandoc/Writers/RTF.hs +++ b/src/Text/Pandoc/Writers/RTF.hs @@ -59,7 +59,7 @@ handleUnicode (c:cs) = if (ord c) > 127 else c:(handleUnicode cs) escapeSpecial = backslashEscape "{\\}" -escapeTab = gsub "\\\\t" "\\\\tab " +escapeTab = substitute "\\t" "\\tab " -- | Escape strings as needed for rich text format. stringToRTF :: String -> String |