Changes between Version 5 and Version 6 of WikiProcessors
- Timestamp:
- Jan 28, 2010, 4:25:37 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiProcessors
v5 v6 1 = Wiki プロセッサ=1 = Wiki Processors = 2 2 3 プロセッサは [TracWiki Trac Wiki エンジン] が、 Wiki 以外のフォーマットを提供するために設計された WikiMacros です。プロセッサは ''ユーザが編集したテキストを処理するマクロ機能'' と考えることができます。 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 4 5 T rac 内の全ての Wiki テキストにおいて、 [wiki:WikiRestructuredText Restructured Text], [wiki:WikiHtml raw HTML] および [http://www.textism.com/tools/textile/ textile] をプロセッサとして使用することができます。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 6 7 == プロセッサを使用する ==8 7 9 テキストブロックでプロセッサを使うには、 Wiki のコードブロックを使用し、プロセッサの名前を (Unix 系 OS のスクリプトのように) ''shebang 行'' (#!) に続いて指定します。 8 == Using Processors == 10 9 11 '''例1''' (''Wiki テキストに 生 HTML を挿入する''): 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''): 12 13 13 14 {{{ … … 15 16 <pre class="wiki">{{{ 16 17 #!html 17 <h1 style="color: orange"> これは生 HTML です</h1>18 <h1 style="color: orange">This is raw HTML</h1> 18 19 }}}</pre> 19 20 }}} 20 21 21 ''' 結果、このように表示されます:'''22 '''Results in:''' 22 23 {{{ 23 24 #!html 24 <h1 style="color: orange"> これは生 HTML です</h1>25 <h1 style="color: orange">This is raw HTML</h1> 25 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). 26 29 27 30 ---- 28 31 29 ''' 例2''' (''Wiki テキストに !ReStructured テキストを挿入する''):32 '''Example 2''' (''inserting Restructured Text in wiki text''): 30 33 31 34 {{{ … … 33 36 <pre class="wiki">{{{ 34 37 #!rst 35 見出し 36 ------ 37 脚注 [*]_ 付きの **text** です。 38 A header 39 -------- 40 This is some **text** with a footnote [*]_. 38 41 39 .. [*] ここは脚注。42 .. [*] This is the footnote. 40 43 }}}</pre> 41 44 }}} 42 45 43 ''' 結果、このように表示されます:'''46 '''Results in:''' 44 47 {{{ 45 48 #!rst 46 見出し 47 ------ 48 脚注 [*]_ 付きの **text** です。 49 A header 50 -------- 51 This is some **text** with a footnote [*]_. 49 52 50 .. [*] ここは脚注。53 .. [*] This is the footnote. 51 54 }}} 52 (訳注: !ReStructuredText は国際化が甘いので、使えないかもしれません)53 55 ---- 54 ''' 例3''' (''Wiki テキストに C 言語ソースコードブロックを挿入する''):56 '''Example 3''' (''inserting a block of C source code in wiki text''): 55 57 56 58 {{{ … … 66 68 }}} 67 69 68 ''' 結果、このように表示されます:'''70 '''Results in:''' 69 71 {{{ 70 72 #!c … … 78 80 ---- 79 81 80 == プロセッサ一覧 == 81 以下のプロセッサが Trac の配布に含まれています: 82 * '''html''' -- Wiki ページにカスタム HTML を挿入する。 WikiHtml を参照してください。 83 * '''rst''' -- Restructured テキスト を Trac で利用可能にする。 WikiRestructuredText を参照してください。 84 * '''textile''' -- [http://dealmeida.net/projects/textile/ Textile] をインストールすれば利用可能です。 [http://hobix.com/textile/ a Textile reference] を参照。 82 == Available Processors == 83 The 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). 85 90 86 上記の Textile のリンクは切れています。 [http://www.textism.com/tools/textile/ このサイト] は動いていて、試しに使ってみることが可能です。 87 88 === ソースコードの強調表示対応 === 89 Trac では、以下のプログラミング言語でのインライン [wiki:TracSyntaxColoring シンタックスハイライト] を行うプロセッサが組み込まれています。 91 === Code Highlighting Support === 92 Trac includes processors to provide inline [wiki:TracSyntaxColoring syntax highlighting] for the following languages: 90 93 * '''c''' -- C 91 94 * '''cpp''' -- C++ … … 94 97 * '''ruby''' -- Ruby 95 98 * '''php''' -- PHP 96 * '''asp''' --- ASP 99 * '''asp''' -- ASP 100 * '''java''' -- Java 101 * '''js''' -- Javascript 97 102 * '''sql''' -- SQL 98 103 * '''xml''' -- XML 99 '''Note:''' ''Trac はシンタックスの色付けを、外部のソフトウェアパッケージに依存しています。詳しくは TracSyntaxColoring をご覧下さい。'' 104 * '''sh''' -- Bourne/Bash shell 100 105 101 プロセッサとして mime-type が指定されると、ソースコードをブラウズするときと同じく、対応されている言語であれば、シンタックスハイライトを行うことができます。例えば、以下のように書くと: 106 '''Note:''' ''Trac relies on external software packages for syntax coloring. See TracSyntaxColoring for more info.'' 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: 102 109 {{{ 103 110 {{{ … … 107 114 }}} 108 115 109 この結果はシンタックスハイライトされた HTML コードになります。対応している全ての mime-type でも、これは同じく有効です。 116 The result will be syntax highlighted HTML code: 117 {{{ 118 #!text/html 119 <h1>text</h1> 120 }}} 121 122 The same is valid for all other mime types supported. 110 123 111 124 112 ユーザによるプロセッサマクロの開発やコントリビュート: 113 * [http://trac.edgewall.org/wiki/ProcessorBazaar ProcessorBazaar] 114 * [http://trac.edgewall.org/wiki/MacroBazaar MacroBazaar] 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 115 129 116 130 117 == 上級トピック: プロセッサマクロを開発する==118 プロセッサの開発は WikiMacros と違いはありません。事実、これらは同じような機能を持ち、シンタックスだけが異なります。詳しくは WikiMacros に記述します。 131 == Advanced Topics: Developing Processor Macros == 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. 119 133 120 '''例:''' (''Restructured テキストプロセッサ''):121 {{{122 #!python123 from docutils.core import publish_string124 125 def execute(hdf, text, env):126 html = publish_string(text, writer_name = 'html')127 return html[html.find('<body>')+6:html.find('</body>')].strip()128 }}}129 134 130 135 ----