git.iko.soy/typeable/pandoc
on master help sign in
Support --trace in HTML reader.
commitcab4b829b3683cec1def11d7189b5a850f23b016 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 20 Jun 2014, 10:39 (12 years ago) parent12efffa
1 file changed+10−1
src/Text/Pandoc/Readers/HTML.hs+10−1
src/Text/Pandoc/Readers/HTML.hs+10−1
@@ -50,6 +50,8 @@ import Data.Char ( isDigit )
5050import Control.Monad ( liftM, guard, when, mzero )
5151import Control.Applicative ( (<$>), (<$), (<*) )
5252import Data.Monoid
53+import Text.Printf (printf)
54+import Debug.Trace (trace)
5355
5456isSpace :: Char -> Bool
5557isSpace ' ' = True
@@ -92,7 +94,10 @@ pHead = pInTags "head" $ pTitle <|> pMetaTag <|> (mempty <$ pAnyTag)
9294 return mempty
9395
9496block :: TagParser Blocks
95−block = choice
97+block = do
98+ tr <- getOption readerTrace
99+ pos <- getPosition
100+ res <- choice
96101 [ pPara
97102 , pHeader
98103 , pBlockQuote
@@ -106,6 +111,10 @@ block = choice
106111 , pDiv
107112 , pRawHtmlBlock
108113 ]
114+ when tr $ trace (printf "line %d: %s" (sourceLine pos)
115+ (take 60 $ show $ B.toList res)) (return ())
116+ return res
117+
109118
110119pList :: TagParser Blocks
111120pList = pBulletList <|> pOrderedList <|> pDefinitionList