https://t2bwiki.iihe.ac.be/index.php?title=WikiProcessors&feed=atom&action=historyWikiProcessors - Revision history2024-03-29T12:23:47ZRevision history for this page on the wikiMediaWiki 1.41.0https://t2bwiki.iihe.ac.be/index.php?title=WikiProcessors&diff=361&oldid=prevMaintenance script: Created page with " == Wiki Processors == Processors are WikiMacros designed to provide alternative markup formats for the [TracWiki Wiki engine]. Processors can be thought of as ''macro functi..."2015-08-26T12:29:30Z<p>Created page with " == Wiki Processors == Processors are WikiMacros designed to provide alternative markup formats for the [TracWiki Wiki engine]. Processors can be thought of as ''macro functi..."</p>
<p><b>New page</b></p><div><br />
== Wiki Processors ==<br />
<br />
Processors 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''. <br />
<br />
Wiki processors can be used in any Wiki text throughout Trac,<br />
for various different purposes, like:<br />
- [#CodeHighlightingSupport syntax highlighting] or for rendering text verbatim,<br />
- rendering [#HTMLrelated Wiki markup inside a context], <br />
like inside <div> blocks or <span> or within <td> or <th> table cells,<br />
- using an alternative markup syntax, like [[WikiHtml| raw HTML]] and<br />
[[WikiRestructuredText| Restructured Text]],<br />
or [http://www.textism.com/tools/textile/ textile]<br />
<br />
<br />
=== Using Processors ===<br />
<br />
To use a processor on a block of text, first delimit the lines using<br />
a Wiki ''code block'':<br />
<pre><br />
<pre><br />
The lines<br />
that should be processed...<br />
</pre><br />
</pre><br />
<br />
Immediately after the <tt><pre></tt> or on the line just below, <br />
add <tt>#!</tt> followed by the ''processor name''.<br />
<br />
<pre><br />
<pre><br />
#processorname<br />
The lines<br />
that should be processed...<br />
</pre><br />
</pre><br />
<br />
This is the "shebang" notation, familiar to most UNIX users.<br />
<br />
Besides their content, some Wiki processors can also accept ''parameters'',<br />
which are then given as <tt>key=value</tt> pairs after the processor name, <br />
on the same line. If <tt>value</tt> has to contain space, as it's often the case for<br />
the style parameter, a quoted string can be used (<tt>key="value with space"</tt>).<br />
<br />
As some processors are meant to process Wiki markup, it's quite possible to<br />
''nest'' processor blocks.<br />
You may want to indent the content of nested blocks for increased clarity,<br />
this extra indentation will be ignored when processing the content.<br />
<br />
<br />
=== Examples ===<br />
<br />
{| border=1 class="simple"<br />
!= Wiki Markup =<br />
!= Display =<br />
|}<br />
<br />
<pre>#td colspan=2 align=center style="border: none"<br />
<br />
<u>Example 1</u>: Inserting raw HTML<br />
</pre><br />
|-----------------------------------------------------------------<br />
<pre>#td style="border: none"<br />
<pre><br />
<pre><br />
<h1 style="color: grey">This is raw HTML</h1><br />
</pre><br />
</pre><br />
</pre><br />
<pre>#td valign=top style="border: none; padding-left: 2em"<br />
<pre><br />
#html<br />
<h1 style="color: grey">This is raw HTML</h1><br />
</pre><br />
</pre><br />
|-----------------------------------------------------------------<br />
<pre>#td colspan=2 align=center style="border: none"<br />
<br />
<u>Example 2</u>: Highlighted Python code in a <div> block with custom style<br />
</pre><br />
|-----------------------------------------------------------------<br />
<pre>#td style="border: none"<br />
<pre><br />
<pre>#div style="background: #ffd; border: 3px ridge"<br />
<br />
This is an example of embedded "code" block:<br />
<br />
<pre><br />
#python<br />
def hello():<br />
return "world"<br />
</pre><br />
<br />
</pre><br />
</pre><br />
</pre><br />
<pre>#td valign=top style="border: none; padding: 1em"<br />
<pre>#div style="background: #ffd; border: 3px ridge"<br />
<br />
This is an example of embedded "code" block:<br />
<br />
<pre><br />
#python<br />
def hello():<br />
return "world"<br />
</pre><br />
<br />
</pre><br />
</pre><br />
|-----------------------------------------------------------------<br />
<pre>#td colspan=2 align=center style="border: none"<br />
<br />
<u>Example 3</u>: Searching tickets from a wiki page, by keywords.<br />
</pre><br />
|-----------------------------------------------------------------<br />
<pre>#td style="border: none"<br />
<pre><br />
<pre><br />
#html<br />
<form action="/query" method="get"><br />
<input type="text" name="keywords" value="~" size="30"><br />
<input type="submit" value="Search by Keywords"><br />
<!-- To control what fields show up use hidden fields<br />
<input type="hidden" name="col" value="id"><br />
<input type="hidden" name="col" value="summary"><br />
<input type="hidden" name="col" value="status"><br />
<input type="hidden" name="col" value="milestone"><br />
<input type="hidden" name="col" value="version"><br />
<input type="hidden" name="col" value="owner"><br />
<input type="hidden" name="col" value="priority"><br />
<input type="hidden" name="col" value="component"><br />
--><br />
</form><br />
</pre><br />
</pre><br />
</pre><br />
<pre>#td valign=top style="border: none; padding: 1em"<br />
<pre><br />
#html<br />
<form action="/query" method="get"><br />
<input type="text" name="keywords" value="~" size="30"><br />
<input type="submit" value="Search by Keywords"><br />
<!-- To control what fields show up use hidden fields<br />
<input type="hidden" name="col" value="id"><br />
<input type="hidden" name="col" value="summary"><br />
<input type="hidden" name="col" value="status"><br />
<input type="hidden" name="col" value="milestone"><br />
<input type="hidden" name="col" value="version"><br />
<input type="hidden" name="col" value="owner"><br />
<input type="hidden" name="col" value="priority"><br />
<input type="hidden" name="col" value="component"><br />
--><br />
</form><br />
</pre><br />
</pre><br />
=== Available Processors ===<br />
<br />
The following processors are included in the Trac distribution:<br />
<br />
<tt>#default</tt> :: Present the text verbatim in a preformatted text block. <br />
This is the same as specifying ''no'' processor name<br />
(and no <tt>#!</tt>)<br />
<tt>#comment</tt> :: Do not process the text in this section (i.e. contents exist<br />
only in the plain text - not in the rendered page).<br />
<br />
==== HTML related ====<br />
<br />
<tt>#html</tt> :: Insert custom HTML in a wiki page.<br />
<tt>#htmlcomment</tt> :: Insert an HTML comment in a wiki page (''since 0.12'').<br />
<br />
Note that <tt>#html</tt> blocks have to be ''self-contained'',<br />
#e. you can't start an HTML element in one block and close it later in a second block. Use the following processors for achieving a similar effect. <br />
<br />
<tt>#div</tt> :: Wrap an arbitrary Wiki content inside a <div> element<br />
(''since 0.11'').<br />
<tt>#span</tt> :: Wrap an arbitrary Wiki content inside a <span> element <br />
(''since 0.11''). <br />
<br />
<tt>#td</tt> :: Wrap an arbitrary Wiki content inside a <td> element (''since 0.12'')<br />
<tt>#th</tt> :: Wrap an arbitrary Wiki content inside a <th> element (''since 0.12'') <br />
<tt>#tr</tt> :: Can optionally be used for wrapping <tt>#td</tt> and <tt>#th</tt> blocks,<br />
either for specifying row attributes of better visual grouping<br />
(''since 0.12'')<br />
<br />
See WikiHtml for example usage and more details about these processors.<br />
<br />
==== Other Markups ====<br />
<br />
<tt>#rst</tt> :: Trac support for Restructured Text. See WikiRestructuredText.<br />
<tt>#textile</tt> :: Supported if [http://cheeseshop.python.org/pypi/textile Textile] <br />
is installed. <br />
See [http://www.textism.com/tools/textile/ a Textile reference].<br />
<br />
<br />
==== Code Highlighting Support ====<br />
<br />
Trac includes processors to provide inline syntax highlighting:<br />
<tt>#c</tt> (C), <tt>#cpp</tt> (C++), <tt>#python</tt> (Python), <tt>#perl</tt> (Perl), <br />
<tt>#ruby</tt> (Ruby), <tt>#php</tt> (PHP), <tt>#asp</tt> (ASP), <tt>#java</tt> (Java), <br />
<tt>#js</tt> (Javascript), <tt>#sql (SQL)</tt>, <tt>#xml</tt> (XML or HTML),<br />
<tt>#sh</tt> (Bourne/Bash shell), etc.<br />
<br />
Trac relies on external software packages for syntax coloring,<br />
like [http://pygments.org Pygments]. <br />
<br />
See TracSyntaxColoring for information about which languages<br />
are supported and how to enable support for more languages.<br />
<br />
Note also that 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:<br />
<pre><br />
<pre><br />
#text/html<br />
<h1>text</h1><br />
</pre><br />
</pre><br />
<br />
The result will be syntax highlighted HTML code:<br />
<pre><br />
#text/html<br />
<h1>text</h1><br />
</pre><br />
<br />
The same is valid for all other [TracSyntaxColoring#SyntaxColoringSupport mime types supported].<br />
<br />
<br />
For more processor macros developed and/or contributed by users, visit: <br />
*[trac:ProcessorBazaar]<br />
*[trac:MacroBazaar]<br />
*[th:WikiStart Trac Hacks] community site<br />
<br />
Developing processors is no different from Wiki macros. <br />
In fact they work the same way, only the usage syntax differs. <br />
See WikiMacros#DevelopingCustomMacros for more information.<br />
<br />
<br />
----<br />
See also: WikiMacros, WikiHtml, WikiRestructuredText, TracSyntaxColoring, WikiFormatting, TracGuide<br />
<br />
<br />
<br />
{{TracNotice|{{PAGENAME}}}}</div>Maintenance script