Changes between Version 6 and Version 7 of MarkupStream
- Timestamp:
- Aug 29, 2006, 12:21:27 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MarkupStream
v6 v7 67 67 }}} 68 68 69 Finally, filters can also be applied using the '' right shift'' operator (`>>`):69 Finally, filters can also be applied using the ''bitwise or'' operator (`|`), which allows a syntax similar to pipes on Unix shells: 70 70 71 71 {{{ 72 72 #!python 73 stream = stream >>noop73 stream = stream | noop 74 74 }}} 75 75 76 76 ''Note: this is only available in the current development version (0.3)'' 77 78 '''Q: will it be `>>`, or `|` as in r254?'''79 ''(off-topic: Akismet once again rejected that change, had to log in... sigh)''80 77 81 78 One example of a filter included with Markup is the `HTMLSanitizer` in `markup.filters`. It processes a stream of HTML markup, and strips out any potentially dangerous constructs, such as Javascript event handlers. `HTMLSanitizer` is not a function, but rather a class that implements `__call__`, which means instances of the class are callable. … … 93 90 {{{ 94 91 #!python 95 stream = stream >> noop >>HTMLSanitizer()92 stream = stream | noop | HTMLSanitizer() 96 93 }}} 97 94 … … 143 140 }}} 144 141 145 The right-shiftoperator (added in 0.3) allows a nicer syntax:142 The pipe operator (added in 0.3) allows a nicer syntax: 146 143 147 144 {{{ 148 >>> print stream >> HTMLSanitizer() >>TextSerializer()145 >>> print stream | HTMLSanitizer() | TextSerializer() 149 146 Some text and a link. 150 147 }}}