wikiprocessors
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | wikiprocessors [2015/06/09 15:23] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Wiki Processors ====== | ||
+ | |||
+ | Processors are WikiMacros designed to provide alternative markup formats for the [[: | ||
+ | |||
+ | The Wiki engine uses processors to allow using [[WikiRestructuredText|Restructured Text]], [[WikiHtml|raw HTML]] and [[http:// | ||
+ | |||
+ | |||
+ | ===== Using Processors ===== | ||
+ | |||
+ | To 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. | ||
+ | |||
+ | **Example 1** (// | ||
+ | |||
+ | < | ||
+ | #!html | ||
+ | <pre class=" | ||
+ | #!html | ||
+ | <h1 style=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Results in:** | ||
+ | < | ||
+ | #!html | ||
+ | <h1 style=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | **Example 2** (// | ||
+ | |||
+ | < | ||
+ | #!html | ||
+ | <pre class=" | ||
+ | #!rst | ||
+ | A header | ||
+ | -------- | ||
+ | This is some **text** with a footnote [[:*]]_. | ||
+ | |||
+ | .. [[:*]] This is the footnote. | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Results in:** | ||
+ | < | ||
+ | #!rst | ||
+ | A header | ||
+ | -------- | ||
+ | This is some **text** with a footnote [[:*]]_. | ||
+ | |||
+ | .. [[:*]] This is the footnote. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | **Example 3** (// | ||
+ | |||
+ | < | ||
+ | #!html | ||
+ | <pre class=" | ||
+ | #!c | ||
+ | int main(int argc, char *argv[]) | ||
+ | { | ||
+ | printf(" | ||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Results in:** | ||
+ | < | ||
+ | #!c | ||
+ | int main(int argc, char *argv[]) | ||
+ | { | ||
+ | printf(" | ||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Available Processors ===== | ||
+ | The following processors are included in the Trac distribution: | ||
+ | * **html** -- Insert custom HTML in a wiki page. See WikiHtml. | ||
+ | * **rst** -- Trac support for Restructured Text. See WikiRestructuredText. | ||
+ | * **textile** -- Supported if [[http:// | ||
+ | |||
+ | Textile link above is rotten. [[http:// | ||
+ | |||
+ | ==== Code Highlighting Support ==== | ||
+ | Trac includes processors to provide inline [[: | ||
+ | * **c** -- C | ||
+ | * **cpp** -- C++ | ||
+ | * **python** -- Python | ||
+ | * **perl** -- Perl | ||
+ | * **ruby** -- Ruby | ||
+ | * **php** -- PHP | ||
+ | * **asp** --- ASP | ||
+ | * **sql** -- SQL | ||
+ | * **xml** -- XML | ||
+ | **Note:** //Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.// | ||
+ | |||
+ | By 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: | ||
+ | < | ||
+ | < | ||
+ | #!text/html | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | The result will be syntax highlighted HTML code. The same is valid for all other mime types supported. | ||
+ | |||
+ | |||
+ | For more processor macros developed and/or contributed by users, visit: | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | ===== Advanced Topics: Developing Processor Macros ===== | ||
+ | Developing processors is no different from WikiMacros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information. | ||
+ | |||
+ | **Example: | ||
+ | < | ||
+ | #!python | ||
+ | from docutils.core import publish_string | ||
+ | |||
+ | def execute(hdf, | ||
+ | html = publish_string(text, | ||
+ | return html[[: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | See also: WikiMacros, WikiHtml, WikiRestructuredText, | ||
wikiprocessors.txt · Last modified: 2015/06/09 15:23 by 127.0.0.1