summaryrefslogtreecommitdiff
path: root/sandbox/code-block-directive/docs/myfunction.py.pseudoxml
blob: cf21d2eabbc6249203b3ecf8b3b69676543a9a58 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<document source="/home/milde/Code/Python/docutils-svn/sandbox/code-block-directive/docs/myfunction.py.txt">
    <paragraph>
        This is a test of the new "code" directive:
    <comment xml:space="preserve">
        Translate this document with a pygments enhanced frontend, e.g.
        
         ../rst2html-highlight.py --stylesheet=../data/pygments-default.css
         ../rst2latex-highlight.py --stylesheet=../data/pygments-docutilsroles.sty
        
        or via the test case in
        
         ../pygments_code_block_directive.py --traceback
    <paragraph>
        The example from Docutils TODO list:
    <literal_block classes="code python" xml:space="preserve">
        <inline classes="k">
            print
         
        <inline classes="s">
            'This is Python code.'
        
        <inline classes="k">
            for
         
        <inline classes="n">
            i
         
        <inline classes="ow">
            in
         
        <inline classes="nb">
            range
        <inline classes="p">
            (
        <inline classes="mi">
            10
        <inline classes="p">
            ):
        
            
        <inline classes="k">
            print
         
        <inline classes="n">
            i
    <paragraph>
        Numbered lines:
    <literal_block classes="code python" xml:space="preserve">
        <inline classes="ln">
            1 
        <inline classes="c">
            # This is Python code,
        
        <inline classes="ln">
            2 
        <inline classes="c">
            # that prints the integers from 0 to 9
        
        <inline classes="ln">
            3 
        <inline classes="k">
            for
         
        <inline classes="n">
            i
         
        <inline classes="ow">
            in
         
        <inline classes="nb">
            range
        <inline classes="p">
            (
        <inline classes="mi">
            10
        <inline classes="p">
            ):
        
        <inline classes="ln">
            4 
            
        <inline classes="k">
            print
         
        <inline classes="n">
            i
    <paragraph>
        Another example:
    <literal_block classes="code python silly" ids="my-function" names="my_function" xml:space="preserve">
        <inline classes="ln">
             7 
        <inline classes="k">
            def
         
        <inline classes="nf">
            my_function
        <inline classes="p">
            ():
        
        <inline classes="ln">
             8 
            
        <inline classes="sd">
            """Test the lexer.
        <inline classes="ln">
             9 
        <inline classes="sd">
                """
        
        <inline classes="ln">
            10 
        
        <inline classes="ln">
            11 
            
        <inline classes="c">
            # and now for something completely different
        
        <inline classes="ln">
            12 
            
        <inline classes="k">
            print
         
        <inline classes="mi">
            8
        <inline classes="o">
            /
        <inline classes="mi">
            2
    <paragraph>
        The end.