@@ -295,6 +295,7 class RedCloth < String | |||||
295 | @pre_list = [] |
|
295 | @pre_list = [] | |
296 | rip_offtags text |
|
296 | rip_offtags text | |
297 | no_textile text |
|
297 | no_textile text | |
|
298 | escape_html_tags text | |||
298 | hard_break text |
|
299 | hard_break text | |
299 | unless @lite_mode |
|
300 | unless @lite_mode | |
300 | refs text |
|
301 | refs text | |
@@ -375,18 +376,18 class RedCloth < String | |||||
375 | re = |
|
376 | re = | |
376 | case rtype |
|
377 | case rtype | |
377 | when :limit |
|
378 | when :limit | |
378 |
/(\ |
|
379 | /(^|[>\s]) | |
379 | (#{rcq}) |
|
380 | (#{rcq}) | |
380 | (#{C}) |
|
381 | (#{C}) | |
381 | (?::(\S+?))? |
|
382 | (?::(\S+?))? | |
382 |
(\ |
|
383 | ([^\s\-].*?[^\s\-]|\w) | |
383 | #{rcq} |
|
384 | #{rcq} | |
384 |
(?=\ |
|
385 | (?=[[:punct:]]|\s|$)/x | |
385 | else |
|
386 | else | |
386 | /(#{rcq}) |
|
387 | /(#{rcq}) | |
387 | (#{C}) |
|
388 | (#{C}) | |
388 | (?::(\S+))? |
|
389 | (?::(\S+))? | |
389 |
(\ |
|
390 | ([^\s\-].*?[^\s\-]|\w) | |
390 | #{rcq}/xm |
|
391 | #{rcq}/xm | |
391 | end |
|
392 | end | |
392 | [rc, ht, re, rtype] |
|
393 | [rc, ht, re, rtype] | |
@@ -1128,5 +1129,11 class RedCloth < String | |||||
1128 | end |
|
1129 | end | |
1129 | end |
|
1130 | end | |
1130 | end |
|
1131 | end | |
|
1132 | ||||
|
1133 | ALLOWED_TAGS = %w(redpre pre) | |||
|
1134 | ||||
|
1135 | def escape_html_tags(text) | |||
|
1136 | text.gsub!(%r{<((\/?)(\w+))}) {|m| ALLOWED_TAGS.include?($3) ? "<#{$1}" : "<#{$1}" } | |||
|
1137 | end | |||
1131 | end |
|
1138 | end | |
1132 |
|
1139 |
General Comments 0
You need to be logged in to leave comments.
Login now