~ubuntu-branches/debian/experimental/pygments/experimental

« back to all changes in this revision

Viewing changes to docs/build/filters.html

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski
  • Date: 2010-01-03 00:50:59 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100103005059-ok4caxbr740rb8ok
Tags: 1.2.2+dfsg-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
<p>If you want to write your own filter, have a look at <a class="reference external" href="./filterdevelopment.html">Write your own filter</a>.</p>
243
243
<div class="section" id="builtin-filters">
244
244
<h3>Builtin Filters</h3>
 
245
<p><cite>RaiseOnErrorTokenFilter</cite></p>
 
246
<blockquote>
 
247
<p>Raise an exception when the lexer generates an error token.</p>
 
248
<p>Options accepted:</p>
 
249
<dl class="docutils">
 
250
<dt><cite>excclass</cite> <span class="classifier-delimiter">:</span> <span class="classifier">Exception class</span></dt>
 
251
<dd>The exception class to raise.
 
252
The default is <cite>pygments.filters.ErrorToken</cite>.</dd>
 
253
</dl>
 
254
<p><em>New in Pygments 0.8.</em></p>
 
255
<table class="docutils field-list" frame="void" rules="none">
 
256
<col class="field-name" />
 
257
<col class="field-body" />
 
258
<tbody valign="top">
 
259
<tr class="field"><th class="field-name">Name:</th><td class="field-body">raiseonerror</td>
 
260
</tr>
 
261
</tbody>
 
262
</table>
 
263
</blockquote>
 
264
<p><cite>VisibleWhitespaceFilter</cite></p>
 
265
<blockquote>
 
266
<p>Convert tabs, newlines and/or spaces to visible characters.</p>
 
267
<p>Options accepted:</p>
 
268
<dl class="docutils">
 
269
<dt><cite>spaces</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
 
270
<dd>If this is a one-character string, spaces will be replaces by this string.
 
271
If it is another true value, spaces will be replaced by <tt class="docutils literal">·</tt> (unicode
 
272
MIDDLE DOT).  If it is a false value, spaces will not be replaced.  The
 
273
default is <tt class="docutils literal">False</tt>.</dd>
 
274
<dt><cite>tabs</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
 
275
<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal">»</tt>
 
276
(unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK).  The default value
 
277
is <tt class="docutils literal">False</tt>.  Note: this will not work if the <cite>tabsize</cite> option for the
 
278
lexer is nonzero, as tabs will already have been expanded then.</dd>
 
279
<dt><cite>tabsize</cite> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
 
280
<dd>If tabs are to be replaced by this filter (see the <cite>tabs</cite> option), this
 
281
is the total number of characters that a tab should be expanded to.
 
282
The default is <tt class="docutils literal">8</tt>.</dd>
 
283
<dt><cite>newlines</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
 
284
<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal">¶</tt>
 
285
(unicode PILCROW SIGN).  The default value is <tt class="docutils literal">False</tt>.</dd>
 
286
<dt><cite>wstokentype</cite> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
 
287
<dd>If true, give whitespace the special <cite>Whitespace</cite> token type.  This allows
 
288
styling the visible whitespace differently (e.g. greyed out), but it can
 
289
disrupt background colors.  The default is <tt class="docutils literal">True</tt>.</dd>
 
290
</dl>
 
291
<p><em>New in Pygments 0.8.</em></p>
 
292
<table class="docutils field-list" frame="void" rules="none">
 
293
<col class="field-name" />
 
294
<col class="field-body" />
 
295
<tbody valign="top">
 
296
<tr class="field"><th class="field-name">Name:</th><td class="field-body">whitespace</td>
 
297
</tr>
 
298
</tbody>
 
299
</table>
 
300
</blockquote>
 
301
<p><cite>TokenMergeFilter</cite></p>
 
302
<blockquote>
 
303
<p>Merges consecutive tokens with the same token type in the output stream of a
 
304
lexer.</p>
 
