diff options
| -rw-r--r-- | src/Text/Pandoc/Parsing.hs | 12 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/Org/Blocks.hs | 9 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/Org/Parsing.hs | 1 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 9 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/Txt2Tags.hs | 3 | 
5 files changed, 13 insertions, 21 deletions
| diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index ce2523d12..e430c7cb5 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -37,6 +37,7 @@ A utility library with parsers used in pandoc readers.  -}  module Text.Pandoc.Parsing ( anyLine,                               anyLineNewline, +                             indentWith,                               many1Till,                               notFollowedBy',                               oneOfStrings, @@ -260,6 +261,17 @@ anyLine = do  anyLineNewline :: Stream [Char] m Char => ParserT [Char] st m [Char]  anyLineNewline = (++ "\n") <$> anyLine +-- | Parse indent by specified number of spaces (or equiv. tabs) +indentWith :: Stream [Char] m Char +           => HasReaderOptions st +           => Int -> ParserT [Char] st m [Char] +indentWith num = do +  tabStop <- getOption readerTabStop +  if (num < tabStop) +     then count num (char ' ') +     else choice [ try (count num (char ' ')) +                 , try (char '\t' >> indentWith (num - tabStop)) ] +  -- | Like @manyTill@, but reads at least one item.  many1Till :: Stream s m t            => ParserT s st m a diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs index f5823c7aa..fa2f7fac5 100644 --- a/src/Text/Pandoc/Readers/Org/Blocks.hs +++ b/src/Text/Pandoc/Readers/Org/Blocks.hs @@ -828,12 +828,3 @@ listContinuation markerLength = try $                <*> many blankline)   where     listLine = try $ indentWith markerLength *> anyLineNewline - -   -- indent by specified number of spaces (or equiv. tabs) -   indentWith :: Monad m => Int -> OrgParser m String -   indentWith num = do -     tabStop <- getOption readerTabStop -     if num < tabStop -       then count num (char ' ') -       else choice [ try (count num (char ' ')) -                   , try (char '\t' >> count (num - tabStop) (char ' ')) ] diff --git a/src/Text/Pandoc/Readers/Org/Parsing.hs b/src/Text/Pandoc/Readers/Org/Parsing.hs index 5c93a7eca..1d3e8c257 100644 --- a/src/Text/Pandoc/Readers/Org/Parsing.hs +++ b/src/Text/Pandoc/Readers/Org/Parsing.hs @@ -32,6 +32,7 @@ module Text.Pandoc.Readers.Org.Parsing    ( OrgParser    , anyLine    , anyLineNewline +  , indentWith    , blanklines    , newline    , parseFromString diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index e85ebade1..ac1f4f834 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -561,15 +561,6 @@ listLine markerLength = try $ do    indentWith markerLength    anyLineNewline --- indent by specified number of spaces (or equiv. tabs) -indentWith :: Monad m => Int -> RSTParser m [Char] -indentWith num = do -  tabStop <- getOption readerTabStop -  if (num < tabStop) -     then count num  (char ' ') -     else choice [ try (count num (char ' ')), -                   (try (char '\t' >> count (num - tabStop) (char ' '))) ] -  -- parse raw text for one list item, excluding start marker and continuations  rawListItem :: Monad m => RSTParser m Int              -> RSTParser m (Int, [Char]) diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs index aa7774b4c..ba2b20083 100644 --- a/src/Text/Pandoc/Readers/Txt2Tags.hs +++ b/src/Text/Pandoc/Readers/Txt2Tags.hs @@ -277,9 +277,6 @@ listContinuation markerLength = try $                <*> many blankline)   where listLine = try $ indentWith markerLength *> anyLineNewline -indentWith :: Int -> T2T String -indentWith n = count n spaceChar -  -- Table  table :: T2T Blocks | 
