= The Processor Bazaar {{{#!box warn **THIS PAGE IS DEPRECATED:** It will be removed after 01 July 2015. If you are the author of a macro listed here, please move it to more suitable hosting. [http://trac-hacks.org trac-hacks.org] provides free hosting for TracPlugins, WikiProcessors and WikiMacros. }}} Looking for fresh wiki processor goodness for your Trac installation? Have you written a clever wiki-processor you're dying to share with the world? This is the place. This wiki-processor bazaar is for sharing information about user-developed processors and links to source code and requests. '''Note:''' ''Please state your name, email and version of Trac your wiki-processor is developed for.'' == How to use these wiki-processors * Just put the files into the {{{wikimacros}}} directory of your Python installation, e.g. {{{/usr/lib/python2.3/site-packages/trac/wikimacros}}} (for ''0.10'', this might be `/usr/lib/python2.?/site-packages/trac/mimeview`). The macros will then be available for all your Trac environments. * Alternatively, put the files into the {{{wiki-macros}}} directory of your Trac environment, e.g. {{{/data/trac/wiki-macros}}} or for 0.11 into the {{{plugins}}} directory of your Trac environment. The macros will be available only for this environment. The wiki-processors should match your trac version, ie 0.11 uses {{{class YourCustomMacro(WikiMacroBase)}}} where previous version used {{{def execute(hdf, txt, env)}}}. See wiki:WikiMacros for details. ---- === !LegendBox === A wiki-processor for encapsulating wiki text inside a box. The box will have a legend and a modifiable color. To use this, simply place it into wikimacro directory and use it. Example: {{{ {{{ #!LegendBox #!color: blue #!legend: My Title Here comes the actual text that will be inside the box. You can even use wiki-formatting in here. }}} }}} You can modify the default ''COLOR'' and ''LEGEND'' and the ''STYLE'' in the plugin file. [[BR]]''Download:'' [attachment:LegendBox.py] [[BR]]''By:'' Jan Finell (finell at cenix-bioscience.com) [[BR]]''Required ver:'' > 0.8pre (though changing the import of the ''wiki_to_html'' function will make it work on older versions) For version 0.9pre2, I could not use the version above, some things have changed. The version below works for me. [[BR]]''Download:'' [attachment:LegendBox-0.9pre2.py] [[BR]]''By:'' Pedro Melo (melo at simplicidade.org) [[BR]]''Required ver:'' > 0.9pre2 For Trac version 0.10: [[BR]]''Download:'' [attachment:LegendBox-0.10.py] [[BR]]''By:'' Lars Stavholm (stava at linadd.org) [[BR]]''Required ver:'' >= 0.10 For Trac version 0.11: [[BR]]''Download:'' [attachment:LegendBox-0.11.2.py] [[BR]]''By:'' Lars Stavholm (stava at linadd.org) modified by cboos [[BR]]''Required ver:'' >= 0.11 For Trac version 0.12: [[BR]]''Download:'' [attachment:LegendBox-0.12.py] [[BR]]''By:'' Lars Stavholm (stava at linadd.org) modified by cboos [[BR]]''Required ver:'' >= 0.12-r8372 With the 0.12 version, the legend box can also be used like this: {{{ {{{ #!LegendBox color=blue legend="My Title" Here comes the actual text that will be inside the box. You can even use wiki-formatting in here. }}} }}} ---- === Striped === A Trac wiki-processor to display text as a striped listing. The output is enclosed in a {{{
}}} block of class "striped",
and each line in a {{{
}}} block of alternating "even-stripe" and "odd-stripe" classes. You '''must''' set this classes up in your {{{templates/site_css.cs}}} file, or alternatively use the processor arguments "box-style", "even-style" and "odd-style". The "number" argument allows automatic numbering of lines; it accepts three args: a Python-style format (quotes and all), the initial number for the first line, and the step between numbers. If no format is passed, there is no automatic numbering; otherwise, the start and step arguments default to 1. Example: {{{ {{{ #!Striped #!number: " %3d ", 100, 10 #!box-style: border: thick solid #C0C0C0; margin: 20px; width: 70%; #!even-style: background-color: #DAC0DA; ...text here... }}} }}} (A lot of ideas and syntax for arguments shamelessly stolen from previous entry by Jan Finell. Thanks!) [[BR]] [[BR]]''Download:'' [attachment:Striped.py] [[BR]]''By:'' Juanma Barranquero (lekktu at gmail.com) [[BR]]''Tested on:'' 0.8 (should work on previous versions, though) ---- === !DocBook ===#docbook A [http://docbook.org/ DocBook] WikiProcessor. Requires: * libxml2-python (developed with version 2.6.11) * libxslt-python (developed with version 1.1.8) Specify "stylesheet" under the "docbook" section in your trac.ini, for example: {{{ [docbook] stylesheet = /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl }}} Include DocBook mark-up in a wiki blockquote, with the docbook processor selected: {{{ {{{ #!docbook ...DocBook mark-up here... }}} }}} [[BR]]''Download:'' [attachment:docbook.py] [[BR]]''By:'' Simon Ward [[BR]]''Version:'' 0.8.x [[BR]] [[BR]] If you have problems with an error message like 'get_config is not supported' try: stylesheet = env.config.get('docbook', 'stylesheet') ---- === !SortedTable === A WikiProcessor which sorts tables with JavaScript. Requires [http://www.kryogenix.org/code/browser/sorttable/sorttable.js sorttable.js]. Usage: 1. Fetch [http://www.kryogenix.org/code/browser/sorttable/sorttable.js sorttable.js] (see above) 1. Put the script somewhere on your HTTP server and set the variable sorttable_js_url in TracIni OR put the JavaScript file in the same directory as the Python file. 1. Use WikiProcessor syntax like: {{{ {{{ #!sortedtable || Strings || Numbers || || abc || 2 || || def || 10 || || abd || 9 || }}} }}} Use the usual table syntax for wiki pages. 1. If the browser has JavaScript enabled, you will be able to sort the resulting table by clicking on the headings in the first row. [[BR]]''Download:'' http://www.sschwarzer.net/download/sortedtable.py [[BR]]''By:'' Stefan Schwarzer (sschwarzer at sschwarzer dot net) [[BR]]''Version:'' >= 0.8 (tested with 0.8) ---- === !IrcLog === A WikiProcessor that colourises IRC logs. To use, import the stylesheets in your {{{$TRAC_ENV/templates/site_css.cs}}} and mark-up your IRC text as follows: {{{ {{{ #!irclog ... }}} }}} It formats logs in the default format used by Xchat, as well as some others. The irclog processor is distributable under the terms of the [http://www.gnu.org/copyleft/gpl.html GNU GPL]. Based on [http://mg.pov.lt/irclog2html/ irclog2html.py] by Marius Gedminas. [[BR]]''Download:'' http://projects.bleah.co.uk/misc/browser/tracirclog/trunk [[BR]]''By:'' Simon Ward [[BR]]''Version:'' 0.8.x ---- === !BlockQuote === A simple processor that wraps the processed text in blockquote tags. While Trac [wiki:WikiFormatting#Blockquotes provides] markup for blockquotes, a processor appears to be easier to use for larger quotes. Usage: {{{ {{{ #!blockquote This is the text that goes between the blockquote tags. Even WikiFormatting works. You might want to add custom CSS for blockquotes... }}} }}} A working example can be seen [http://madwifi.org/wiki/WikiBlockQuote here]. ''Download:'' [attachment:blockquote-0.1.1.py] [[BR]]''By:'' Michael Renzmann [[BR]]''Version:'' 0.9b2 (might work with older versions as well) [[BR]]''Last change:'' v0.1.1 now correctly handles WikiFormatting in quoted texts ---- === graphviz === A processor that uses Graphviz' dot to make graphs. Usage: {{{ {{{ #!graphviz digraph G { A [color = green]; A -> B -> C -> A C -> B } }}} }}} ''Version:'' >= 0.8 [[BR]]''Download:'' [attachment:graphviz.py] [[BR]]''By:'' Vegard Eriksen zyp at jvnv dot net '''Note:''' A much more powerful Graphviz processor is available [http://trac-hacks.org/wiki/GraphvizPlugin here]. ---- === latex-math === A processor that uses LaTeX to make math. Loosely based on graphviz.py and mt-math. Usage: {{{ {{{ #!latex-math E=mc^2 }}} }}} ''Version:'' >= svn162 [[BR]]''Download:'' https://svn.truelite.it/packages/browser/trunk/truelite-trac-utils/ [[BR]] and [[BR]] https://svn.truelite.it/packages/file/trunk/truelite-trac-utils/wiki-macros/latex-math.py [[BR]]''By:'' Mirko Maischberger mirko dot maischberger at gmail dot com '''Note:''' This spawns a latex process, so you'll need tetex, tetex-extra and dvipng. This is not suitable for public wikis, because spawning an external latex process is not secure when not properly configured. ---- === !ShellExample === A processor that produces [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=5 Gentoo-like document code listing]. Usage: {{{ {{{ #!ShellExample ~ $ make (becomes root and install) ~ $ su ~ # make install }}} }}} ''Requires Trac Version:'' >= 0.12 (maybe 0.11, not yet tested) [[BR]]''Download:'' http://trac-hacks.org/wiki/ShellExampleMacro [[BR]]''By:'' Nathaniel Madura (nmadura at umich dot edu) [[BR]]''Current Version:'' 0.12.1 ---- === code highlighting === A simple processor (deployed as plugin) that uses predefined processor to make highlighted output of arbitrary source code. This language of the source code is pass as file extension (like `css` for CSS) instead of mimetype. ,,You have to use an additional code highlighting processor such as '''Pygments''',, Usage: {{{ {{{ #!code(lang=css) div.lang-name-template { margin: -1em 1.75em 1em 1.75em; background: #F7F7F7; text-align: right; padding-right: 0.5em; border-style: solid; border-color: #D7D7D7; border-width: 0 1px 1px 1px; } }}} }}} This will produce: [[Image(code-processor.png)]] ''Download:'' [https://svn.mayastudios.de/mtpp/wiki/Plugins/CodeProcessor] [[BR]]''By:'' Sebastian Krysmanski [[BR]]''Version:'' Runs on Trac 0.11.x ---- === Pascal === A simple processor that uses predefined processor to make highlighted output of the Pascal source code.[[BR]] ,,You have to use additional code highlighting processor such as '''enscript''',, Usage: {{{ {{{ #!pascal procedure Example(const A, B : byte); begin if (A=B) then for i:=0 to 25 do begin WriteLn('Example'); end; end; }}} }}} This will produce: {{{ #!html
procedure Example(const A, B : byte);
begin
    if (A=B) then for i:=0 to 25 do begin
        WriteLn('Example');
    end;
end;
}}} ''Download:'' [attachment:pascal-0.0.1.py] [[BR]]''By:'' SHadoW [[BR]]''Version:'' 0.0.1 Tested on trac 0.10 but should work on older versions ---- == Requests == ''Requests, comments, etc go here.'' * Request: A WikiProcessor for SVG [http://www.svg-whiz.com/wiki/index.php?title=SVG_FAQ] * Request: A WikiProcessor for mediawiki format (see [http://trac-hacks.org/wiki/MediaWikiPluginMacro]) * Request: A WikiProcessor for [http://www.twiki.org twiki] format - so we can move existing docs to Trac * Request: A WikiProcessor for [http://daringfireball.net/projects/markdown/ markdown] * Request: A WikiProcessor for Perl's POD * Request: A WikiProcessor for Java Stacktraces (with links into subversion repository, if possible ;) ) * Request: A WikiProcessor for [http://orgmode.org/ org-mode syntax] * ~~Request: A WikiProcessor for VERILOG HDL syntax highlighting~~ Supported by [http://pygments.org/languages/ Pygments] * ~~Request: A WikiProcessor for Apache2 config~~ Supported by [http://pygments.org/languages/ Pygments] * ~~Request: A WikiProcessor for Haskell syntax highlighting~~ Supported by [http://pygments.org/languages/ Pygments] * ~~Request: A WikiProcessor for unified diffs~~ ''(it's already there since 0.9: use `#!diff` in your block)'' * ~~Request: A WikiProcessor for javascript syntax highlighting~~ * ~~Request: A WikiProcessor for GLSL (OpenGL Shading Language, should be a lot like C, just with different types and keywords)~~ Supported by [http://pygments.org/languages/ Pygments] ---- See also: WikiProcessors