mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-24 15:44:59 +08:00
HTML reader: don't parse raw HTML inside <code> tag.
Previously '<code><a>x</a></code>' would be parsed as Code "<a>x</a>", which is not what you want.
This commit is contained in:
@@ -686,8 +686,8 @@ inline = choice [ charRef
|
||||
|
||||
code :: GenParser Char ParserState Inline
|
||||
code = try $ do
|
||||
result <- (htmlOpenTag "code" >> manyTill anyChar (htmlEndTag "code"))
|
||||
<|> (htmlOpenTag "tt" >> manyTill anyChar (htmlEndTag "tt"))
|
||||
result <- (htmlOpenTag "code" >> manyTill (noneOf "<>") (htmlEndTag "code"))
|
||||
<|> (htmlOpenTag "tt" >> manyTill (noneOf "<>") (htmlEndTag "tt"))
|
||||
-- remove internal line breaks, leading and trailing space,
|
||||
-- and decode character references
|
||||
return $ Code $ decodeCharacterReferences $ removeLeadingTrailingSpace $
|
||||
|
||||
@@ -340,7 +340,7 @@ foo<p>This should just be an HTML comment:</p>
|
||||
<p>So is <strong><em>this</em></strong> word.</p>
|
||||
<p><strong><em>This is strong and em.</em></strong></p>
|
||||
<p>So is <strong><em>this</em></strong> word.</p>
|
||||
<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code><html></code>.</p>
|
||||
<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code><html></code>.</p>
|
||||
<hr />
|
||||
<h1>Smart quotes, ellipses, dashes</h1>
|
||||
<p>"Hello," said the spider. "'Shelob' is my name."</p>
|
||||
@@ -442,8 +442,8 @@ Email link (nobody [at] nowhere.net)<p><a href="">Empty</a>.</p>
|
||||
An e-mail address: nobody [at] nowhere.net<blockquote>
|
||||
<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
|
||||
</blockquote>
|
||||
<p>Auto-links should not occur here: <code><http://example.com/></code></p>
|
||||
<pre><code>or here: <http://example.com/>
|
||||
<p>Auto-links should not occur here: <code><http://example.com/></code></p>
|
||||
<pre><code>or here: <http://example.com/>
|
||||
</code></pre>
|
||||
<hr />
|
||||
<h1>Images</h1>
|
||||
|
||||
Reference in New Issue
Block a user