Changes between Version 1 and Version 2 of WikiProcessors
- Timestamp:
- Apr 22, 2011, 2:42:57 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiProcessors
v1 v2 1 1 = Wiki Processors = 2 Processors 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 2 4 The wiki engine uses processors to allow using [wiki:WikiRestructuredText Restructured Text] and [wiki:WikiHtml raw HTML] in any wiki text throughout Trac. 3 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''. 4 5 The 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 5 7 6 8 == Using Processors == 7 To use a processor on a block of text, use a wiki blockquote, selecting a processor by name using ''shebang notation'' (#!), familiar to most UNIX users from scripts. 9 10 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. 8 11 9 12 '''Example 1''' (''inserting raw HTML in a wiki text''): … … 22 25 <h1 style="color: orange">This is raw HTML</h1> 23 26 }}} 27 28 Note 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). 24 29 25 30 ---- … … 78 83 The following processors are included in the Trac distribution: 79 84 * '''html''' -- Insert custom HTML in a wiki page. See WikiHtml. 85 * '''div''' -- Wrap an arbitrary Wiki content in a <div> element (''since 0.11''). See WikiHtml. 86 * '''span''' -- Wrap an arbitrary Wiki content in a <span> element (''since 0.11''). See also WikiHtml. 80 87 * '''rst''' -- Trac support for Restructured Text. See WikiRestructuredText. 81 * '''textile''' -- Supported if [http://dealmeida.net/projects/textile/ Textile] is installed. 88 * '''textile''' -- Supported if [http://cheeseshop.python.org/pypi/textile Textile] is installed. See [http://www.textism.com/tools/textile/ a Textile reference]. 89 * '''comment''' -- Do not process the text in this section (i.e. contents exist only in the plain text - not in the rendered page). 90 * '''diff''' -- Pretty print patches and diffs. 82 91 83 92 === Code Highlighting Support === … … 85 94 * '''c''' -- C 86 95 * '''cpp''' -- C++ 96 * '''csharp''' --- C# (''use #!text/x-csharp'') 87 97 * '''python''' -- Python 88 98 * '''perl''' -- Perl 89 99 * '''ruby''' -- Ruby 90 100 * '''php''' -- PHP 91 * '''asp''' --- ASP 101 * '''asp''' -- ASP 102 * '''java''' -- Java 103 * '''js''' -- Javascript 92 104 * '''sql''' -- SQL 93 105 * '''xml''' -- XML 106 * '''sh''' -- Bourne/Bash shell 107 94 108 '''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.'' 95 109 … … 102 116 }}} 103 117 104 The result will be syntax highlighted HTML code. The same is valid for all other mime types supported. 118 The result will be syntax highlighted HTML code: 119 {{{ 120 #!text/html 121 <h1>text</h1> 122 }}} 123 124 The same is valid for all other mime types supported. 105 125 106 126 107 127 For more processor macros developed and/or contributed by users, visit: 108 * [http://projects.edgewall.com/trac/wiki/ProcessorBazaar ProcessorBazaar] 109 * [http://projects.edgewall.com/trac/wiki/MacroBazaar MacroBazaar] 128 * [trac:ProcessorBazaar] 129 * [trac:MacroBazaar] 130 * [th:WikiStart Trac Hacks] community site 110 131 111 132 112 133 == Advanced Topics: Developing Processor Macros == 113 Developing processors is no different than WikiMacros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information.134 Developing processors is no different from Wiki macros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information. 114 135 115 '''Example:''' (''Restructured Text Processor''):116 {{{117 from docutils.core import publish_string118 119 def execute(hdf, text, env):120 html = publish_string(text, writer_name = 'html')121 return html[html.find('<body>')+6:html.find('</body>')].strip()122 }}}123 136 124 137 ----
