6.0.0-git
2024-05-05

Diff for RuleInterwiki between and 1

[[toc]]
++ About This Rule
|| **Name**   || interwiki ||
|| **Type**   || inline || 
|| **Syntax** normal || {{``SiteName:PageName``}} ||
|| **Syntax** described || {{[``SiteName:PageName`` Show this text instead]}}
|| **||
++ Parse Configuration Keys
None.
++ Render Configuration Keys
|| **Format** || **Key** || **Type** || **Description** ||
|| {{Xhtml}} || {{sites}} || array || An array of key-value pairs where the
|| key is the text of the interwiki site name and the value is the URL for
|| that site ||
|| {{Xhtml}} || {{target}} || string || The HREF target for interwiki links;
|| e.g., '_blank' ||

++ Description
Interwiki is a way of representing wiki pages on other wikis.  To mark an
interwiki link, type the name of the site, a colon, then the name of the page
on the interwiki site.
Text_Wiki needs to know the URL for the various interwiki sites so it make
clickable links; to tell Text_Wiki the site names and urls, use the
{{[MethodSetRenderConf setRenderConf()]}} method.  The array key should be the
name of the site, and the array value should be the URL part leading up to the
page-value.
<code type="php">
// [snip] create a Text_Wiki object called $wiki
// set up an array of interwiki site names and urls
$sites = array(
    'MeatBall'    => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
    'Advogato'    => 'http://advogato.org/%s',
    'Wiki'        => 'http://c2.com/cgi/wiki?%s'
);
// configure the interwiki rule
$wiki->setRenderConf('xhtml', 'interwiki', 'sites', $sites);
</code>
> **Note:** Note the use of %s in the above URL strings; the %s will be
    replaced by the page name.  If you specify a string that does not have a
    %s in it, Text_Wiki will assume that the page name should go at the very
    end of the string.