FIX: Only wrap inline html tags in <p>

This commit is contained in:
Robin Ward
2013-10-18 15:20:27 -04:00
parent 715a6d177a
commit d7182d0b14
13 changed files with 23 additions and 56 deletions
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer escapes > as &gt; even though Markdown doesn't specify that.
-->
<p>AT&amp;T has an ampersand in their name.</p>
<p>AT&amp;T is another way to write it.</p>
@@ -1,10 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer escapes quotes " as &quot;
- Our sanitizer has not whitelisted attr attributes in `span`s
- Our sanitizer replaces backticks with &#x60; in code blocks
-->
<p>These should all get escaped:</p>
<p>Backslash: \</p>
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer escapes quotes " as &quot;
-->
<blockquote>
<p>Example:</p>
@@ -1,10 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer escapes quotes " as &quot;
- Our sanitizer has not whitelisted attr attributes in `span`s
- Our sanitizer replaces backticks with &#x60;
-->
<p><code>&lt;test a=&quot;</code> content of attribute <code>&quot;&gt;</code></p>
<p>Fix for backticks within HTML tag: <span>like this</span></p>
@@ -1,9 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer removes the style tag
- It removes id and classes.
-->
<p>Simple block on one line:</p>
<div>foo</div>
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- It removes id and classes.
-->
<p>Here's a simple block:</p>
<div>
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- Our HTML sanitizer puts &#39; in attributes
-->
<p>Just a <a href="/url/">URL</a>.</p>
<p><a href="/url/" title="title">URL and title</a>.</p>
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- Sanitized elements and entities
-->
<h1>Markdown: Basics</h1>
<ul>
@@ -1,8 +1,3 @@
<!--
Changed for Discourse:
- Sanitized elements and entities
-->
<h1>Markdown: Syntax</h1>
<ul>
+1 -2
View File
@@ -19,7 +19,6 @@ var md = function(input, expected, text) {
expectedNorm = normalize(expected),
same = (result === expected) || (resultNorm === expectedNorm);
if (same) {
ok(same, text);
} else {
@@ -42,7 +41,7 @@ test("first", function(){
filename = Pathname.new(filename_no_ext)
text = File.read(f)
html = File.read("#{filename_no_ext}.xhtml").gsub(/\<\!\-\-(.*?)\-\-\>/m, '')
html = File.read("#{filename_no_ext}.xhtml");
result << "test(\"#{filename}\", function() { md(#{text.to_json}, #{html.to_json}, 'passes MDTest'); });\n"
end
result