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>
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>
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" />
259
<tr class="field"><th class="field-name">Name:</th><td class="field-body">raiseonerror</td>
264
<p><cite>VisibleWhitespaceFilter</cite></p>
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>
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" />
296
<tr class="field"><th class="field-name">Name:</th><td class="field-body">whitespace</td>
301
<p><cite>TokenMergeFilter</cite></p>
303
<p>Merges consecutive tokens with the same token type in the output stream of a
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" />
310
<tr class="field"><th class="field-name">Name:</th><td class="field-body">tokenmerge</td>
315
<p><cite>GobbleFilter</cite></p>
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>
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" />
331
<tr class="field"><th class="field-name">Name:</th><td class="field-body">gobble</td>
245
336
<p><cite>NameHighlightFilter</cite></p>
247
338
<p>Highlight a normal Name token with a different token type.</p>
294
<p><cite>RaiseOnErrorTokenFilter</cite></p>
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>
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" />
308
<tr class="field"><th class="field-name">Name:</th><td class="field-body">raiseonerror</td>
313
385
<p><cite>KeywordCaseFilter</cite></p>
315
387
<p>Convert keywords to lowercase or uppercase or capitalize them, which
334
<p><cite>VisibleWhitespaceFilter</cite></p>
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>
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" />
366
<tr class="field"><th class="field-name">Name:</th><td class="field-body">whitespace</td>
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 -->
b'\\ No newline at end of file'