aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-05-06 22:28:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-05-06 22:28:11 -0700
commitd6a9ba1cdc4cb10d34c61593d04868da3abb5e40 (patch)
tree3133afdf8131f6a205d37f8d9812be2a5e5d3d2f /src
parent10644607e35369ec3b19b5d02fbe9b936d0ecb85 (diff)
downloadpandoc-d6a9ba1cdc4cb10d34c61593d04868da3abb5e40.tar.gz
Make `--trace` work with textile reader.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 3c07a4d85..b67e8fbc8 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -61,9 +61,11 @@ import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
import Text.HTML.TagSoup.Match
import Data.List ( intercalate )
import Data.Char ( digitToInt, isUpper)
-import Control.Monad ( guard, liftM )
+import Control.Monad ( guard, liftM, when )
+import Text.Printf
import Control.Applicative ((<$>), (*>), (<*), (<$))
import Data.Monoid
+import Debug.Trace (trace)
-- | Parse a Textile text and return a Pandoc document.
readTextile :: ReaderOptions -- ^ Reader options
@@ -135,9 +137,17 @@ blockParsers = [ codeBlock
endBlock :: Parser [Char] ParserState Blocks
endBlock = string "\n\n" >> return mempty
+
-- | Any block in the order of definition of blockParsers
block :: Parser [Char] ParserState Blocks
-block = choice blockParsers <?> "block"
+block = do
+ res <- choice blockParsers <?> "block"
+ pos <- getPosition
+ tr <- getOption readerTrace
+ when tr $
+ trace (printf "line %d: %s" (sourceLine pos)
+ (take 60 $ show $ B.toList res)) (return ())
+ return res
commentBlock :: Parser [Char] ParserState Blocks
commentBlock = try $ do