New Sanitizer Goes Live
The new sanitizer seems to work well (cuts the time required to produce the Instiki Atom feed in half). Our strategy is to use HTML5lib for <nowiki> content, but to use the new sanitizer for content that has been processed by Maruku (and hence is well-formed). The one broken unit test won't affect us (since it dealt with very malformed HTML).
This commit is contained in:
parent
800880f382
commit
45405fc97e
8 changed files with 24 additions and 16 deletions
|
@ -2211,12 +2211,17 @@ class String
|
|||
|
||||
#:stopdoc:
|
||||
|
||||
def escapeHTML
|
||||
self.gsub( /&/, "&" ).
|
||||
gsub( /</, "<" ).
|
||||
gsub( />/, ">" )
|
||||
end
|
||||
|
||||
def unescapeHTML
|
||||
self.gsub(/&(.*?);/n) do
|
||||
match = $1.dup
|
||||
case match
|
||||
when /\Aamp\z/ni then '&'
|
||||
when /\Aquot\z/ni then '"'
|
||||
when /\Agt\z/ni then '>'
|
||||
when /\Alt\z/ni then '<'
|
||||
when /\A#0*(\d+)\z/n then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue