Table Of Contents

Previous topic

.py Template Modules

Next topic

Directives: Parser Instructions

This Page

Directives: Comments

(comments)

The template:

Text before the comment.
## The comment.
Text after the comment.
#* A multi-line comment spanning several lines.
   It spans several lines, too.
*#
Text after the multi-line comment.

The output:

Text before the comment.
Text after the comment.

Text after the multi-line comment.

The generated code:

write('Text before the comment.\n')
#  The comment.
write('Text after the comment.\n')
#  A multi-line comment spanning several lines.
#    It spans several lines, too.
write('\nText after the multi-line comment.\n')

Docstring and header comments

(comments.docstring)

The template:

##doc: .respond() method comment.
##doc-method: Another .respond() method comment.
##doc-class: A class comment.
##doc-module: A module comment.
##header: A header comment.

The output:

The beginning of the generated {.respond} method:

def respond(self,
        trans=None,
        dummyTrans=False,
        VFS=valueFromSearchList,
        VFN=valueForName,
        getmtime=getmtime,
        currentTime=time.time):

    """
    This is the main method generated by Cheetah
    .respond() method comment.
    Another .respond() method comment.
    """

The class docstring:

"""
A class comment.

Autogenerated by CHEETAH: The Python-Powered Template Engine
"""

The top of the module:

#!/usr/bin/env python
# A header comment.

"""A module comment.

Autogenerated by CHEETAH: The Python-Powered Template Engine
 CHEETAH VERSION: 0.9.13a1
 Generation time: Fri Apr 26 22:39:23 2002
   Source file: x.tmpl
   Source file last modified: Fri Apr 26 22:36:23 2002
"""