<html xmlns="http://www.w3.org/1999/xhtml" a0:Name="SuikaWiki" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:Version="0.9"><head></head><body><p><a0:anchor-end a0:anchor="1">[1]</a0:anchor-end> <dfn>InterWiki</dfn> は、 (<a0:anchor>URI</a0:anchor> よりも人間に優しい)
別の (<a0:anchor>wiki</a0:anchor> の外の) 文書群にリンクするための仕組みです。</p><p><a0:anchor>SuikaWiki</a0:anchor> は、他の多くの wiki システムよりも柔軟に
InterWiki を扱うことができます。</p><section><h1>InterWiki を使ったリンクの作成</h1><p><a0:anchor-end a0:anchor="2">[2]</a0:anchor-end>
<a0:anchor>SuikaWiki/0.9</a0:anchor> 形式の文書では、次のように InterWiki
リンクを書くことができます。</p><pre><strong>&lt;</strong>IW:<var>&quot;文書群名&quot;</var>:<var>&quot;文書名&quot;</var><strong>&gt;</strong></pre><p>例えば、<samp>どこかのwiki</samp> に属する <samp>InterWikiのテスト</samp>という文書にリンクしたい時には、<pre><strong>&lt;</strong>IW:&quot;どこかのwiki&quot;:&quot;InterWikiのテスト&quot;<strong>&gt;</strong></pre></p><p>と書きます。
(引用符はなくても安全な時は省略できます。
安全でない時には警告が出ます。)</p><a0:form ref="comment"></a0:form></section><section><h1>InterWiki 文書群の定義</h1><p><a0:anchor-end a0:anchor="3">[3]</a0:anchor-end> <a0:anchor-internal a0:anchor="2">&gt;&gt;2</a0:anchor-internal> で説明した<var>文書群名</var>には、
<code class="WikiPage"><a0:anchor>Wiki//InterWikiName</a0:anchor></code>
という特別な頁で定義した文書群の名前を指定します。</p><p>たとえば、<pre>Site:
  @Name: RFC
  @URIReference:
    http://www.ietf.org/rfc/rfc%parameter;.txt</pre></p><p>のような定義を <code class="WikiPage">Wiki//InterWikiName</code>
に追加すると、<pre><strong>&lt;</strong>IW:RFC:2822<strong>&gt;</strong></pre></p><p>と書いて <a0:anchor-external a0:resScheme="URI" a0:resParameter="http://www.ietf.org/rfc/rfc2822.txt">http://www.ietf.org/rfc/rfc2822.txt</a0:anchor-external> にリンクできます。</p><p><a0:anchor-end a0:anchor="4">[4]</a0:anchor-end> <code>URIReference</code> の欄は、
<code class="perl"><a0:anchor>Message::Util::Formatter</a0:anchor></code> 形式で解釈されます。
<a0:anchor-internal a0:anchor="3">&gt;&gt;3</a0:anchor-internal> の例の <samp>%parameter;</samp> の部分のことを
<code class="perl">Message::Util::Formatter</code> 
では<q>整形規則</q>と呼んでいます。</p><p>整形規則は SuikaWiki の <a0:anchor>WikiPlugin</a0:anchor> を使って定義されています。
従って、 wiki の管理者は (多少の知識は必要ですが)
自由に整形規則を定義して、 InterWiki のリンク先 URI
を自在に生成することができます。</p><p><a0:anchor-end a0:anchor="5">[5]</a0:anchor-end> SuikaWiki に標準で付属している整形規則を使って、
<a0:anchor>Google</a0:anchor> にリンクするための InterWiki の定義を行ってみましょう。</p><pre>Site:
  @Name: Google
  @URIReference:
    %uri-with-query (
      base =&gt; {http://www.google.com/search},
      query =&gt; {%query-parameter (
        name =&gt; q,
        value =&gt; {%parameter;}p,
        charset =&gt; {iso-2022-jp},
      );}p,
      query =&gt; {ie=iso-2022-jp},
    );</pre><p>この定義を使うと、<pre><strong>&lt;</strong>IW:Google:SuikaWiki<strong>&gt;</strong></pre></p><p>は <a0:anchor-external a0:resScheme="URI" a0:resParameter="http://www.google.com/search?q=SuikaWiki&amp;ie=iso-2022-jp">http://www.google.com/search?q=SuikaWiki&amp;ie=iso-2022-jp</a0:anchor-external>
になります。</p><p><a0:anchor-internal a0:anchor="3">&gt;&gt;3</a0:anchor-internal> の例のように <samp>http://www.google.com/search?q=%parameter;</samp>
と定義しても良いように思えるかもしれません。
しかし、それでは、 <pre><strong>&lt;</strong>IW:Google:&quot;すいかゐき&quot;<strong>&gt;</strong></pre></p><p>のように仮名や漢字を含んでいる場合や、 <samp>&amp;</samp>
という記号を含んでいる場合には正しい URI が生成できません。</p><p>整形規則 <samp>uri-with-query</samp> や <samp>query-parameter</samp>
は、そのような問題を解決してくれます。</p><p><a0:anchor-end a0:anchor="6">[6]</a0:anchor-end> このほかにも、 <samp>yukiwiki</samp> のように特定の相手先の URI
の生成を楽にするための整形規則も用意しています。
<a0:anchor>Wiki//InterWikiName</a0:anchor> には多くの例がありますから、
参考にしてください。</p><p>利用できる整形規則の一覧は、 <a0:anchor>Wiki//Plugin//Info</a0:anchor> にあります。
(InterWiki の定義以外の目的に使う整形規則も含まれます。)
整形規則が内部でどのような動作をしているのかは、
<a0:anchor-external a0:resScheme="IW" a0:resParameter="SuikaCVS:&quot;suikawiki/script/lib/SuikaWiki/Plugin/&quot;">IW:SuikaCVS:&quot;suikawiki/script/lib/SuikaWiki/Plugin/&quot;</a0:anchor-external>
や <a0:anchor-external a0:resScheme="IW" a0:resParameter="SuikaCVS:&quot;suikawiki/script/misc/plugins/&quot;">IW:SuikaCVS:&quot;suikawiki/script/misc/plugins/&quot;</a0:anchor-external>
にある WikiPlugin のソースを見てもらえばわかります。</p><a0:form ref="comment"></a0:form></section><section><h1>まだ実装していない機能</h1><p><a0:anchor-end a0:anchor="7">[7]</a0:anchor-end> HTML 出力モードでは InterWiki のリンクは
<samp><strong>&lt;</strong>Google:SuikaWiki<strong>&gt;</strong></samp>
のようになりますが、より柔軟に、
<samp>Google 検索: 「SuikaWiki」</samp>
などとしたり、
<samp><em>HTML 4 仕様書</em> <em>4.1 節</em> (<em>和訳</em>)</samp>
のような感じで1つの InterWiki リンク指定から複数のリンク先を出力できるようにする予定です。</p><p>また、 InterWiki の方法を応用して、 wiki 内のリンクの方法をより柔軟にできないか模索中です。</p><p><a0:anchor-end a0:anchor="8">[8]</a0:anchor-end>
Wiki//InterWikiName の編集を HTML form を使って簡単にできるようにすることも考えています。
(<a0:anchor>名無しさん</a0:anchor> <a0:weak>2004-06-03 07:23:33 +00:00</a0:weak>)</p><a0:form ref="comment"></a0:form></section><section><h1>メモ</h1></section></body></html>