Efficiency: Entity handling

Previously, used a regexp to find and convert named entities in the content.
Now use a more efficient algorithm.
Similar tweak for converting NCRs before checking whether text is valid utf-8.
This commit is contained in:
Jacques Distler 2008-05-17 01:43:11 -05:00
parent 5ca0760f7c
commit 41346bf8bd
7 changed files with 50 additions and 29 deletions

View file

@ -14,9 +14,6 @@ require 'chunks/chunk'
# Author: Mark Reid <mark at threewordslong dot com>
# Created: 8th June 2004
require 'sanitize'
include Sanitize
class NoWiki < Chunk::Abstract
NOWIKI_PATTERN = Regexp.new('<nowiki>(.*?)</nowiki>', Regexp::MULTILINE)
@ -26,7 +23,7 @@ class NoWiki < Chunk::Abstract
def initialize(match_data, content)
super
@plain_text = @unmask_text = sanitize_xhtml(match_data[1])
@plain_text = @unmask_text = match_data[1]
end
end