diff markup/filters.py @ 113:e815c2c07572

Removed the `sanitize()` method from the `Markup` class, and migrate the existing unit tests to `markup.tests.filters`. Provide a `Stream.filter()` method instead which can be used to conveniently apply a filter to a stream.
author cmlenz
date Mon, 31 Jul 2006 23:00:06 +0000
parents f648152df7fd
children 93bbdcf9428b
line wrap: on
line diff
--- a/markup/filters.py
+++ b/markup/filters.py
@@ -20,7 +20,7 @@
     from sets import ImmutableSet as frozenset
 import re
 
-from markup.core import Attributes, Markup, Namespace, escape
+from markup.core import Attributes, Markup, Namespace, escape, stripentities
 from markup.core import END, END_NS, START, START_NS, TEXT
 from markup.path import Path
 
@@ -130,9 +130,9 @@
                         del textbuf[:]
                         yield TEXT, output, pos
                     else:
-                        output = escape(collapse_lines('\n',
+                        output = Markup(collapse_lines('\n',
                             trim_trailing_space('',
-                                textbuf.pop())), quotes=False)
+                                escape(textbuf.pop(), quotes=False))))
                         yield TEXT, output, pos
                 if kind is not None:
                     yield kind, data, pos
@@ -182,6 +182,7 @@
 
                 new_attrib = []
                 for attr, value in attrib:
+                    value = stripentities(value)
                     if attr not in self._SAFE_ATTRS:
                         continue
                     elif attr in self._URI_ATTRS:
Copyright (C) 2012-2017 Edgewall Software