Changes between Version 1 and Version 2 of Wiki Processors
- Timestamp:
- Jul 4, 2008, 2:09:43 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Wiki Processors
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 'hashbang 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 ---- … … 75 80 ---- 76 81 77 78 79 82 == Available Processors == 80 83 The following processors are included in the Trac distribution: 81 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. 82 87 * '''rst''' -- Trac support for Restructured Text. See WikiRestructuredText. 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). 83 90 84 === Source CodeSupport ===85 Trac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for the selanguages:91 === Code Highlighting Support === 92 Trac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for the following languages: 86 93 * '''c''' -- C 87 94 * '''cpp''' -- C++ … … 90 97 * '''ruby''' -- Ruby 91 98 * '''php''' -- PHP 92 * '''asp''' --- ASP 99 * '''asp''' -- ASP 100 * '''java''' -- Java 101 * '''js''' -- Javascript 93 102 * '''sql''' -- SQL 94 103 * '''xml''' -- XML 104 * '''sh''' -- Bourne/Bash shell 105 95 106 '''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.'' 96 107 108 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: 109 {{{ 110 {{{ 111 #!text/html 112 <h1>text</h1> 113 }}} 114 }}} 97 115 98 For more processor macros developed and/or contributed by users, visit the processor bazaar: 99 http://projects.edgewall.com/trac/wiki/ProcessorBazaar 116 The result will be syntax highlighted HTML code: 117 {{{ 118 #!text/html 119 <h1>text</h1> 120 }}} 100 121 101 ---- 122 The same is valid for all other mime types supported. 123 124 125 For more processor macros developed and/or contributed by users, visit: 126 * [trac:ProcessorBazaar] 127 * [trac:MacroBazaar] 128 * [th:WikiStart Trac Hacks] community site 129 130 102 131 == Advanced Topics: Developing Processor Macros == 103 Developing processors is no different than WikiMacros. In fact they work the same way, only the usage syntax differs. See WikiMacros for more information.132 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. 104 133 105 '''Example:''' (''Restructured Text Processor''):106 {{{107 from docutils.core import publish_string108 109 def execute(hdf, text):110 html = publish_string(text, writer_name = 'html')111 return html[html.find('<body>')+6:html.find('</body>')].strip()112 }}}113 134 114 135 ----