--- a/includes/wikiengine/parse_mediawiki.php Tue Aug 04 15:02:00 2009 -0400
+++ b/includes/wikiengine/parse_mediawiki.php Tue Aug 04 15:02:54 2009 -0400
@@ -133,7 +133,7 @@
foreach ( $items as $item )
{
// get the depth
- $itemtoken = preg_replace('/[^#:\*].*$/', '', $item);
+ $itemtoken = preg_replace('/^([#:\*]+).*$/s', '$1', $item);
// get the text
$itemtext = trim(substr($item, strlen($itemtoken)));
$piece['items'][] = array(
@@ -142,7 +142,6 @@
'text' => $itemtext
);
}
-
$pieces[] = $piece;
}
@@ -151,6 +150,19 @@
return $pieces;
}
+ public function blockquote(&$text)
+ {
+ if ( !preg_match_all('/^(?:(>+) *.+(?:\r?\n|$))+/m', $text, $quotes) )
+ return array();
+
+ $pieces = array();
+ foreach ( $quotes[0] as $quote )
+ $pieces[] = "\t" . trim(preg_replace('/^>+ */m', "\t", $quote));
+
+ $text = Carpenter::tokenize($text, $quotes[0]);
+ return $pieces;
+ }
+
public function paragraph(&$text)
{
// The trick with paragraphs is to not turn things into them when a block level element already wraps the block of text.
@@ -158,7 +170,9 @@
$blocklevel = 'address|blockquote|center|code|div|dl|fieldset|form|h1|h2|h3|h4|h5|h6|hr|li|ol|p|pre|table|ul|tr|td|th|tbody|thead|tfoot';
// Wrap all block level tags
+ RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);
$text = preg_replace("/<($blocklevel)(?: .+?>|>)(?:(?R)|.*?)<\/\\1>/s", '<_paragraph_bypass>$0</_paragraph_bypass>', $text);
+ RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
// This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
// to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.