305
<p><em>New in Pygments 1.2.</em></p>
 
306
<table class="docutils field-list" frame="void" rules="none">
 
307
<col class="field-name" />
 
308
<col class="field-body" />
 
309
<tbody valign="top">
 
310
<tr class="field"><th class="field-name">Name:</th><td class="field-body">tokenmerge</td>
 
311
</tr>
 
312
</tbody>
 
313
</table>
 
314
</blockquote>
 
315
<p><cite>GobbleFilter</cite></p>
 
316
<blockquote>
 
317
<p>Gobbles source code lines (eats initial characters).</p>
 
318
<p>This filter drops the first <tt class="docutils literal">n</tt> characters off every line of code.  This
 
319
may be useful when the source code fed to the lexer is indented by a fixed
 
320
amount of space that isn't desired in the output.</p>
 
321
<p>Options accepted:</p>
 
322
<dl class="docutils">
 
323
<dt><cite>n</cite> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
 
324
<dd>The number of characters to gobble.</dd>
 
325
</dl>
 
326
<p><em>New in Pygments 1.2.</em></p>
 
327
<table class="docutils field-list" frame="void" rules="none">
 
328
<col class="field-name" />
 
329
<col class="field-body" />
 
330
<tbody valign="top">
 
331
<tr class="field"><th class="field-name">Name:</th><td class="field-body">gobble</td>
 
332
</tr>
 
333
</tbody>
 
334
</table>
 
335
</blockquote>
245
336
<p><cite>NameHighlightFilter</cite></p>
246
337
<blockquote>
247
338
<p>Highlight a normal Name token with a different token type.</p>
280
371
<dl class="docutils">
281
372
<dt><cite>codetags</cite> <span class="classifier-delimiter">:</span> <span class="classifier">list of strings</span></dt>
282
373
<dd>A list of strings that are flagged as code tags.  The default is to
283
 
highlight <tt class="docutils literal"><span class="pre">XXX</span></tt>, <tt class="docutils literal"><span class="pre">TODO</span></tt>, <tt class="docutils literal"><span class="pre">BUG</span></tt> and <tt class="docutils literal"><span class="pre">NOTE</span></tt>.</dd>
 
374
highlight <tt class="docutils literal">XXX</tt>, <tt class="docutils literal">TODO</tt>, <tt class="docutils literal">BUG</tt> and <tt class="docutils literal">NOTE</tt>.</dd>
284
375
</dl>
285
376
<table class="docutils field-list" frame="void" rules="none">
286
377
<col class="field-name" />
291
382
</tbody>
292
383
</table>
293
384
</blockquote>
294
 
<p><cite>RaiseOnErrorTokenFilter</cite></p>
295
 
<blockquote>
296
 
<p>Raise an exception when the lexer generates an error token.</p>
297
 
<p>Options accepted:</p>
298
 
<dl class="docutils">
299
 
<dt><cite>excclass</cite> <span class="classifier-delimiter">:</span> <span class="classifier">Exception class</span></dt>
300
 
<dd>The exception class to raise.
301
 
The default is <cite>pygments.filters.ErrorToken</cite>.</dd>
302
 
</dl>
303
 
<p><em>New in Pygments 0.8.</em></p>
304
 
<table class="docutils field-list" frame="void" rules="none">
305
 
<col class="field-name" />
306
 
<col class="field-body" />
307
 
<tbody valign="top">
308
 
<tr class="field"><th class="field-name">Name:</th><td class="field-body">raiseonerror</td>
309
 
</tr>
310
 
</tbody>
311
 
</table>
312
 
</blockquote>
313
385
<p><cite>KeywordCaseFilter</cite></p>
314
386
<blockquote>
315
387
<p>Convert keywords to lowercase or uppercase or capitalize them, which
319
391
<p>Options accepted:</p>
320
392
<dl class="docutils">
321
393
<dt><cite>case</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string</span></dt>
322
 
