diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-01-21 20:54:12 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-01-21 20:54:12 -0800 |
commit | f86ac89383110f2755a53d49dc508da873bcaf0a (patch) | |
tree | 8fb106f831f244f62303518f95ce3f74ce0ee32c /src/Text/Pandoc/Readers | |
parent | 847ff4f83dac7eb3859fdbc1390ee69f12398557 (diff) | |
download | pandoc-f86ac89383110f2755a53d49dc508da873bcaf0a.tar.gz |
HTML and markdown: treat textarea as a verbatim environment.
We don't want to parse its contents as Markdown or HTML.
Closes #5241.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 8d3c1abb4..cf326b072 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -412,7 +412,9 @@ pDiv = try $ do pRawHtmlBlock :: PandocMonad m => TagParser m Blocks pRawHtmlBlock = do - raw <- T.unpack <$> (pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag) + raw <- T.unpack <$> + (pHtmlBlock "script" <|> pHtmlBlock "style" <|> pHtmlBlock "textarea" + <|> pRawTag) exts <- getOption readerExtensions if extensionEnabled Ext_raw_html exts && not (null raw) then return $ B.rawBlock "html" raw diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index b463898a0..8d28abb2f 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1106,9 +1106,8 @@ htmlBlock :: PandocMonad m => MarkdownParser m (F Blocks) htmlBlock = do guardEnabled Ext_raw_html try (do - (TagOpen t attrs) <- lookAhead $ fst <$> htmlTag isBlockTag - (guard (t `elem` ["pre","style","script"]) >> - (return . B.rawBlock "html") <$> rawVerbatimBlock) + (TagOpen _ attrs) <- lookAhead $ fst <$> htmlTag isBlockTag + (return . B.rawBlock "html") <$> rawVerbatimBlock <|> (do guardEnabled Ext_markdown_attribute oldMarkdownAttribute <- stateMarkdownAttribute <$> getState markdownAttribute <- @@ -1141,10 +1140,11 @@ strictHtmlBlock = htmlInBalanced (not . isInlineTag) rawVerbatimBlock :: PandocMonad m => MarkdownParser m String rawVerbatimBlock = htmlInBalanced isVerbTag - where isVerbTag (TagOpen "pre" _) = True - isVerbTag (TagOpen "style" _) = True - isVerbTag (TagOpen "script" _) = True - isVerbTag _ = False + where isVerbTag (TagOpen "pre" _) = True + isVerbTag (TagOpen "style" _) = True + isVerbTag (TagOpen "script" _) = True + isVerbTag (TagOpen "textarea" _) = True + isVerbTag _ = False rawTeXBlock :: PandocMonad m => MarkdownParser m (F Blocks) rawTeXBlock = do |