RedCloth 4.1.0-universal-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of RedCloth might be problematic. Click here for more details.

Files changed (59) hide show
  1. data/CHANGELOG +103 -0
  2. data/COPYING +18 -0
  3. data/Manifest +57 -0
  4. data/README +156 -0
  5. data/Rakefile +205 -0
  6. data/RedCloth.gemspec +141 -0
  7. data/bin/redcloth +28 -0
  8. data/ext/mingw-rbconfig.rb +176 -0
  9. data/ext/redcloth_scan/extconf.rb +9 -0
  10. data/ext/redcloth_scan/redcloth.h +164 -0
  11. data/ext/redcloth_scan/redcloth_attributes.c.rl +56 -0
  12. data/ext/redcloth_scan/redcloth_attributes.java.rl +96 -0
  13. data/ext/redcloth_scan/redcloth_attributes.rl +33 -0
  14. data/ext/redcloth_scan/redcloth_common.c.rl +18 -0
  15. data/ext/redcloth_scan/redcloth_common.java.rl +18 -0
  16. data/ext/redcloth_scan/redcloth_common.rl +111 -0
  17. data/ext/redcloth_scan/redcloth_inline.c.rl +159 -0
  18. data/ext/redcloth_scan/redcloth_inline.java.rl +108 -0
  19. data/ext/redcloth_scan/redcloth_inline.rl +157 -0
  20. data/ext/redcloth_scan/redcloth_scan.c.rl +227 -0
  21. data/ext/redcloth_scan/redcloth_scan.java.rl +555 -0
  22. data/ext/redcloth_scan/redcloth_scan.rl +323 -0
  23. data/extras/ragel_profiler.rb +73 -0
  24. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  25. data/lib/redcloth.rb +37 -0
  26. data/lib/redcloth/erb_extension.rb +27 -0
  27. data/lib/redcloth/formatters/base.rb +57 -0
  28. data/lib/redcloth/formatters/html.rb +349 -0
  29. data/lib/redcloth/formatters/latex.rb +249 -0
  30. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  31. data/lib/redcloth/textile_doc.rb +105 -0
  32. data/lib/redcloth/version.rb +28 -0
  33. data/lib/redcloth_scan.jar +0 -0
  34. data/setup.rb +1585 -0
  35. data/test/basic.yml +870 -0
  36. data/test/code.yml +229 -0
  37. data/test/definitions.yml +82 -0
  38. data/test/extra_whitespace.yml +64 -0
  39. data/test/filter_html.yml +177 -0
  40. data/test/filter_pba.yml +20 -0
  41. data/test/helper.rb +108 -0
  42. data/test/html.yml +305 -0
  43. data/test/images.yml +246 -0
  44. data/test/instiki.yml +38 -0
  45. data/test/links.yml +259 -0
  46. data/test/lists.yml +283 -0
  47. data/test/poignant.yml +89 -0
  48. data/test/sanitize_html.yml +42 -0
  49. data/test/table.yml +267 -0
  50. data/test/test_custom_tags.rb +46 -0
  51. data/test/test_erb.rb +13 -0
  52. data/test/test_extensions.rb +31 -0
  53. data/test/test_formatters.rb +24 -0
  54. data/test/test_parser.rb +73 -0
  55. data/test/test_restrictions.rb +41 -0
  56. data/test/textism.yml +480 -0
  57. data/test/threshold.yml +772 -0
  58. data/test/validate_fixtures.rb +73 -0
  59. metadata +139 -0
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: inline code
3
+ in: 'This is an empty dictionary: @{}@'
4
+ html: '<p>This is an empty dictionary: <code>{}</code></p>'
5
+ ---
6
+ name: inline code escapement
7
+ in: 'Please type @cat "file.txt" > otherfile.txt@ at the prompt.'
8
+ html: '<p>Please type <code>cat "file.txt" &gt; otherfile.txt</code> at the prompt.</p>'
9
+ ---
10
+ name: inline code escapement with digits
11
+ in: |-
12
+ Regex-based string substitution with Ruby's gsub!: @"123<789".gsub!(/</, "") => "123789"@
13
+ html: |-
14
+ <p>Regex-based string substitution with Ruby&#8217;s gsub!: <code>"123&lt;789".gsub!(/&lt;/, "") =&gt; "123789"</code></p>
15
+ ---
16
+ name: inlne code escapement describing textile paragraph styling
17
+ in: 'This paragraph is aligned left but if you add this: @p>.@ to the beginning it will be aligned right.'
18
+ html: '<p>This paragraph is aligned left but if you add this: <code>p&gt;.</code> to the beginning it will be aligned right.</p>'
19
+ ---
20
+ name: escapes code snippet containing html tag
21
+ in: 'At the top of each page, please put @<h2>Title</h2>@ in the HTML.'
22
+ html: '<p>At the top of each page, please put <code>&lt;h2&gt;Title&lt;/h2&gt;</code> in the <span class="caps">HTML</span>.</p>'
23
+ ---
24
+ name: escaping in blockcode
25
+ in: 'bc. This is within a block of code, so < and > should be entities. You can talk about a <p class="foo"> tag if you wish and it will be properly escaped.'
26
+ html: '<pre><code>This is within a block of code, so &lt; and &gt; should be entities. You can talk about a &lt;p class="foo"&gt; tag if you wish and it will be properly escaped.</code></pre>'
27
+ ---
28
+ name: escaping in pre
29
+ in: '<pre><code>This is within a block of code, so < and > should be entities. You can talk about a <p class="foo"> tag in pre tags too.</code></pre>'
30
+ html: '<pre><code>This is within a block of code, so &lt; and &gt; should be entities. You can talk about a &lt;p class="foo"&gt; tag in pre tags too.</code></pre>'
31
+ ---
32
+ name: escaping in normal text
33
+ in: |-
34
+ This is a regular paragraph. AT&T. &pound;38 > $38.
35
+ html: |-
36
+ <p>This is a regular paragraph. AT&amp;T. &pound;38 &gt; $38.</p>
37
+ latex: "This is a regular paragraph. AT\\&T. \\pounds{}38 \\textgreater{} \\$38.\n\n"
38
+ ---
39
+ name: preservation of existing entities
40
+ in: "Math fact: 3 &lt; 5 &amp; 5 &gt; 3 but &pound;6 &#62; $6. Oh, and 2 &divide; 4 is &frac12;."
41
+ html: "<p>Math fact: 3 &lt; 5 &amp; 5 &gt; 3 but &pound;6 &#62; $6. Oh, and 2 &divide; 4 is &frac12;.</p>"
42
+ latex: "Math fact: 3 \\textless{} 5 \\& 5 \\textgreater{} 3 but \\pounds{}6 \\textgreater{} \\$6. Oh, and 2 \\textdiv{} 4 is \\sfrac{1}{2}.\n\n"
43
+ ---
44
+ name: escaping of existing entities in blockcode
45
+ in: "bc. Math fact: 3 &lt; 5 &amp; 5 &gt; 3 but &pound;5 &#62; $5."
46
+ html: "<pre><code>Math fact: 3 &amp;lt; 5 &amp;amp; 5 &amp;gt; 3 but &amp;pound;5 &amp;#62; $5.</code></pre>"
47
+ latex: "\\begin{verbatim}\nMath fact: 3 &lt; 5 &amp; 5 &gt; 3 but &pound;5 &#62; $5.\\end{verbatim}\n"
48
+ ---
49
+ name: no formatting within pre
50
+ in: |-
51
+ <pre>
52
+ <code>
53
+ # *test*
54
+ __not italics__
55
+ no hard breaks
56
+ </code>
57
+ </pre>
58
+ html: |-
59
+ <pre>
60
+ <code>
61
+ # *test*
62
+ __not italics__
63
+ no hard breaks
64
+ </code>
65
+ </pre>
66
+ ---
67
+ name: no formatting within blockcode
68
+ in: |-
69
+ bc. __not italics__
70
+ html: |-
71
+ <pre><code>__not italics__</code></pre>
72
+ ---
73
+ name: double-equals as inline notextile
74
+ in: |-
75
+ p. Regular paragraph
76
+
77
+ ==Escaped portion -- will not be formatted by Textile at all==
78
+
79
+ p. Back to normal.
80
+ html: |-
81
+ <p>Regular paragraph</p>
82
+ <p>Escaped portion -- will not be formatted by Textile at all</p>
83
+ <p>Back to normal.</p>
84
+ ---
85
+ name: notextile tags
86
+ in: |-
87
+ <notextile>
88
+ # *test*
89
+ </notextile>
90
+ html: |-
91
+ # *test*
92
+ valid_html: false
93
+ ---
94
+ name: unfinished notextile tag
95
+ in: |-
96
+ <notextile>
97
+ # *test*
98
+ html: |-
99
+ # *test*
100
+ valid_html: false
101
+ ---
102
+ name: unfinished script tag
103
+ in: |-
104
+ <script>
105
+ function main(){}
106
+ html: |-
107
+ <script><br />
108
+ function main(){}
109
+ valid_html: false
110
+ ---
111
+ name: inline notextile tags
112
+ in: 'This is how you make a link: <notextile>"link":http://www.redcloth.org</notextile>'
113
+ html: '<p>This is how you make a link: "link":http://www.redcloth.org</p>'
114
+ ---
115
+ name: code in list items
116
+ in: |-
117
+ * @foo@
118
+ * @bar@
119
+ * and @x@ is also.
120
+
121
+ html: |-
122
+ <ul>
123
+ <li><code>foo</code></li>
124
+ <li><code>bar</code></li>
125
+ <li>and <code>x</code> is also.</li>
126
+ </ul>
127
+ ---
128
+ name: extended block code
129
+ in: |-
130
+ If you have a line or two of code or HTML to embed, use extended block code like so:
131
+
132
+ bc.. ./foo.pl%
133
+ <p>foo outputs an HTML paragraph</p>
134
+
135
+ <p>block of code keeps going until a different block signature is encountered</p>
136
+
137
+ p. And then go back with a normal paragraph.
138
+ html: |-
139
+ <p>If you have a line or two of code or <span class="caps">HTML</span> to embed, use extended block code like so:</p>
140
+ <pre><code>./foo.pl%
141
+ &lt;p&gt;foo outputs an HTML paragraph&lt;/p&gt;</code>
142
+
143
+ <code>&lt;p&gt;block of code keeps going until a different block signature is encountered&lt;/p&gt;</code>
144
+
145
+ </pre>
146
+ <p>And then go back with a normal paragraph.</p>
147
+ ---
148
+ name: extended block code preserves leading whitespace after blank line
149
+ in: |-
150
+ bc.. class Foo
151
+ def bar
152
+ 'bar'
153
+ end
154
+
155
+ def baz
156
+ 'baz'
157
+ end
158
+ end
159
+
160
+ p. That's it!
161
+ html: |-
162
+ <pre><code>class Foo
163
+ def bar
164
+ 'bar'
165
+ end</code>
166
+
167
+ <code> def baz
168
+ 'baz'
169
+ end
170
+ end</code>
171
+
172
+ </pre>
173
+ <p>That&#8217;s it!</p>
174
+ ---
175
+ name: block code containing code avoids nesting code tags
176
+ in: |-
177
+ bc. A one-liner: @ruby -ne '($h||={}).fetch($_){puts $h[$_]=$_}'@
178
+ html: |-
179
+ <pre><code>A one-liner: @ruby -ne '($h||={}).fetch($_){puts $h[$_]=$_}'@</code></pre>
180
+ ---
181
+ name: block code containing block start
182
+ in: |-
183
+ bc. I saw a ship. It ate my elephant.
184
+ html: |-
185
+ <pre><code>I saw a ship. It ate my elephant.</code></pre>
186
+ ---
187
+ name: extended block code containing block start
188
+ in: |-
189
+ bc.. This is an extended bc.
190
+
191
+ I saw a ship. It ate my elephant.
192
+ html: |-
193
+ <pre><code>This is an extended bc.</code>
194
+
195
+ <code>I saw a ship. It ate my elephant.</code></pre>
196
+ ---
197
+ name: block containing html tags
198
+ in: bc. Can I talk about <h2>Headings</h2> here?
199
+ html: '<pre><code>Can I talk about &lt;h2&gt;Headings&lt;/h2&gt; here?</code></pre>'
200
+ ---
201
+ name: escape latex standard symbols
202
+ in: "standard symbols # $ % & _ { }"
203
+ latex: "standard symbols \\# \\$ \\% \\& \\_ \\{ \\}\n\n"
204
+ ---
205
+ name: escape latex text symbols
206
+ in: "text symbols \\ ~ ^"
207
+ latex: "text symbols \\textbackslash{} \\~{} \\^{}\n\n"
208
+ ---
209
+ name: named html entities to latex
210
+ in: "&hellip; &frac12;"
211
+ latex: "\ldots{} \sfrac{1}{2}\n\n"
212
+ ---
213
+ name: numeric html entities to latex
214
+ in: "&#8230; &#189;"
215
+ latex: "\ldots{} \sfrac{1}{2}\n\n"
216
+ ---
217
+ name: unclosed pre tag
218
+ in: '<pre><code>This is a pre that will go unfinished'
219
+ html: '<pre><code>This is a pre that will go unfinished'
220
+ valid_html: false
221
+ ---
222
+ name: unclosed code tag
223
+ in: 'This is a some <code>code that will go unfinished'
224
+ html: '<p>This is a some <code>code that will go unfinished</p>'
225
+ valid_html: false
226
+ ---
227
+ name: code containing parentheses
228
+ in: 'p. @some_method(some_params, some => test);@ Oh dear this fails'
229
+ html: '<p><code>some_method(some_params, some =&gt; test);</code> Oh dear this fails</p>'
@@ -0,0 +1,82 @@
1
+ name: redcloth definition list
2
+ in: |-
3
+ here is a RedCloth definition list:
4
+
5
+ - yes := no
6
+ - no:=no
7
+ - maybe:= yes
8
+ html: |-
9
+ <p>here is a RedCloth definition list:</p>
10
+ <dl>
11
+ <dt>yes</dt>
12
+ <dd>no</dd>
13
+ <dt>no</dt>
14
+ <dd>no</dd>
15
+ <dt>maybe</dt>
16
+ <dd>yes</dd>
17
+ </dl>
18
+ ---
19
+ name: with line breaks
20
+ in: |-
21
+ - term := you can have line breaks
22
+ just like other lists
23
+ - line-spanning
24
+ term := hey, slick!
25
+ html: |-
26
+ <dl>
27
+ <dt>term</dt>
28
+ <dd>you can have line breaks<br />
29
+ just like other lists</dd>
30
+ <dt>line-spanning<br />
31
+ term</dt>
32
+ <dd>hey, slick!</dd>
33
+ </dl>
34
+ ---
35
+ name: double terms
36
+ in: |-
37
+ You can have multiple terms before a definition:
38
+
39
+ - textile
40
+ - fabric
41
+ - cloth := woven threads
42
+ html: |-
43
+ <p>You can have multiple terms before a definition:</p>
44
+ <dl>
45
+ <dt>textile</dt>
46
+ <dt>fabric</dt>
47
+ <dt>cloth</dt>
48
+ <dd>woven threads</dd>
49
+ </dl>
50
+ ---
51
+ name: not a definition list
52
+ desc: a definition list with no definitions is not a definition list
53
+ in: |-
54
+ - textile
55
+ - fabric
56
+ - cloth
57
+ html: |-
58
+ <p>- textile<br />
59
+ - fabric<br />
60
+ - cloth</p>
61
+ ---
62
+ name: long definition list
63
+ in: |-
64
+ here is a long definition
65
+
66
+ - some term :=
67
+ *sweet*
68
+
69
+ yes
70
+
71
+ ok =:
72
+ - regular term := no
73
+ html: |-
74
+ <p>here is a long definition</p>
75
+ <dl>
76
+ <dt>some term</dt>
77
+ <dd><p><strong>sweet</strong></p>
78
+ <p>yes</p>
79
+ <p>ok</p></dd>
80
+ <dt>regular term</dt>
81
+ <dd>no</dd>
82
+ </dl>
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: header with 1 blank line below
3
+ in: |-
4
+ h1. Header
5
+
6
+ text
7
+ html: |-
8
+ <h1>Header</h1>
9
+ <p>text</p>
10
+ ---
11
+ name: header with 2 blank lines below
12
+ in: |-
13
+ h1. Header
14
+
15
+
16
+ text
17
+ html: |-
18
+ <h1>Header</h1>
19
+ <p>text</p>
20
+ ---
21
+ name: header with 1 blank line above
22
+ in: |-
23
+ text
24
+
25
+ h1. Header
26
+ html: |-
27
+ <p>text</p>
28
+ <h1>Header</h1>
29
+ ---
30
+ name: header with 2 blank lines above
31
+ in: |-
32
+ text
33
+
34
+
35
+ h1. Header
36
+ html: |-
37
+ <p>text</p>
38
+ <h1>Header</h1>
39
+ ---
40
+ name: header with 1 blank line above and with no text
41
+ in: |-
42
+
43
+ h1. Header
44
+ html: <h1>Header</h1>
45
+ ---
46
+ name: header with 2 blank lines above and with no text
47
+ in: |-
48
+
49
+
50
+ h1. Header
51
+ html: <h1>Header</h1>
52
+ ---
53
+ name: header with 1 blank line below and with no text
54
+ in: |+
55
+ h1. Header
56
+
57
+ html: <h1>Header</h1>
58
+ ---
59
+ name: header with 2 blank lines below and with no text
60
+ in: |+
61
+ h1. Header
62
+
63
+
64
+ html: <h1>Header</h1>
@@ -0,0 +1,177 @@
1
+ ---
2
+ name: standalone html escaped
3
+ in: |-
4
+ <hr>
5
+ <abc def="a=1&b=2">
6
+ <div>
7
+ <hr/>
8
+ <hr />
9
+ </div>
10
+ filtered_html: |-
11
+ &lt;hr&gt;
12
+ &lt;abc def="a=1&amp;b=2"&gt;
13
+ &lt;div&gt;
14
+ &lt;hr/&gt;
15
+ &lt;hr /&gt;
16
+ &lt;/div&gt;
17
+ ---
18
+ in: Just a little harmless xss <script src=http://ha.ckers.org/xss.js></script>
19
+ filtered_html: <p>Just a little harmless xss &lt;script src=http://ha.ckers.org/xss.js&gt;&lt;/script&gt;</p>
20
+ ---
21
+ name: escapes partial inline script tag
22
+ desc: The end tag is malformed, but it must be escaped since a browser would recognize it
23
+ in: Just a little harmless xss <script src=http://ha.ckers.org/xss.js></script
24
+ filtered_html: <p>Just a little harmless xss &lt;script src=http://ha.ckers.org/xss.js&gt;&lt;/script</p>
25
+ valid_html: false
26
+ ---
27
+ name: escapes partial scanner-level script tag
28
+ desc: The end tag is malformed, but it must be escaped since a browser would recognize it anyway.
29
+ in: <script src=http://ha.ckers.org/xss.js></script
30
+ filtered_html: '&lt;script src=http://ha.ckers.org/xss.js&gt;&lt;/script'
31
+ valid_html: false
32
+ ---
33
+ name: escapes self-closing scanner-level tag
34
+ in: <hr />
35
+ filtered_html: '&lt;hr /&gt;'
36
+ valid_html: false
37
+ ---
38
+ name: processes text beginning with space
39
+ in: ' This should be <b>escaped</b>: <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>'
40
+ filtered_html: 'This should be &lt;b&gt;escaped&lt;/b&gt;: &lt;script type="text/javascript"&gt;alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");&lt;/script&gt;'
41
+ ---
42
+ name: processes script tags beginning with space
43
+ in: ' <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>'
44
+ filtered_html: '&lt;script type="text/javascript"&gt;alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");&lt;/script&gt;'
45
+ ---
46
+ name: processes text in notextile tags
47
+ in: |-
48
+ <notextile>
49
+ This should be <b>escaped</b>: <script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script>
50
+ </notextile>
51
+ filtered_html: |-
52
+ This should be &lt;b&gt;escaped&lt;/b&gt;: &lt;script type="text/javascript"&gt;alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");&lt;/script&gt;
53
+ ---
54
+ name: processes text in inline notextile tags
55
+ in: |-
56
+ This should be <b>escaped</b>: <notextile><script type="text/javascript">alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");</script></notextile>
57
+ filtered_html: |-
58
+ <p>This should be &lt;b&gt;escaped&lt;/b&gt;: &lt;script type="text/javascript"&gt;alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");&lt;/script&gt;</p>
59
+ ---
60
+ name: escapes script tags
61
+ in: |-
62
+ <script type="text/javascript">
63
+ alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");
64
+ </script>
65
+ filtered_html: |-
66
+ &lt;script type="text/javascript"&gt;
67
+ alert("Hai. I`m in ya PC. Makin ya XSS viruzz! KThxBye");
68
+ &lt;/script&gt;
69
+ ---
70
+ name: escapes HTML entities within script tags
71
+ in: |-
72
+ <script type="text/javascript">
73
+ <!--
74
+ document.write("Hello World!")
75
+ //-->
76
+ </script>
77
+ filtered_html: |-
78
+ &lt;script type="text/javascript"&gt;
79
+ &lt;!--
80
+ document.write("Hello World!")
81
+ //--&gt;
82
+ &lt;/script&gt;
83
+ ---
84
+ name: escapes inline html tags
85
+ in: |-
86
+ p. Letting people inject their own HTML can be <em>dangerous</em>!.
87
+ filtered_html: |-
88
+ <p>Letting people inject their own <span class="caps">HTML</span> can be &lt;em&gt;dangerous&lt;/em&gt;!.</p>
89
+ ---
90
+ name: escapes html in comments
91
+ in: |-
92
+ p. You can't have people injecting HTML into <!-- <b>comments</b>! -->.
93
+ filtered_html: |-
94
+ <p>You can&#8217;t have people injecting <span class="caps">HTML</span> into &lt;!-- &lt;b&gt;comments&lt;/b&gt;! --&gt;.</p>
95
+ ---
96
+ name: escapes html in inline code tags
97
+ in: |-
98
+ p. I have some <code><em>awesome</em> code</code> here.
99
+ filtered_html: |-
100
+ <p>I have some <code>&lt;em&gt;awesome&lt;/em&gt; code</code> here.</p>
101
+ ---
102
+ name: escapes html notextile block
103
+ in: |-
104
+ notextile. This is a <em>notextile</em> block.
105
+ filtered_html: |-
106
+ This is a &lt;em&gt;notextile&lt;/em&gt; block.
107
+ ---
108
+ name: escapes html in pre tags
109
+ in: |-
110
+ <pre>
111
+ This should be <em>escaped</em>.
112
+ </pre>
113
+ filtered_html: |-
114
+ <pre>
115
+ This should be &lt;em&gt;escaped&lt;/em&gt;.
116
+ </pre>
117
+ ---
118
+ name: escapes html
119
+ in: |-
120
+ <div>This should be escaped</div>
121
+ filtered_html: |-
122
+ &lt;div&gt;This should be escaped&lt;/div&gt;
123
+ ---
124
+ name: escapes html in html
125
+ in: |-
126
+ <div>This should be <b>bold</b></div>
127
+ filtered_html: |-
128
+ &lt;div&gt;This should be &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;
129
+ ---
130
+ in: Here's a bad image <img src="JaVaScRiPt:alert('XSS');">
131
+ filtered_html: <p>Here&#8217;s a bad image &lt;img src="JaVaScRiPt:alert('XSS');"&gt;</p>
132
+ ---
133
+ in: Just some random > and < characters, but also a <br/> tag.
134
+ filtered_html: <p>Just some random &gt; and &lt; characters, but also a &lt;br/&gt; tag.</p>
135
+ ---
136
+ in: |-
137
+ Quotes outside "pre" tags are escaped.
138
+
139
+ <a href="test">Tags are completely escaped outside pre tags.</a>
140
+
141
+ <pre>
142
+ <code>
143
+ # only < and > are escaped inside pre tags. "Quotes" remain.
144
+
145
+ <div>
146
+ a = 1
147
+ </div>
148
+
149
+ Bad code here.
150
+
151
+ <script language="JavaScript">
152
+ window.open( "abfiltered_html:blank" );
153
+ </script>
154
+ </code>
155
+ </pre>
156
+
157
+ filtered_html: |-
158
+ <p>Quotes outside &#8220;pre&#8221; tags are escaped.</p>
159
+ <p>&lt;a href="test"&gt;Tags are completely escaped outside pre tags.&lt;/a&gt;</p>
160
+ <pre>
161
+ <code>
162
+ # only &lt; and &gt; are escaped inside pre tags. "Quotes" remain.
163
+
164
+ &lt;div&gt;
165
+ a = 1
166
+ &lt;/div&gt;
167
+
168
+ Bad code here.
169
+
170
+ &lt;script language="JavaScript"&gt;
171
+ window.open( "abfiltered_html:blank" );
172
+ &lt;/script&gt;
173
+ </code>
174
+ </pre>
175
+ ---
176
+ in: /me <3 beer
177
+ filtered_html: <p>/me &lt;3 beer</p>