summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-06-20 10:39:24 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-06-20 10:39:24 -0700
commitcab4b829b3683cec1def11d7189b5a850f23b016 (patch)
treec59f5e49080c5b3054107ddcbd796dbea5c7fb4d /src/Text/Pandoc
parent12efffa85a257dbe81137f97334b2c6a7e072777 (diff)
Support --trace in HTML reader.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 204239923..7bbad4257 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -50,6 +50,8 @@ import Data.Char ( isDigit )
import Control.Monad ( liftM, guard, when, mzero )
import Control.Applicative ( (<$>), (<$), (<*) )
import Data.Monoid
+import Text.Printf (printf)
+import Debug.Trace (trace)
isSpace :: Char -> Bool
isSpace ' ' = True
@@ -92,7 +94,10 @@ pHead = pInTags "head" $ pTitle <|> pMetaTag <|> (mempty <$ pAnyTag)
return mempty
block :: TagParser Blocks
-block = choice
+block = do
+ tr <- getOption readerTrace
+ pos <- getPosition
+ res <- choice
[ pPara
, pHeader
, pBlockQuote
@@ -106,6 +111,10 @@ block = choice
, pDiv
, pRawHtmlBlock
]
+ when tr $ trace (printf "line %d: %s" (sourceLine pos)
+ (take 60 $ show $ B.toList res)) (return ())
+ return res
+
pList :: TagParser Blocks
pList = pBulletList <|> pOrderedList <|> pDefinitionList