diff -r f0431eb8161e -r 98c052fc3337 includes/wikiengine/render_xhtml.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/wikiengine/render_xhtml.php Sun Jun 21 00:20:32 2009 -0400
@@ -0,0 +1,133 @@
+ '',
+ 'templates' => '',
+ 'bold' => '\\1',
+ 'italic' => '\\1',
+ 'underline' => '\\1',
+ 'externalwithtext' => '\\2',
+ 'externalnotext' => '\\1',
+ );
+
+ public function heading($text, $pieces)
+ {
+ static $tocid = -1;
+ foreach ( $pieces as $i => $piece )
+ {
+ $tocid++;
+ $tag = '';
+ $tag .= trim($piece['text']);
+ $tag .= '';
+
+ $text = str_replace(Carpenter::generate_token($i), $tag, $text);
+ }
+
+ return $text;
+ }
+
+ public function multilist($text, $pieces)
+ {
+ foreach ( $pieces as $i => $piece )
+ {
+ switch($piece['type'])
+ {
+ case 'unordered':
+ default:
+ $btag = 'ul';
+ $itag = 'li';
+ break;
+ case 'ordered':
+ $btag = 'ol';
+ $itag = 'li';
+ break;
+ case 'indent':
+ $btag = 'dl';
+ $itag = 'dd';
+ break;
+ }
+ $list = "<$btag><_paragraph_bypass>\n";
+ $spacing = '';
+ $depth = 1;
+ foreach ( $piece['items'] as $j => $item )
+ {
+ // most of this just goes into pretty formatting.
+ // everything else goes into meeting the PITA requirement that if you're going
+ // another level deep, HTML requires the next level to be INSIDE of the
/ tag.
+ $itemdepth = $item['depth'];
+ if ( $itemdepth > $depth )
+ {
+ while ( $depth < $itemdepth )
+ {
+ $spacing .= ' ';
+ $list .= "{$spacing}<$btag>\n";
+ $depth++;
+ }
+ }
+ else if ( $itemdepth < $depth )
+ {
+ while ( $depth > $itemdepth )
+ {
+ $list .= "{$spacing}$btag>\n";
+ $spacing = substr($spacing, 4);
+ $list .= "{$spacing}$itag>\n";
+ $spacing = substr($spacing, 4);
+ $depth--;
+ }
+ }
+ $list .= "{$spacing} <$itag>" . nl2br($item['text']);
+ if ( ( isset($piece['items'][ ++$j ]) && $piece['items'][ $j ]['depth'] <= $itemdepth ) || !isset($piece['items'][ $j ]) )
+ {
+ $list .= "$itag>\n";
+ }
+ else
+ {
+ $list .= "\n";
+ $spacing .= " ";
+ }
+ }
+ while ( $depth > 1 )
+ {
+ $list .= "{$spacing}$btag>\n";
+ $spacing = substr($spacing, 4);
+ $list .= "{$spacing}$itag>\n";
+ $spacing = substr($spacing, 4);
+ $depth--;
+ }
+ $list .= "$btag>\n";
+ $text = str_replace(Carpenter::generate_token($i), $list, $text);
+ }
+ return $text;
+ }
+
+ public function paragraph($text, $pieces)
+ {
+ foreach ( $pieces as $i => $piece )
+ {
+ $text = str_replace(Carpenter::generate_token($i), '' . nl2br($piece) . '
', $text);
+ }
+
+ return $text;
+ }
+}
+
+// Alias internal link parsing to RenderMan's method
+function parser_mediawiki_xhtml_internallink($text)
+{
+ return RenderMan::parse_internal_links($text);
+}
+