summaryrefslogtreecommitdiff
path: root/docs/dev_guide/comments.rst
blob: 51e285bfa74a78f54b64aefaeb03836d4b12959f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Directives: 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
-----------------------------


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
    """