')
def test_comment_removal():
"""Comments that start with '!' should not be output."""
t = kid.Template('')
assert t.serialize(output='HTML') == \
serialize_doctype(doctypes['html']) + '\n'
assert t.serialize(output='xhtml') == \
serialize_doctype(doctypes['xhtml']) + '\n'
assert t.serialize(output='xml') == \
'\n'
t = kid.Template('')
assert t.serialize(output='HTML') == \
serialize_doctype(doctypes['html']) + '\n'
assert t.serialize(output='xhtml') == \
serialize_doctype(doctypes['xhtml']) + '\n'
assert t.serialize(output='xml') == \
'\n
'
def test_comment_interpolation():
"""Comments starting with '[' or '' % (b, c, d)
if c.startswith('!'):
after_comment = ''
elif c == '[' or c == '' % (b, c, d)
else:
after_comment = before_comment
before = '%s' % before_comment
t = kid.Template(before, before='after')
for output in ('HTML', 'xhtml', 'xml'):
if output == 'HTML':
after = '%s' % after_comment
elif output == 'xhtml' or after_comment:
after = '%s' % after_comment
else:
after = '
"""
t = kid.Template(xml, section="support")
assert "#menu a#support" in t.serialize(output='html')
'
if output == 'xml':
after = '\n' + after
else:
doctype = serialize_doctype(doctypes[output.lower()])
after = doctype + '\n' + after
assert t.serialize(output=output) == after
def test_comment_for_loop():
"""Commenting out section with py:for and substitution (ticket #149)."""
xml = """
"""
t = kid.Template(xml, mylist = ['peaches', 'cream'])
assert """
""" in t.serialize(output='html')
def test_comment_style_sheet():
"""Allow variable substitution in style sheet (ticket #124)."""
xml = """