git.iko.soy/typeable/pandoc
on master help sign in
Make `--trace` work with textile reader.
commitd6a9ba1cdc4cb10d34c61593d04868da3abb5e40 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 6 May 2014, 22:28 (12 years ago) parent1064460
1 file changed+12−2
src/Text/Pandoc/Readers/Textile.hs+12−2
src/Text/Pandoc/Readers/Textile.hs+12−2
@@ -61,9 +61,11 @@ import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
6161import Text.HTML.TagSoup.Match
6262import Data.List ( intercalate )
6363import Data.Char ( digitToInt, isUpper)
64−import Control.Monad ( guard, liftM )
64+import Control.Monad ( guard, liftM, when )
65+import Text.Printf
6566import Control.Applicative ((<$>), (*>), (<*), (<$))
6667import Data.Monoid
68+import Debug.Trace (trace)
6769
6870-- | Parse a Textile text and return a Pandoc document.
6971readTextile :: ReaderOptions -- ^ Reader options
@@ -135,9 +137,17 @@ blockParsers = [ codeBlock
135137
136138endBlock :: Parser [Char] ParserState Blocks
137139endBlock = string "\n\n" >> return mempty
140+
138141-- | Any block in the order of definition of blockParsers
139142block :: Parser [Char] ParserState Blocks
140−block = choice blockParsers <?> "block"
143+block = do
144+ res <- choice blockParsers <?> "block"
145+ pos <- getPosition
146+ tr <- getOption readerTrace
147+ when tr $
148+ trace (printf "line %d: %s" (sourceLine pos)
149+ (take 60 $ show $ B.toList res)) (return ())
150+ return res
141151
142152commentBlock :: Parser [Char] ParserState Blocks
143153commentBlock = try $ do