* escape html tags, except pre tags (#807, #795)
* try to avoid unwanted quick phrase modifiers
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1216
e93f8b46-1217-0410-a6f0-
8f06a7374b81
@pre_list = []
rip_offtags text
no_textile text
+ escape_html_tags text
hard_break text
unless @lite_mode
refs text
re =
case rtype
when :limit
- /(\W)
+ /(^|[>\s])
(#{rcq})
(#{C})
(?::(\S+?))?
- (\S.*?\S|\S)
+ ([^\s\-].*?[^\s\-]|\w)
#{rcq}
- (?=\W)/x
+ (?=[[:punct:]]|\s|$)/x
else
/(#{rcq})
(#{C})
(?::(\S+))?
- (\S.*?\S|\S)
+ ([^\s\-].*?[^\s\-]|\w)
#{rcq}/xm
end
[rc, ht, re, rtype]
end
end
end
+
+ ALLOWED_TAGS = %w(redpre pre)
+
+ def escape_html_tags(text)
+ text.gsub!(%r{<((\/?)(\w+))}) {|m| ALLOWED_TAGS.include?($3) ? "<#{$1}" : "<#{$1}" }
+ end
end