Changes between Initial Version and Version 1 of WikiProcessors


Ignore:
Timestamp:
07/21/2005 09:40:26 AM (14 years ago)
Author:
Wilson Miner
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiProcessors

    v1 v1  
     1= Wiki Processors =
     2Processors are WikiMacros designed to provide alternative markup formats for the Trac Wiki engine. Processors can be thought of as ''macro functions to process user-edited text''.
     3
     4The wiki engine uses processors to allow using [wiki:WikiRestructuredText Restructured Text] and [wiki:WikiHtml raw HTML] in any wiki text throughout Trac.
     5
     6== Using Processors ==
     7To use a processor on a block of text, use a wiki blockquote, selecting a processor by name using 'hashbang notation' (#!), familiar to most UNIX users from scripts.
     8
     9'''Example 1''' (''inserting raw HTML in a wiki text''):
     10
     11{{{
     12#!html
     13<pre class="wiki">{{{
     14#!html
     15&lt;h1 style="color: orange"&gt;This is raw HTML&lt;/h1&gt;
     16}}}</pre>
     17}}}
     18
     19'''Results in:'''
     20{{{
     21#!html
     22<h1 style="color: orange">This is raw HTML</h1>
     23}}}
     24
     25----
     26
     27'''Example 2''' (''inserting Restructured Text in wiki text''):
     28
     29{{{
     30#!html
     31<pre class="wiki">{{{
     32#!rst
     33A header
     34--------
     35This is some **text** with a footnote [*]_.
     36
     37.. [*] This is the footnote.
     38}}}</pre>
     39}}}
     40
     41'''Results in:'''
     42{{{
     43#!rst
     44A header
     45--------
     46This is some **text** with a footnote [*]_.
     47
     48.. [*] This is the footnote.
     49}}}
     50----
     51'''Example 3''' (''inserting a block of C source code in wiki text''):
     52
     53{{{
     54#!html
     55<pre class="wiki">{{{
     56#!c
     57int main(int argc, char *argv[])
     58{
     59  printf("Hello World\n");
     60  return 0;
     61}
     62}}}</pre>
     63}}}
     64
     65'''Results in:'''
     66{{{
     67#!c
     68int main(int argc, char *argv[])
     69{
     70  printf("Hello World\n");
     71  return 0;
     72}
     73}}}
     74
     75----
     76
     77
     78
     79== Available Processors ==
     80The following processors are included in the Trac distribution:
     81 * '''html''' -- Insert custom HTML in a wiki page. See WikiHtml.
     82 * '''rst''' -- Trac support for Restructured Text. See WikiRestructuredText.
     83
     84=== Source Code Support ===
     85Trac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for these languages:
     86 * '''c''' -- C
     87 * '''cpp''' -- C++
     88 * '''python''' -- Python
     89 * '''perl''' -- Perl
     90 * '''ruby''' -- Ruby
     91 * '''php''' -- PHP
     92 * '''asp''' --- ASP
     93 * '''sql''' -- SQL
     94 * '''xml''' -- XML
     95'''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.''
     96
     97
     98For more processor macros developed and/or contributed by users, visit the processor bazaar:
     99 http://projects.edgewall.com/trac/wiki/ProcessorBazaar
     100
     101----
     102== Advanced Topics: Developing Processor Macros ==
     103Developing processors is no different than WikiMacros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information.
     104
     105'''Example:''' (''Restructured Text Processor''):
     106{{{
     107from docutils.core import publish_string
     108
     109def execute(hdf, text):
     110    html = publish_string(text, writer_name = 'html')
     111    return html[html.find('<body>')+6:html.find('</body>')].strip()
     112}}}
     113
     114----
     115See also: WikiMacros, WikiHtml, WikiRestructuredText, TracSyntaxColoring, WikiFormatting, TracGuide
Back to Top