\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\section{About This Rule}
<table class="horde-table">\textbf{Name} & wikilink \\
\hline
\textbf{Type} & inline \\
\hline
\textbf{Syntax} normal & \texttt{``[AnyPageName](AnyPageName)``} \\
\hline
\textbf{Syntax} described & \texttt{``[displayed link text](AnyPageName)``} \\
\hline
</table>
\section{Parse Configuration Keys}
None.

\section{Render Configuration Keys}
<table class="horde-table">\textbf{Format} & \textbf{Key} & \textbf{Type} & \textbf{Description} \\
\hline
\texttt{Xhtml} & \texttt{pages} & array & A sequential array of page names that exist in the wiki \\
\hline
\texttt{Xhtml} & \texttt{view\_url} & string & The base URL to view pages in the wiki \\
\hline
\texttt{Xhtml} & \texttt{new\_url} & string & The base URL to create new pages in the wiki \\
\hline
\texttt{Xhtml} & \texttt{new\_text} & string & The text displayed after non-existent page names \\
\hline
</table>
\section{Description}
As you should know by now, page names in wikis are made of WordsSmashedTogether in StudlyCapsMode.  The wikilink rule looks for WikiPages and creates links out of them.  This requires some moderate configuration to customize it for your environment.

In Text\_Wiki, wiki words are allowed to have numbers in them; each digit 0-9 is treated as a lower-case character for purposes of parsing words.

The rule needs to know what pages exist in the wiki, so that when it finds a page name in the source text, it can show the proper link (either to view an existing page, or create a page that has been named but does not yet exist).  To tell Text\_Wiki what wiki pages exist, use the 'pages' key in \texttt{[setRenderConf()](MethodSetRenderConf)}.

<pre><code class="language-php">
// [snip] create a Text\_Wiki object called \$wiki

// get the list of pages in the wiki
\$pages = array(
    'HomePage',
    'WordsSmashedTogether',
    'SomeOtherPages'
);

\$wiki->setRenderConf('xhtml', 'wikilink', 'pages', \$pages);
</code></pre>
Now Text\_Wiki needs to know where to link pages to.  There are two configuration keys for this, 'view\_url' and 'new\_url'.  If the parser finds a page name that exists in the 'pages' array, it will use 'view\_url'; if the page is not in the 'pages' array, it will use 'new\_url'.

<pre><code class="language-php">
\$wiki->setRenderConf('xhtml', 'wikilink', 'view\_url',
	'http://example.php/view.php?page=\%s');
	
\$wiki->setRenderConf('xhtml', 'wikilink', 'new\_url',
	'http://example.php/new.php?page=\%s');
</code></pre>
\begin{quote}
\textbf{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.


\end{quote}
Finally, if the page exists, Text\_Wiki will make the page name itself a link.  If the page does not exist, Text\_Wiki will add some text after the page name and make that clickable instead (leading to the 'new\_url').  Normally the 'new\_text' is just a question mark, but you can place any literal text you like.

<pre><code class="language-php">
// make the new\_text a tilde
\$wiki->setRenderConf('xhtml', 'wikilink', 'new\_text', '\textasciitilde{}');

// make the new\_text an image tag
\$wiki->setRenderConf('xhtml', 'wikilink', 'new\_text',
	'<img src="new\_page.jpg" />');
</code></pre>
\end{document}
