mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-27 10:46:33 +00:00
MediaWiki reader: properly interpret XML tags in pre environments.
They are meant to be interpreted as literal text in textile. Closes #3042.
This commit is contained in:
@@ -60,7 +60,7 @@ import Text.Pandoc.Parsing
|
||||
import Text.Pandoc.Readers.HTML ( htmlTag, isBlockTag, isInlineTag )
|
||||
import Text.Pandoc.Shared (trim)
|
||||
import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
|
||||
import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
|
||||
import Text.HTML.TagSoup (fromAttrib, Tag(..))
|
||||
import Text.HTML.TagSoup.Match
|
||||
import Data.List ( intercalate, transpose, intersperse )
|
||||
import Data.Char ( digitToInt, isUpper )
|
||||
@@ -182,8 +182,7 @@ trimTrailingNewlines = reverse . dropWhile (=='\n') . reverse
|
||||
codeBlockPre :: Parser [Char] ParserState Blocks
|
||||
codeBlockPre = try $ do
|
||||
(t@(TagOpen _ attrs),_) <- htmlTag (tagOpen (=="pre") (const True))
|
||||
result' <- (innerText . parseTags) `fmap` -- remove internal tags
|
||||
manyTill anyChar (htmlTag (tagClose (=="pre")))
|
||||
result' <- manyTill anyChar (htmlTag (tagClose (=="pre")))
|
||||
optional blanklines
|
||||
-- drop leading newline if any
|
||||
let result'' = case result' of
|
||||
|
||||
Reference in New Issue
Block a user