<dd>The casing to convert keywords to. Must be one of <tt class="docutils literal"><span class="pre">'lower'</span></tt>,
323
 
<tt class="docutils literal"><span class="pre">'upper'</span></tt> or <tt class="docutils literal"><span class="pre">'capitalize'</span></tt>.  The default is <tt class="docutils literal"><span class="pre">'lower'</span></tt>.</dd>
 
394
<dd>The casing to convert keywords to. Must be one of <tt class="docutils literal">'lower'</tt>,
 
395
<tt class="docutils literal">'upper'</tt> or <tt class="docutils literal">'capitalize'</tt>.  The default is <tt class="docutils literal">'lower'</tt>.</dd>
324
396
</dl>
325
397
<table class="docutils field-list" frame="void" rules="none">
326
398
<col class="field-name" />
331
403
</tbody>
332
404
</table>
333
405
</blockquote>
334
 
<p><cite>VisibleWhitespaceFilter</cite></p>
335
 
<blockquote>
336
 
<p>Convert tabs, newlines and/or spaces to visible characters.</p>
337
 
<p>Options accepted:</p>
338
 
<dl class="docutils">
339
 
<dt><cite>spaces</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
340
 
<dd>If this is a one-character string, spaces will be replaces by this string.
341
 
If it is another true value, spaces will be replaced by <tt class="docutils literal"><span class="pre">·</span></tt> (unicode
342
 
MIDDLE DOT).  If it is a false value, spaces will not be replaced.  The
343
 
default is <tt class="docutils literal"><span class="pre">False</span></tt>.</dd>
344
 
<dt><cite>tabs</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
345
 
<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal"><span class="pre">»</span></tt>
346
 
(unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK).  The default value
347
 
is <tt class="docutils literal"><span class="pre">False</span></tt>.  Note: this will not work if the <cite>tabsize</cite> option for the
348
 
lexer is nonzero, as tabs will already have been expanded then.</dd>
349
 
<dt><cite>tabsize</cite> <span class="classifier-delimiter">:</span> <span class="classifier">int</span></dt>
350
 
<dd>If tabs are to be replaced by this filter (see the <cite>tabs</cite> option), this
351
 
is the total number of characters that a tab should be expanded to.
352
 
The default is <tt class="docutils literal"><span class="pre">8</span></tt>.</dd>
353
 
<dt><cite>newlines</cite> <span class="classifier-delimiter">:</span> <span class="classifier">string or bool</span></dt>
354
 
<dd>The same as for <cite>spaces</cite>, but the default replacement character is <tt class="docutils literal"><span class="pre">¶</span></tt>
355
 
(unicode PILCROW SIGN).  The default value is <tt class="docutils literal"><span class="pre">False</span></tt>.</dd>
356
 
<dt><cite>wstokentype</cite> <span class="classifier-delimiter">:</span> <span class="classifier">bool</span></dt>
357
 
<dd>If true, give whitespace the special <cite>Whitespace</cite> token type.  This allows
358
 
styling the visible whitespace differently (e.g. greyed out), but it can
359
 
disrupt background colors.  The default is <tt class="docutils literal"><span class="pre">True</span></tt>.</dd>
360
 
</dl>
361
 
<p><em>New in Pygments 0.8.</em></p>
362
 
<table class="docutils field-list" frame="void" rules="none">
363
 
<col class="field-name" />
364
 
<col class="field-body" />
365
 
<tbody valign="top">
366
 
<tr class="field"><th class="field-name">Name:</th><td class="field-body">whitespace</td>
367
 
</tr>
368
 
</tbody>
369
 
</table>
370
 
</blockquote>
371
406
</div>
372
407
 
373
408
  </div>
374
409
</body>
375
 
<!-- generated on: 2009-09-15 12:36:52.182079
 
410
<!-- generated on: 2010-01-02 22:27:12.534561
376
411
     file id: filters -->
377
412
</html>
 
 
b'\\ No newline at end of file'