Support --trace in HTML reader.
This commit is contained in:
parent
12efffa85a
commit
cab4b829b3
1 changed files with 10 additions and 1 deletions
|
@ -50,6 +50,8 @@ import Data.Char ( isDigit )
|
||||||
import Control.Monad ( liftM, guard, when, mzero )
|
import Control.Monad ( liftM, guard, when, mzero )
|
||||||
import Control.Applicative ( (<$>), (<$), (<*) )
|
import Control.Applicative ( (<$>), (<$), (<*) )
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
import Text.Printf (printf)
|
||||||
|
import Debug.Trace (trace)
|
||||||
|
|
||||||
isSpace :: Char -> Bool
|
isSpace :: Char -> Bool
|
||||||
isSpace ' ' = True
|
isSpace ' ' = True
|
||||||
|
@ -92,7 +94,10 @@ pHead = pInTags "head" $ pTitle <|> pMetaTag <|> (mempty <$ pAnyTag)
|
||||||
return mempty
|
return mempty
|
||||||
|
|
||||||
block :: TagParser Blocks
|
block :: TagParser Blocks
|
||||||
block = choice
|
block = do
|
||||||
|
tr <- getOption readerTrace
|
||||||
|
pos <- getPosition
|
||||||
|
res <- choice
|
||||||
[ pPara
|
[ pPara
|
||||||
, pHeader
|
, pHeader
|
||||||
, pBlockQuote
|
, pBlockQuote
|
||||||
|
@ -106,6 +111,10 @@ block = choice
|
||||||
, pDiv
|
, pDiv
|
||||||
, pRawHtmlBlock
|
, pRawHtmlBlock
|
||||||
]
|
]
|
||||||
|
when tr $ trace (printf "line %d: %s" (sourceLine pos)
|
||||||
|
(take 60 $ show $ B.toList res)) (return ())
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
pList :: TagParser Blocks
|
pList :: TagParser Blocks
|
||||||
pList = pBulletList <|> pOrderedList <|> pDefinitionList
|
pList = pBulletList <|> pOrderedList <|> pDefinitionList
|
||||||
|
|
Loading…
Add table
Reference in a new issue