diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 11:39:24 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-06-20 11:39:24 -0700 |
commit | 8f20ac3da3b0d1111f94161d5b3528dfa94d1069 (patch) | |
tree | ee4a47c59bf2969932022fd1ee55ec3c9ddd3297 | |
parent | d81b4358ea8d0da615c01a468196fd0592934af6 (diff) | |
download | pandoc-8f20ac3da3b0d1111f94161d5b3528dfa94d1069.tar.gz |
MediaWiki reader: Support --trace.
-rw-r--r-- | src/Text/Pandoc/Readers/MediaWiki.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index e4fabc898..eb9dd5b8a 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -55,6 +55,8 @@ import qualified Data.Foldable as F import qualified Data.Map as M import Data.Char (isDigit, isSpace) import Data.Maybe (fromMaybe) +import Text.Printf (printf) +import Debug.Trace (trace) -- | Read mediawiki from an input string and return a Pandoc document. readMediaWiki :: ReaderOptions -- ^ Reader options @@ -187,7 +189,10 @@ parseMediaWiki = do -- block :: MWParser Blocks -block = mempty <$ skipMany1 blankline +block = do + tr <- getOption readerTrace + pos <- getPosition + res <- mempty <$ skipMany1 blankline <|> table <|> header <|> hrule @@ -199,6 +204,10 @@ block = mempty <$ skipMany1 blankline <|> blockTag <|> (B.rawBlock "mediawiki" <$> template) <|> para + when tr $ + trace (printf "line %d: %s" (sourceLine pos) + (take 60 $ show $ B.toList res)) (return ()) + return res para :: MWParser Blocks para = do |