File: doctools.html

package info (click to toggle)
python-paver 1.2.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 1,220 kB
  • sloc: python: 4,678; makefile: 20
file content (291 lines) | stat: -rw-r--r-- 13,426 bytes parent folder | download | duplicates (3)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Documentation Tools (paver.doctools) &mdash; Paver 1.2.1 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.2.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Paver 1.2.1 documentation" href="index.html" />
    <link rel="up" title="The Paver Standard Library" href="paverstdlib.html" />
    <link rel="next" title="Miscellaneous Tasks (paver.misctasks)" href="misctasks.html" />
    <link rel="prev" title="File Handling in Paver (paver.path)" href="files.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="misctasks.html" title="Miscellaneous Tasks (paver.misctasks)"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="files.html" title="File Handling in Paver (paver.path)"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Paver 1.2.1 documentation</a> &raquo;</li>
          <li><a href="paverstdlib.html" accesskey="U">The Paver Standard Library</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-paver.doctools">
<span id="documentation-tools-paver-doctools"></span><span id="doctools"></span><h1>Documentation Tools (paver.doctools)<a class="headerlink" href="#module-paver.doctools" title="Permalink to this headline">¶</a></h1>
<p>Tasks and utility functions and classes for working with project
documentation.</p>
<dl class="class">
<dt id="paver.doctools.Includer">
<em class="property">class </em><tt class="descclassname">paver.doctools.</tt><tt class="descname">Includer</tt><big>(</big><em>basedir</em>, <em>cog=None</em>, <em>include_markers=None</em><big>)</big><a class="headerlink" href="#paver.doctools.Includer" title="Permalink to this definition">¶</a></dt>
<dd><p>Looks up SectionedFiles relative to the basedir.</p>
<p>When called with a filename and an optional section, the Includer
will:</p>
<ol class="arabic simple">
<li>look up that file relative to the basedir in a cache</li>
<li>load it as a SectionedFile if it&#8217;s not in the cache</li>
<li>return the whole file if section is None</li>
<li>return just the section desired if a section is requested</li>
</ol>
<p>If a cog object is provided at initialization, the text will be
output (via cog&#8217;s out) rather than returned as
a string.</p>
<p>You can pass in include_markers which is a dictionary that maps
file extensions to the single line comment character for that
file type. If there is an include marker available, then
output like:</p>
<p># section &#8216;sectionname&#8217; from &#8216;file.py&#8217;</p>
<p>There are some default include markers. If you don&#8217;t pass
in anything, no include markers will be displayed. If you
pass in an empty dictionary, the default ones will
be displayed.</p>
</dd></dl>

<dl class="class">
<dt id="paver.doctools.SectionedFile">
<em class="property">class </em><tt class="descclassname">paver.doctools.</tt><tt class="descname">SectionedFile</tt><big>(</big><em>filename=None</em>, <em>from_string=None</em><big>)</big><a class="headerlink" href="#paver.doctools.SectionedFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Loads a file into memory and keeps track of all of the
sections found in the file. Sections are started with a
line that looks like this:</p>
<div class="highlight-python"><pre>[[[section SECTIONNAME]]]</pre>
</div>
<p>Anything else can appear on the line outside of the brackets
(so if you&#8217;re in a source code file, you can put the section marker
in a comment). The entire lines containing the section markers are
not included when you request the text from the file.</p>
<p>An end of section marker looks like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[[[</span><span class="n">endsection</span><span class="p">]]]</span>
</pre></div>
</div>
<p>Sections can be nested. If you do nest sections, you will use
dotted notation to refer to the inner sections. For example,
a &#8220;dessert&#8221; section within an &#8220;order&#8221; section would be referred
to as &#8220;order.dessert&#8221;.</p>
<p>The SectionedFile provides dictionary-style access to the
sections. If you have a SectionedFile named &#8216;sf&#8217;,
sf[sectionname] will give you back a string of that section
of the file, including any inner sections. There won&#8217;t
be any section markers in that string.</p>
<p>You can get the text of the whole file via the <tt class="docutils literal"><span class="pre">all</span></tt> property
(for example, <tt class="docutils literal"><span class="pre">sf.all</span></tt>).</p>
<p>Section names must be unique across the file, but inner section
names are kept track of by the full dotted name. So you can
have a &#8220;dessert&#8221; section that is contained within two different
outer sections.</p>
<p>Ending a section without starting one or ending the file without
ending a section will yield BuildFailures.</p>
<dl class="attribute">
<dt id="paver.doctools.SectionedFile.all">
<tt class="descname">all</tt><a class="headerlink" href="#paver.doctools.SectionedFile.all" title="Permalink to this definition">¶</a></dt>
<dd><p>Property to get access to the whole file.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="paver.doctools.cog">
<tt class="descclassname">paver.doctools.</tt><tt class="descname">cog</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#paver.doctools.cog" title="Permalink to this definition">¶</a></dt>
<dd><p>Runs the cog code generator against the files matching your 
specification. By default, cog will run against any .rst files
in your Sphinx document root. Full documentation for Cog is
here:</p>
<p><a class="reference external" href="http://nedbatchelder.com/code/cog/">http://nedbatchelder.com/code/cog/</a></p>
<p>In a nutshell, you put blocks in your file that look like
this:</p>
<p>[[[cog cog.outl(&#8220;Hi there!&#8221;)
]]]
[[[end]]]</p>
<p>Cog will replace the space between ]]] and [[[end]]] with
the generated output. In this case, Hi there!</p>
<p>Here are the options available for the cog task. These are
looked up in the &#8216;cog&#8217; options section by default. The
&#8216;sphinx&#8217; option set is also searched.</p>
<dl class="docutils">
<dt>basedir</dt>
<dd>directory to look in for files to cog. If not set,
&#8216;docroot&#8217; is looked up.</dd>
<dt>pattern</dt>
<dd>file glob to look for under basedir. By default, <tt class="docutils literal"><span class="pre">*.rst</span></tt></dd>
<dt>includedir</dt>
<dd><p class="first">If you have external files to include in your
documentation, setting includedir to the root
of those files will put a paver.doctools.Includer 
in your Cog namespace as &#8216;include&#8217;. This lets you
easily include files and sections of files. Here&#8217;s
an example usage:</p>
<div class="last highlight-python"><pre>[[[cog include('filename_under_includedir.py', 'mysection')]]]
[[[end]]]</pre>
</div>
</dd>
<dt>defines</dt>
<dd>Dictionary of objects added to your Cog namespace.
(can supersede &#8216;include&#8217; and &#8216;sh&#8217; defined by includedir.)</dd>
<dt>beginspec</dt>
<dd>String used at the beginning of the code generation block.
Default: [[[cog</dd>
<dt>endspec</dt>
<dd>String used at the end of the code generation block.
Default; ]]]</dd>
<dt>endoutput</dt>
<dd>String used at the end of the generated output
Default: [[[end]]]</dd>
<dt>delete_code</dt>
<dd>Remove the generator code. Note that this will mean that the
files that get changed cannot be changed again since the code
will be gone. Default: False</dd>
<dt>include_markers</dt>
<dd><p class="first">Dictionary mapping file extensions to the single line
comment marker for that file. There are some defaults.
For example, &#8216;py&#8217; maps to &#8216;# &#8216;. If there is a known
include marker for a given file, then a comment
will be displayed along the lines of:</p>
<p># section &#8216;SECTIONNAME&#8217; in file &#8216;foo.py&#8217;</p>
<p class="last">If this option is not set, these lines will not
be displayed at all. If this option is set to an
empty dictionary, the default include markers
will be displayed. You can also pass in your own
extension -&gt; include marker settings.</p>
</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="paver.doctools.doc_clean">
<tt class="descclassname">paver.doctools.</tt><tt class="descname">doc_clean</tt><big>(</big><big>)</big><a class="headerlink" href="#paver.doctools.doc_clean" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean (delete) the built docs. Specifically, this deletes the
build directory under the docroot. See the html task for the
options list.</p>
</dd></dl>

<dl class="function">
<dt id="paver.doctools.html">
<tt class="descclassname">paver.doctools.</tt><tt class="descname">html</tt><big>(</big><big>)</big><a class="headerlink" href="#paver.doctools.html" title="Permalink to this definition">¶</a></dt>
<dd><p>Build HTML documentation using Sphinx. This uses the following
options in a &#8220;sphinx&#8221; section of the options.</p>
<dl class="docutils">
<dt>docroot</dt>
<dd>the root under which Sphinx will be working. Default: docs</dd>
<dt>builddir</dt>
<dd>directory under the docroot where the resulting files are put.
default: build</dd>
<dt>sourcedir</dt>
<dd>directory under the docroot for the source files
default: (empty string)</dd>
</dl>
</dd></dl>

<dl class="function">
<dt id="paver.doctools.uncog">
<tt class="descclassname">paver.doctools.</tt><tt class="descname">uncog</tt><big>(</big><em>options</em><big>)</big><a class="headerlink" href="#paver.doctools.uncog" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the Cog generated code from files. Often, you will want to
do this before committing code under source control, because you
don&#8217;t generally want generated code in your version control system.</p>
<p>This takes the same options as the cog task. Look there for
more information.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="files.html"
                        title="previous chapter">File Handling in Paver (paver.path)</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="misctasks.html"
                        title="next chapter">Miscellaneous Tasks (paver.misctasks)</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/doctools.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="misctasks.html" title="Miscellaneous Tasks (paver.misctasks)"
             >next</a> |</li>
        <li class="right" >
          <a href="files.html" title="File Handling in Paver (paver.path)"
             >previous</a> |</li>
        <li><a href="index.html">Paver 1.2.1 documentation</a> &raquo;</li>
          <li><a href="paverstdlib.html" >The Paver Standard Library</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2008, SitePen, Inc..
      Last updated on Jun 02, 2013.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1.
    </div>
  </body>
</html>