/usr/share/doc/python-plastex-doc/html/sect0041.html is in python-plastex-doc 0.9.2-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | <!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" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>plasTeX — A Python Framework for Processing LaTeX Documents: Renderer Objects</title>
<link href="sect0042.html" title="Renderable MixIn" rel="next" />
<link href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasRendering Framework" rel="prev" />
<link href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasRendering Framework" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Previous: plasTeX.Renderers — The plasTeX Rendering Framework" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Up: plasTeX.Renderers — The plasTeX Rendering Framework" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0042.html" title="Renderable MixIn"><img alt="Next: Renderable MixIn" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">plasTeX — A Python Framework for Processing LaTeX Documents</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">plasTeX — A Python Framework for Processing LaTeX Documents</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0024.html">plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X Frameworks and APIs</a> <b>:</b>
</span>
</span><span>
<span>
<a href="module-plasTeX-Renderers.html"><tt class="ttfamily">plasTeX.Renderers</tt> — The plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X Rendering Framework</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Renderer Objects</b>
</span>
</span>
<hr />
</div>
<div><h2 id="a0000000042">6.6.1 Renderer Objects</h2>
<p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><b class="bf">class </b><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">Renderer</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000317" id="a0000000317"></a> Base class for all renderers. <tt class="ttfamily">Renderer</tt> is a dictionary and contains functions that are called for each node in the plasT<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X document object. The keys in the dictionary correspond to the names of the nodes. </p></dd>
</dl> </p><p>This renderer implementation uses a mixin called <tt class="ttfamily">Renderable</tt> that is mixed into the <tt class="ttfamily">Node</tt> class prior to rendering. <tt class="ttfamily">Renderable</tt> adds various methods to the <tt class="ttfamily">Node</tt> namespace to assist in the rendering process. The primary inclusion is the <tt class="ttfamily">__unicode__()</tt> method. This method returns a unicode representation of the current node and all of its child nodes. For more information, see the <tt class="ttfamily">Renderable</tt> class documentation. </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">default</b></tt></span></dt>
<dd><p><a name="a0000000318" id="a0000000318"></a> the default renderer value. If a node is being rendered and no key in the renderer matches the name of the node being rendered, this function is used instead. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">fileExtension</b></tt></span></dt>
<dd><p><a name="a0000000319" id="a0000000319"></a> contains the file extension to use for generated files. This extension is only used if the filename generator does not supply a file extension. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">files</b></tt></span></dt>
<dd><p><a name="a0000000320" id="a0000000320"></a> a list of files created during rendering. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">imageAttrs</b></tt></span></dt>
<dd><p><a name="a0000000321" id="a0000000321"></a> contains a string template that renders the placeholder for the image attributes: width, height, and depth. This placeholder is inserted into the document where the width, height, and depth of an image is needed. The placeholder is needed because images are not generated until after the document is rendered. See the <tt class="ttfamily">Imager</tt> API (section <a href="module-plasTeX-Imagers.html">6.7</a>) for more information. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">imageUnits</b></tt></span></dt>
<dd><p><a name="a0000000322" id="a0000000322"></a> contains a string template that renders the placeholder for the image attribute units. This placeholder is inserted in the document any time an attribute of a particular unit is requested. This placeholder will always occur immediately after the string generated by <tt class="ttfamily">imageAttrs</tt>. The placeholder is needed because images are not generated until after the document is rendered. See the <tt class="ttfamily">Imager</tt> API (section <a href="module-plasTeX-Imagers.html">6.7</a>) for more information. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">imager</b></tt></span></dt>
<dd><p><a name="a0000000323" id="a0000000323"></a> a reference to an <tt class="ttfamily">Imager</tt> implementation. Imagers are responsible for generating images from L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X code. This is needed for output types which aren’t capable of displaying equations, L<sup style="font-variant:small-caps; margin-left:-0.3em">a</sup>T<sub style="text-transform:uppercase; margin-left:-0.2em">e</sub>X pictures, etc. such as HTML. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">imageTypes</b></tt></span></dt>
<dd><p><a name="a0000000324" id="a0000000324"></a> contains a list of file extensions of valid image types for the renderer. The first element in the list is the default image format. This format is used when generating images (if the image type isn’t specified by the filename generater). When static images are simply copied from the document, their format is checked against the list of supported image types. If the static image is not in the correct format it is converted to the default image format. Below is an example of a list of image types used in the HTML renderer. These image types are valid because web browsers all support these formats. </p><pre>
imageTypes = ['.png','.gif','.jpg','.jpeg']
</pre></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">vectorImageTypes</b></tt></span></dt>
<dd><p><a name="a0000000325" id="a0000000325"></a> contains a list of file extensions of valid vector image types for the renderer. The first element in the list is the default vector image format. This format is used when generating images. Static images are simply copied into the output document directory. Below is an example of a list of image types used in the HTML renderer. These image types are valid because there are plug-ins available for these formats. </p><pre>
vectorImageTypes = ['.svg']
</pre></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">newFilename</b></tt></span></dt>
<dd><p><a name="a0000000326" id="a0000000326"></a> filename generator. This method generates a basename based on the options in the configuration. </p><p>The generator has an attribute called <tt class="ttfamily">namespace</tt> which contains the namespace used to resolve the variables in the filename string. This namespace should be populated prior to invoking the generator. After a successful filename is generated, the namespace is automatically cleared (with the exception of the variables sent in the namespace when the generator was instantiated). </p><p><b class="bf">Note:</b> This generator can be accessed in the usual generator fashion, or called like a function. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">outputType</b></tt></span></dt>
<dd><p><a name="a0000000327" id="a0000000327"></a> a function that converts the content returned from each rendered node to the appropriate value. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">textDefault</b></tt></span></dt>
<dd><p><a name="a0000000328" id="a0000000328"></a> the default renderer to use for text nodes. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">cleanup</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">document, files<span class="textnormal"><big class="xlarge">[</big></span>, postProcess<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000329" id="a0000000329"></a> this method is called once the entire rendering process is finished. Subclasses can use this method to run any post-rendering cleanup tasks. The first argument, <span class="rmfamily"><i class="itshape">document</i></span>, is the document instance that is being rendered. The second argument, <span class="rmfamily"><i class="itshape">files</i></span>, is a list of all of the filenames that were created. </p><p>This method opens each file, reads the content, and calls <tt class="ttfamily">processFileContent</tt> on the file content. It is suggested that renderers override that method instead of <tt class="ttfamily">cleanup</tt>. </p><p>In addition to overriding <tt class="ttfamily">processFileContent</tt>, you can post-process file content without having to subclass a renderer by using the <span class="rmfamily"><i class="itshape">postProcess</i></span> argument. See the <tt class="ttfamily">render</tt> method for more information. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">find</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">keys<span class="textnormal"><big class="xlarge">[</big></span>, default<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000330" id="a0000000330"></a> locate a rendering method from a list of possibilities. </p><p><span class="rmfamily"><i class="itshape">keys</i></span> is a list of strings containing the requested name of a rendering method. This list is traversed in order. The first renderer that is found is returned. </p><p><span class="rmfamily"><i class="itshape">default</i></span> is a default rendering method to return if none of the keys exists in the renderer. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">initialize</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape"></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000331" id="a0000000331"></a> this routine is called after the renderer is instantiated. It can be used by subclasses to do any initialization routines before the rendering process. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">processFileContent</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">document, content</i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000332" id="a0000000332"></a> post-processing routine that allows renders to modify the output documents one last time before the rendering process is finished. <span class="rmfamily"><i class="itshape">document</i></span> is the input document instance. <span class="rmfamily"><i class="itshape">content</i></span> is the content of the file in a unicode object. The value returned from this method will be written to the output file in the appropriate encoding. </p></dd>
</dl> </p><p> <dl class="description">
<dt></dt>
<dd></dd>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
<dt><span class="rmfamily"><tt class="ttfamily"><b class="bfseries">render</b></tt></span><span class="rmfamily"><tt class="ttfamily">(</tt></span><span style="width:0.0pt" class="parbox"><span class="rmfamily"><i class="itshape">document<span class="textnormal"><big class="xlarge">[</big></span>, postProcess<span class="textnormal"><big class="xlarge">]</big></span></i></span><span class="rmfamily"><tt class="ttfamily">)</tt></span></span></dt>
<dd><p><a name="a0000000333" id="a0000000333"></a> invokes the rendering process on <span class="rmfamily"><i class="itshape">document</i></span>. You can post-process each file after it is rendered by passing a function into the <span class="rmfamily"><i class="itshape">postProcess</i></span> argument. This function must take two arguments: 1) the document object and 2) the content of a file as a unicode object. It should do whatever processing it needs to the file content and return a unicode object. </p></dd>
</dl> </p></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Previous: plasTeX.Renderers — The plasTeX Rendering Framework" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="module-plasTeX-Renderers.html" title="plasTeX.Renderers — The plasTeX Rendering Framework"><img alt="Up: plasTeX.Renderers — The plasTeX Rendering Framework" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0042.html" title="Renderable MixIn"><img alt="Next: Renderable MixIn" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">plasTeX — A Python Framework for Processing LaTeX Documents</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|