Mercurial > genshi > mirror
diff markup/template.py @ 89:80386d62814f trunk
Support comments in templates that are not included in the output, in the same way Kid does: if the comment text starts with a `!` character, it is stripped from the output.
author | cmlenz |
---|---|
date | Mon, 17 Jul 2006 23:10:35 +0000 |
parents | 1b874f032bde |
children | c835e81c50af |
line wrap: on
line diff
--- a/markup/template.py +++ b/markup/template.py @@ -26,7 +26,7 @@ from StringIO import StringIO from markup.core import Attributes, Namespace, Stream, StreamEventKind -from markup.core import START, END, START_NS, END_NS, TEXT +from markup.core import START, END, START_NS, END_NS, TEXT, COMMENT from markup.eval import Expression from markup.input import XMLParser from markup.path import Path @@ -742,6 +742,10 @@ for kind, data, pos in self._interpolate(data, *pos): stream.append((kind, data, pos)) + elif kind is COMMENT: + if not data.lstrip().startswith('!'): + stream.append((kind, data, pos)) + else: stream.append((kind, data, pos))