Implement Injector->handleEnd, with lots of refactoring for injector.
commitfa413e96ac4bf2c4efb0303c0aafcfa3fc39413d
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 1 Oct 2008 04:54:51 +0000 (1 00:54 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 1 Oct 2008 04:54:51 +0000 (1 00:54 -0400)
tree835cdae4abe7ee255a195ae20704c27b8737a0f0
parentd0fdcc103e8dae6fc3425a093414605e0a33ffbf
Implement Injector->handleEnd, with lots of refactoring for injector.

Previous design of injector streaming involved editability only to start, empty
and text tokens, because they could be safely modified without causing formedness
errors.  By modifying notifyEnd to operate before MakeWellFormed's safeguards
kick into effect, it can be converted into a handle function, allowing for
arbitrary modification of end tags.

This change involved quite a bit of restructuring of the MakeWellFormed code,
including the moving of end of document tags to inside the loop, so rewinding
on those tags would be functional, increased reuse of the end tag codepath by
code that inserts end tags (as they could be changed out from under you), and
processToken modified to have an extra parameter to force re-processing of
a token if the original token was an end token.

We're not exactly sure if handleEnd works at this point, but the important
talking point about this refactoring is that nothing else broke. Also, a number
of convenience functions were moved from AutoParagraph to the Injector
supertype (specifically: forward, forwardToEndToken, backward, and current).

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
NEWS
library/HTMLPurifier/Injector.php
library/HTMLPurifier/Injector/AutoParagraph.php
library/HTMLPurifier/Injector/SafeObject.php
library/HTMLPurifier/Strategy/MakeWellFormed.php
tests/HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php