From: Andrew Garrett "; }
else { $result = ''; }
return $result;
@@ -1955,6 +1955,7 @@ class Parser
/* private */ function nextItem( $char ) {
if ( '*' === $char || '#' === $char ) { return '
"; } elseif ( ':' === $char || ';' === $char ) { $close = ''; if ( $this->mDTopen ) { $close = ''; } @@ -1972,6 +1973,7 @@ class Parser /* private */ function closeList( $char ) { if ( '*' === $char ) { $text = ''; } elseif ( '#' === $char ) { $text = ''; } + elseif ( '>' === $char ) { $text = "
"; } elseif ( ':' === $char ) { if ( $this->mDTopen ) { $this->mDTopen = false; @@ -2017,14 +2019,23 @@ class Parser // # = ol // ; = dt // : = dd + // > = blockquote $lastPrefixLength = strlen( $lastPrefix ); $preCloseMatch = preg_match('/<\\/pre/i', $oLine ); $preOpenMatch = preg_match('/> for blockquote syntax. Re-encode later. + // To avoid collision with real >s, we temporarily convert them to > + // This is a weird choice of armouring, but it's totally resistant to any + // collision. + $orig = $oLine; + $oLine = strtr( $oLine, array( '>' => '>', '>' => '>' ) ); + // If not in aelement, scan for and figure out what prefixes are there. if ( !$this->mInPre ) { # Multiple prefixes may abut each other for nested lists. - $prefixLength = strspn( $oLine, '*#:;' ); + $prefixLength = strspn( $oLine, '*#:;>' ); $prefix = substr( $oLine, 0, $prefixLength ); # eh? @@ -2040,6 +2051,9 @@ class Parser $prefix = $prefix2 = ''; $t = $oLine; } + + // Re-encode >s now + $t = strtr( $t, array( '>' => '>', '>' => '>' ) ); # List generation if( $prefixLength && $lastPrefix === $prefix2 ) { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 3771941b6c..e7ebd96e38 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -6550,9 +6550,9 @@ RAW magic word !! test Always escape literal '>' in output, not just after '<' !! input -><> +test ><> !! result -><> +
test ><>
!! end @@ -7320,6 +7320,24 @@ wgUseDynamicDates=true !! end +!! test +Leading > blockquote syntax +!! input +> Hi +> This +> Is +> A +> Quote +!! result ++ +!! end + # # #Hi +
This +
Is +
A +
Quote +