Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.ru/trac/tanchiki/wiki/WikiProcessors?action=diff&version=2
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Mon Apr 11 21:27:49 2016
Êîäèðîâêà: IBM-866
WikiProcessors (diff) òÀÓ Tanchiki

Changes between Version 1 and Version 2 of WikiProcessors


Ignore:
Timestamp:
08/21/13 19:46:14 (3 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiProcessors

    v1 v2 ˆà
    33Processors 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''. ˆà
    44ˆà
    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.ˆà
    ˆà5Wiki processors can be used in any Wiki text throughout Trac,ˆà
    ˆà6for various different purposes, like:ˆà
    ˆà7 - [#CodeHighlightingSupport syntax highlighting] or for rendering text verbatim,ˆà
    ˆà8 - rendering [#HTMLrelated Wiki markup inside a context], ˆà
    ˆà9   like inside <div> blocks or <span> or within <td> or <th> table cells,ˆà
    ˆà10 - using an alternative markup syntax, like [wiki:WikiHtml raw HTML] andˆà
    ˆà11   [wiki:WikiRestructuredText Restructured Text],ˆà
    ˆà12   or [http://www.textism.com/tools/textile/ textile]ˆà
    613ˆà
    714ˆà
    815== Using Processors ==ˆà
    916ˆà
    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.ˆà
    11ˆàˆà
    12ˆà'''Example 1''' (''inserting raw HTML in a wiki text''):ˆà
    13ˆàˆà
    ˆà17To use a processor on a block of text, first delimit the lines usingˆà
    ˆà18a Wiki ''code block'':ˆà
    ˆà19{{{ˆà
    ˆà20{{{ˆà
    ˆà21The linesˆà
    ˆà22that should be processed...ˆà
    ˆà23}}}ˆà
    ˆà24}}}ˆà
    ˆà25ˆà
    ˆà26Immediately after the `{{{` or on the line just below, ˆà
    ˆà27add `#!` followed by the ''processor name''.ˆà
    ˆà28ˆà
    ˆà29{{{ˆà
    ˆà30{{{ˆà
    ˆà31#!processornameˆà
    ˆà32The linesˆà
    ˆà33that should be processed...ˆà
    ˆà34}}}ˆà
    ˆà35}}}ˆà
    ˆà36ˆà
    ˆà37This is the "shebang" notation, familiar to most UNIX users.ˆà
    ˆà38ˆà
    ˆà39Besides their content, some Wiki processors can also accept ''parameters'',ˆà
    ˆà40which are then given as `key=value` pairs after the processor name, ˆà
    ˆà41on the same line. If `value` has to contain space, as it's often the case forˆà
    ˆà42the style parameter, a quoted string can be used (`key="value with space"`).ˆà
    ˆà43ˆà
    ˆà44As some processors are meant to process Wiki markup, it's quite possible toˆà
    ˆà45''nest'' processor blocks.ˆà
    ˆà46You may want to indent the content of nested blocks for increased clarity,ˆà
    ˆà47this extra indentation will be ignored when processing the content.ˆà
    ˆà48ˆà
    ˆà49ˆà
    ˆà50== Examples ==ˆà
    ˆà51ˆà
    ˆà52||= Wiki Markup =||= Display =||ˆà
    ˆà53{{{#!td colspan=2 align=center style="border: none"ˆà
    ˆà54ˆà
    ˆà55                __Example 1__: Inserting raw HTMLˆà
    ˆà56}}}ˆà
    ˆà57|-----------------------------------------------------------------ˆà
    ˆà58{{{#!td style="border: none"ˆà
    ˆà59{{{ˆà
    1460{{{ˆà
    1561#!htmlˆà
    16ˆà<pre class="wiki">{{{ˆà
    ˆà62<h1 style="color: grey">This is raw HTML</h1>ˆà
    ˆà63}}}ˆà
    ˆà64}}}ˆà
    ˆà65}}}ˆà
    ˆà66{{{#!td valign=top style="border: none; padding-left: 2em"ˆà
    ˆà67{{{ˆà
    1768#!htmlˆà
    18ˆà&lt;h1 style="color: orange"&gt;This is raw HTML&lt;/h1&gt;ˆà
    19ˆà}}}</pre>ˆà
    20ˆà}}}ˆà
    21ˆàˆà
    22ˆà'''Results in:'''ˆà
    23ˆà{{{ˆà
    24ˆà#!htmlˆà
    25ˆà<h1 style="color: orange">This is raw HTML</h1>ˆà
    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).ˆà
    29ˆàˆà
    30ˆà----ˆà
    31ˆàˆà
    32ˆà'''Example 2''' (''inserting Restructured Text in wiki text''):ˆà
    33ˆàˆà
    34ˆà{{{ˆà
    35ˆà#!htmlˆà
    36ˆà<pre class="wiki">{{{ˆà
    37ˆà#!rstˆà
    38ˆàA headerˆà
    39ˆà--------ˆà
    40ˆàThis is some **text** with a footnote [*]_.ˆà
    41ˆàˆà
    42ˆà.. [*] This is the footnote.ˆà
    43ˆà}}}</pre>ˆà
    44ˆà}}}ˆà
    45ˆàˆà
    46ˆà'''Results in:'''ˆà
    47ˆà{{{ˆà
    48ˆà#!rstˆà
    49ˆàA headerˆà
    50ˆà--------ˆà
    51ˆàThis is some **text** with a footnote [*]_.ˆà
    52ˆàˆà
    53ˆà.. [*] This is the footnote.ˆà
    54ˆà}}}ˆà
    55ˆà----ˆà
    56ˆà'''Example 3''' (''inserting a block of C source code in wiki text''):ˆà
    57ˆàˆà
    58ˆà{{{ˆà
    59ˆà#!htmlˆà
    60ˆà<pre class="wiki">{{{ˆà
    61ˆà#!cˆà
    62ˆàint main(int argc, char *argv[])ˆà
    63ˆà{ˆà
    64ˆà  printf("Hello World\n");ˆà
    65ˆà  return 0;ˆà
    66ˆà}ˆà
    67ˆà}}}</pre>ˆà
    68ˆà}}}ˆà
    69ˆàˆà
    70ˆà'''Results in:'''ˆà
    71ˆà{{{ˆà
    72ˆà#!cˆà
    73ˆàint main(int argc, char *argv[])ˆà
    74ˆà{ˆà
    75ˆà  printf("Hello World\n");ˆà
    76ˆà  return 0;ˆà
    77ˆà}ˆà
    78ˆà}}}ˆà
    79ˆàˆà
    80ˆà----ˆà
    81ˆàˆà
    ˆà69<h1 style="color: grey">This is raw HTML</h1>ˆà
    ˆà70}}}ˆà
    ˆà71}}}ˆà
    ˆà72|-----------------------------------------------------------------ˆà
    ˆà73{{{#!td colspan=2 align=center style="border: none"ˆà
    ˆà74ˆà
    ˆà75     __Example 2__: Highlighted Python code in a <div> block with custom styleˆà
    ˆà76}}}ˆà
    ˆà77|-----------------------------------------------------------------ˆà
    ˆà78{{{#!td style="border: none"ˆà
    ˆà79  {{{ˆà
    ˆà80  {{{#!div style="background: #ffd; border: 3px ridge"ˆà
    ˆà81ˆà
    ˆà82  This is an example of embedded "code" block:ˆà
    ˆà83ˆà
    ˆà84    {{{ˆà
    ˆà85    #!pythonˆà
    ˆà86    def hello():ˆà
    ˆà87        return "world"ˆà
    ˆà88    }}}ˆà
    ˆà89ˆà
    ˆà90  }}}ˆà
    ˆà91  }}}ˆà
    ˆà92}}}ˆà
    ˆà93{{{#!td valign=top style="border: none; padding: 1em"ˆà
    ˆà94  {{{#!div style="background: #ffd; border: 3px ridge"ˆà
    ˆà95ˆà
    ˆà96  This is an example of embedded "code" block:ˆà
    ˆà97ˆà
    ˆà98    {{{ˆà
    ˆà99    #!pythonˆà
    ˆà100    def hello():ˆà
    ˆà101        return "world"ˆà
    ˆà102    }}}ˆà
    ˆà103ˆà
    ˆà104  }}}ˆà
    ˆà105}}}ˆà
    ˆà106|-----------------------------------------------------------------ˆà
    ˆà107{{{#!td colspan=2 align=center style="border: none"ˆà
    ˆà108ˆà
    ˆà109     __Example 3__: Searching tickets from a wiki page, by keywords.ˆà
    ˆà110}}}ˆà
    ˆà111|-----------------------------------------------------------------ˆà
    ˆà112{{{#!td style="border: none"ˆà
    ˆà113  {{{ˆà
    ˆà114  {{{ˆà
    ˆà115  #!htmlˆà
    ˆà116  <form action="/query" method="get"><div>ˆà
    ˆà117  <input type="text" name="keywords" value="~" size="30"/>ˆà
    ˆà118  <input type="submit" value="Search by Keywords"/>ˆà
    ˆà119  <!-- To control what fields show up use hidden fieldsˆà
    ˆà120  <input type="hidden" name="col" value="id"/>ˆà
    ˆà121  <input type="hidden" name="col" value="summary"/>ˆà
    ˆà122  <input type="hidden" name="col" value="status"/>ˆà
    ˆà123  <input type="hidden" name="col" value="milestone"/>ˆà
    ˆà124  <input type="hidden" name="col" value="version"/>ˆà
    ˆà125  <input type="hidden" name="col" value="owner"/>ˆà
    ˆà126  <input type="hidden" name="col" value="priority"/>ˆà
    ˆà127  <input type="hidden" name="col" value="component"/>ˆà
    ˆà128  -->ˆà
    ˆà129  </div></form>ˆà
    ˆà130  }}}ˆà
    ˆà131  }}}ˆà
    ˆà132}}}ˆà
    ˆà133{{{#!td valign=top style="border: none; padding: 1em"ˆà
    ˆà134  {{{ˆà
    ˆà135  #!htmlˆà
    ˆà136  <form action="/query" method="get"><div>ˆà
    ˆà137  <input type="text" name="keywords" value="~" size="30"/>ˆà
    ˆà138  <input type="submit" value="Search by Keywords"/>ˆà
    ˆà139  <!-- To control what fields show up use hidden fieldsˆà
    ˆà140  <input type="hidden" name="col" value="id"/>ˆà
    ˆà141  <input type="hidden" name="col" value="summary"/>ˆà
    ˆà142  <input type="hidden" name="col" value="status"/>ˆà
    ˆà143  <input type="hidden" name="col" value="milestone"/>ˆà
    ˆà144  <input type="hidden" name="col" value="version"/>ˆà
    ˆà145  <input type="hidden" name="col" value="owner"/>ˆà
    ˆà146  <input type="hidden" name="col" value="priority"/>ˆà
    ˆà147  <input type="hidden" name="col" value="component"/>ˆà
    ˆà148  -->ˆà
    ˆà149  </div></form>ˆà
    ˆà150  }}}ˆà
    ˆà151}}}ˆà
    82152== Available Processors ==ˆà
    ˆà153ˆà
    83154The following processors are included in the Trac distribution:ˆà
    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.ˆà
    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).ˆà
    90ˆà * '''diff''' -- Pretty print patches and diffs.ˆà
    91ˆàˆà
    92ˆà=== Code Highlighting Support ===ˆà
    93ˆàTrac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for the following languages:ˆà
    94ˆà * '''c''' -- Cˆà
    95ˆà * '''cpp''' -- C++ˆà
    96ˆà * '''csharp''' --- C# (''use #!text/x-csharp'')ˆà
    97ˆà * '''python''' -- Pythonˆà
    98ˆà * '''perl''' -- Perlˆà
    99ˆà * '''ruby''' -- Rubyˆà
    100ˆà * '''php''' -- PHPˆà
    101ˆà * '''asp''' -- ASPˆà
    102ˆà * '''java''' -- Javaˆà
    103ˆà * '''js''' -- Javascriptˆà
    104ˆà * '''sql''' -- SQLˆà
    105ˆà * '''xml''' -- XMLˆà
    106ˆà * '''sh''' -- Bourne/Bash shellˆà
    107ˆàˆà
    108ˆà'''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.''ˆà
    109ˆàˆà
    110ˆà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:ˆà
    111ˆà{{{ˆà
    ˆà155ˆà
    ˆà156|| '''`#!default`''' || Present the text verbatim in a preformatted text block. This is the same as specifying ''no'' processor name (and no `#!`) ||ˆà
    ˆà157|| '''`#!comment`''' || Do not process the text in this section (i.e. contents exist only in the plain text - not in the rendered page). ||ˆà
    ˆà158|||| ||ˆà
    ˆà159||||= '''HTML related''' =||ˆà
    ˆà160|| '''`#!html`''' || Insert custom HTML in a wiki page. ||ˆà
    ˆà161|| '''`#!htmlcomment`''' || Insert an HTML comment in a wiki page (''since 0.12''). ||ˆà
    ˆà162|| || Note that `#!html` blocks 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 the following processors for achieving a similar effect.  ||ˆà
    ˆà163|| '''`#!div`''' || Wrap an arbitrary Wiki content inside a <div> element (''since 0.11''). ||ˆà
    ˆà164|| '''`#!span`''' || Wrap an arbitrary Wiki content inside a <span> element (''since 0.11''). ||ˆà
    ˆà165|| '''`#!td`''' || Wrap an arbitrary Wiki content inside a <td> element (''since 0.12'') ||ˆà
    ˆà166|| '''`#!th`''' || Wrap an arbitrary Wiki content inside a <th> element (''since 0.12'') ||ˆà
    ˆà167|| '''`#!tr`''' || Can optionally be used for wrapping `#!td` and `#!th` blocks, either for specifying row attributes of better visual grouping (''since 0.12'') ||ˆà
    ˆà168|| || See WikiHtml for example usage and more details about these processors. ||ˆà
    ˆà169|||| ||ˆà
    ˆà170||||= '''Other Markups''' =||ˆà
    ˆà171|| '''`#!rst`''' || Trac support for Restructured Text. See WikiRestructuredText. ||ˆà
    ˆà172|| '''`#!textile`''' || Supported if [http://cheeseshop.python.org/pypi/textile Textile] is installed. See [http://www.textism.com/tools/textile/ a Textile reference]. ||ˆà
    ˆà173|||| ||ˆà
    ˆà174||||= '''Code Highlighting Support''' =||ˆà
    ˆà175|| '''`#!c`''' [[BR]] '''`#!cpp`''' (C++) [[BR]] '''`#!python`''' [[BR]] '''`#!perl`''' [[BR]] '''`#!ruby`''' [[BR]] '''`#!php`''' [[BR]] '''`#!asp`''' [[BR]] '''`#!java`''' [[BR]] '''`#!js`''' (Javascript) [[BR]] '''`#!sql`''' [[BR]] '''`#!xml`''' (XML or HTML) [[BR]] '''`#!sh`''' (!Bourne/Bash shell) [[BR]] '''etc.''' [[BR]] || Trac includes processors to provide inline syntax highlighting for source code in various languages. [[BR]] [[BR]] Trac relies on external software packages for syntax coloring, like [http://pygments.org Pygments]. [[BR]] [[BR]] See TracSyntaxColoring for information about which languages are supported and how to enable support for more languages. ||ˆà
    ˆà176|||| ||ˆà
    ˆà177||||= '''MIME Type Processors''' =||ˆà
    ˆà178|||| Using the MIME type as processor, it is possible to syntax-highlight the same languages that are supported when browsing source code. ||ˆà
    ˆà179{{{#!trˆà
    ˆà180{{{#!tdˆà
    ˆà181Some examples:ˆà
    ˆà182 {{{ˆà
    112183{{{ˆà
    113184#!text/htmlˆà
    114185<h1>text</h1>ˆà
    115186}}}ˆà
    116ˆà}}}ˆà
    117ˆàˆà
    ˆà187 }}}ˆà
    ˆà188}}}ˆà
    ˆà189{{{#!tdˆà
    118190The result will be syntax highlighted HTML code:ˆà
    119ˆà{{{ˆà
    ˆà191 {{{ˆà
    120192#!text/htmlˆà
    121193<h1>text</h1>ˆà
    122ˆà}}}ˆà
    123ˆàˆà
    124ˆàThe same is valid for all other mime types supported.ˆà
    125ˆàˆà
    ˆà194 }}}ˆà
    ˆà195ˆà
    ˆà196The same is valid for all other [TracSyntaxColoring#SyntaxColoringSupport mime types supported].ˆà
    ˆà197}}}ˆà
    ˆà198}}}ˆà
    ˆà199{{{#!tdˆà
    ˆà200 {{{ˆà
    ˆà201{{{ˆà
    ˆà202#!diffˆà
    ˆà203--- Version 55ˆà
    ˆà204+++ Version 56ˆà
    ˆà205@@ -115,8 +115,9 @@ˆà
    ˆà206     name='TracHelloWorld', version='1.0',ˆà
    ˆà207     packages=find_packages(exclude=['*.tests*']),ˆà
    ˆà208-    entry_points = """ˆà
    ˆà209-        [trac.plugins]ˆà
    ˆà210-        helloworld = myplugs.helloworldˆà
    ˆà211-    """,ˆà
    ˆà212+    entry_points = {ˆà
    ˆà213+        'trac.plugins': [ˆà
    ˆà214+            'helloworld = myplugs.helloworld',ˆà
    ˆà215+        ],ˆà
    ˆà216+    },ˆà
    ˆà217 )ˆà
    ˆà218}}}ˆà
    ˆà219 }}}ˆà
    ˆà220}}}ˆà
    ˆà221{{{#!tdˆà
    ˆà222'''`#!diff`''' has a particularly nice renderer:ˆà
    ˆà223 {{{ˆà
    ˆà224#!diffˆà
    ˆà225--- Version 55ˆà
    ˆà226+++ Version 56ˆà
    ˆà227@@ -115,8 +115,9 @@ˆà
    ˆà228     name='TracHelloWorld', version='1.0',ˆà
    ˆà229     packages=find_packages(exclude=['*.tests*']),ˆà
    ˆà230-    entry_points = """ˆà
    ˆà231-        [trac.plugins]ˆà
    ˆà232-        helloworld = myplugs.helloworldˆà
    ˆà233-    """,ˆà
    ˆà234+    entry_points = {ˆà
    ˆà235+        'trac.plugins': [ˆà
    ˆà236+            'helloworld = myplugs.helloworld',ˆà
    ˆà237+        ],ˆà
    ˆà238+    },ˆà
    ˆà239 )ˆà
    ˆà240 }}}ˆà
    ˆà241}}}ˆà
    126242ˆà
    127243For more processor macros developed and/or contributed by users, visit: ˆà
    128244 * [trac:ProcessorBazaar]ˆà
    129245 * [trac:MacroBazaar]ˆà
    130ˆà * [th:WikiStart Trac Hacks] community siteˆà
    131ˆàˆà
    132ˆàˆà
    133ˆà== Advanced Topics: Developing Processor Macros ==ˆà
    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.ˆà
    ˆà246 * [http://trac-hacks.org Trac Hacks] community siteˆà
    ˆà247ˆà
    ˆà248Developing processors is no different from Wiki macros. ˆà
    ˆà249In fact they work the same way, only the usage syntax differs. ˆà
    ˆà250See WikiMacros#DevelopingCustomMacros for more information.ˆà
    135251ˆà
    136252ˆà