Edgewall Software

Changes between Initial Version and Version 1 of 0.11/WikiProcessors


Ignore:
Timestamp:
Apr 10, 2010, 7:39:50 PM (14 years ago)
Author:
Christian Boos
Comment:

archiving wiki:/WikiProcessors@44

Legend:

Unmodified
Added
Removed
Modified
  • 0.11/WikiProcessors

    v1 v1  
     1= Wiki Processors =
     2
     3Processors are WikiMacros designed to provide alternative markup formats for the [TracWiki Wiki engine]. Processors can be thought of as ''macro functions to process user-edited text''.
     4
     5The Wiki engine uses processors to allow using [wiki:WikiRestructuredText Restructured Text], [wiki:WikiHtml raw HTML] and [http://www.textism.com/tools/textile/ textile] in any Wiki text throughout Trac.
     6
     7
     8== Using Processors ==
     9
     10To use a processor on a block of text, use a Wiki code block, selecting a processor by name using ''shebang notation'' (#!), familiar to most UNIX users from scripts.
     11
     12'''Example 1''' (''inserting raw HTML in a wiki text''):
     13
     14{{{
     15{{{
     16#!html
     17<h1 style="color: orange">This is raw HTML</h1>
     18}}}
     19}}}
     20
     21'''Results in:'''
     22{{{
     23#!html
     24<h1 style="color: orange">This is raw HTML</h1>
     25}}}
     26
     27Note that since 0.11, such blocks of HTML have to be self-contained, i.e. you can't start an HTML element in one block and close it later in a second block. Use div or span processors for achieving similar effect (see WikiHtml).
     28
     29----
     30
     31'''Example 2''' (''inserting Restructured Text in wiki text''):
     32
     33{{{
     34{{{
     35#!rst
     36A header
     37--------
     38This is some **text** with a footnote [*]_.
     39
     40.. [*] This is the footnote.
     41}}}
     42}}}
     43
     44'''Results in:'''
     45{{{
     46#!rst
     47A header
     48--------
     49This is some **text** with a footnote [*]_.
     50
     51.. [*] This is the footnote.
     52}}}
     53----
     54'''Example 3''' (''inserting a block of C source code in wiki text''):
     55
     56{{{
     57{{{
     58#!c
     59int main(int argc, char *argv[])
     60{
     61  printf("Hello World\n");
     62  return 0;
     63}
     64}}}
     65}}}
     66
     67'''Results in:'''
     68{{{
     69#!c
     70int main(int argc, char *argv[])
     71{
     72  printf("Hello World\n");
     73  return 0;
     74}
     75}}}
     76
     77----
     78'''Example 4''' (''Searching from a wiki page by custom field. Allows user to reuse most common searches on a wiki page''):
     79
     80{{{
     81{{{
     82#!html
     83<form action="/query" method="get">
     84<input type="text" name="keywords" value="~" size="30"> <input type="submit" value="Search by Keywords#">
     85<!-- To control what fields show up use hidden fields
     86<input type="hidden" name="col" value="id">
     87<input type="hidden" name="col" value="summary">
     88<input type="hidden" name="col" value="status">
     89<input type="hidden" name="col" value="milestone">
     90<input type="hidden" name="col" value="version">
     91<input type="hidden" name="col" value="owner">
     92<input type="hidden" name="col" value="priority">
     93<input type="hidden" name="col" value="component">
     94-->
     95</form>
     96}}}
     97}}}
     98
     99
     100''' Result:'''
     101{{{
     102#!html
     103<form action="/query" method="get">
     104<input type="text" name="keywords" value="~" size="30"> <input type="submit" value="Search by Keywords#">
     105<!-- To control what fields show up use hidden fields
     106<input type="hidden" name="col" value="id">
     107<input type="hidden" name="col" value="summary">
     108<input type="hidden" name="col" value="status">
     109<input type="hidden" name="col" value="milestone">
     110<input type="hidden" name="col" value="version">
     111<input type="hidden" name="col" value="owner">
     112<input type="hidden" name="col" value="priority">
     113<input type="hidden" name="col" value="component">
     114-->
     115</form>
     116}}}
     117
     118
     119----
     120
     121== Available Processors ==
     122The following processors are included in the Trac distribution:
     123 * '''html''' -- Insert custom HTML in a wiki page. See WikiHtml.
     124 * '''div''' -- Wrap an arbitrary Wiki content in a <div> element (''since 0.11''). See WikiHtml.
     125 * '''span''' -- Wrap an arbitrary Wiki content in a <span> element (''since 0.11''). See also WikiHtml.
     126 * '''rst''' -- Trac support for Restructured Text. See WikiRestructuredText.
     127 * '''textile''' -- Supported if [http://cheeseshop.python.org/pypi/textile Textile] is installed. See [http://www.textism.com/tools/textile/ a Textile reference].
     128 * '''comment''' -- Do not process the text in this section (i.e. contents exist only in the plain text that can be viewed when editing the wiki page content - not in the rendered page).
     129 * '''diff''' -- Pretty print patches and diffs.
     130
     131=== Code Highlighting Support ===
     132Trac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for the following languages:
     133 * '''c''' -- C
     134 * '''cpp''' -- C++
     135 * '''csharp''' --- C#
     136 * '''python''' -- Python
     137 * '''perl''' -- Perl
     138 * '''ruby''' -- Ruby
     139 * '''php''' -- PHP
     140 * '''asp''' -- ASP
     141 * '''java''' -- Java
     142 * '''js''' -- Javascript
     143 * '''sql''' -- SQL
     144 * '''xml''' -- XML
     145 * '''sh''' -- Bourne/Bash shell
     146
     147'''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.''
     148
     149By using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code. For example, you can write:
     150{{{
     151{{{
     152#!text/html
     153<h1>text</h1>
     154}}}
     155}}}
     156
     157The result will be syntax highlighted HTML code:
     158{{{
     159#!text/html
     160<h1>text</h1>
     161}}}
     162
     163The same is valid for all other [TracSyntaxColoring#SyntaxColoringSupport mime types supported].
     164
     165
     166For more processor macros developed and/or contributed by users, visit:
     167 * [trac:ProcessorBazaar]
     168 * [trac:MacroBazaar]
     169 * [th:WikiStart Trac Hacks] community site
     170
     171
     172== Advanced Topics: Developing Processor Macros ==
     173Developing processors is no different from Wiki macros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information.
     174
     175
     176----
     177See also: WikiMacros, WikiHtml, WikiRestructuredText, TracSyntaxColoring, WikiFormatting, TracGuide