diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 19:33:47 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 19:33:47 +0000 |
commit | 8fdf8c1d4cf33972a5fef7bf8dcf75478733da8c (patch) | |
tree | f2510a4e64846652d8eeb5fbda8f9eba313baf89 /src/Text/Pandoc | |
parent | cda7e7ac2143ca21bb3968c00fc9525d5f730339 (diff) | |
download | pandoc-8fdf8c1d4cf33972a5fef7bf8dcf75478733da8c.tar.gz |
+ Removed tabsToSpaces and tabsInLine from Text.Pandoc.Shared.
(They were used only in Main.)
+ Wrote new tabsToSpacesInLine function in Main that changes tabs
to spaces and removes DOS line-endings in one pass, for a slight
speed improvement.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@942 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 2958b4388..ddc325374 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -34,7 +34,6 @@ module Text.Pandoc.Shared ( substitute, joinWithSep, -- * Text processing - tabsToSpaces, backslashEscapes, escapeStringUsing, stripTrailingNewlines, @@ -143,27 +142,6 @@ joinWithSep sep lst = foldr1 (\a b -> a ++ sep ++ b) lst -- Text processing -- --- | Convert tabs to spaces (with adjustable tab stop). -tabsToSpaces :: Int -- ^ Tabstop - -> String -- ^ String to convert - -> String -tabsToSpaces tabstop str = - unlines $ map (tabsInLine tabstop tabstop) (lines str) - --- | Convert tabs to spaces in one line. -tabsInLine :: Int -- ^ Number of spaces to next tab stop - -> Int -- ^ Tabstop - -> String -- ^ Line to convert - -> String -tabsInLine num tabstop [] = "" -tabsInLine num tabstop (c:cs) = - let (replacement, nextnum) = if c == '\t' - then (replicate num ' ', tabstop) - else if num > 1 - then ([c], num - 1) - else ([c], tabstop) - in replacement ++ tabsInLine nextnum tabstop cs - -- | Returns an association list of backslash escapes for the -- designated characters. backslashEscapes :: [Char] -- ^ list of special characters to escape |