Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -1635,8 +1635,8 @@ |
1636 | 1636 | *[[Wikipedia:ro:Olteniţa]] |
1637 | 1637 | *[[Wikipedia:ro:Olteniţa]] |
1638 | 1638 | !! result |
1639 | | -<ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
1640 | | -</li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
| 1639 | +<ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Oltenita">Wikipedia:ro:Olteniţa</a> |
| 1640 | +</li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Oltenita">Wikipedia:ro:Olteniţa</a> |
1641 | 1641 | </li></ul> |
1642 | 1642 | |
1643 | 1643 | !! end |
— | — | @@ -3394,7 +3394,7 @@ |
3395 | 3395 | !! input |
3396 | 3396 | [[Image:foobar.jpg|♀]] |
3397 | 3397 | !! result |
3398 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3398 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="?"><img alt="?" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3399 | 3399 | </p> |
3400 | 3400 | !! end |
3401 | 3401 | |
— | — | @@ -3537,7 +3537,7 @@ |
3538 | 3538 | [[fr:Nourriture]] |
3539 | 3539 | [[zh:食品]] |
3540 | 3540 | !! result |
3541 | | -es:Alimento fr:Nourriture zh:食品 |
| 3541 | +es:Alimento fr:Nourriture zh:?? |
3542 | 3542 | !! end |
3543 | 3543 | |
3544 | 3544 | ### |
— | — | @@ -5252,19 +5252,17 @@ |
5253 | 5253 | </p> |
5254 | 5254 | !! end |
5255 | 5255 | |
5256 | | -# Original result was this: |
5257 | | -# <p><b>bold</b><b>bold<i>bolditalics</i></b> |
| 5256 | +# This was the original html, but it has also been |
| 5257 | +# <p>'<i>bold'</i><b>bold<i>bolditalics</i></b> |
5258 | 5258 | # </p> |
5259 | | -# While that might be marginally more intuitive, maybe, the six-apostrophe |
5260 | | -# construct is clearly pathological and the result stated here (which is what |
5261 | | -# the parser actually does) is about as reasonable as anything. |
| 5259 | +# See bug 18765. |
5262 | 5260 | !!test |
5263 | 5261 | Mixing markup for italics and bold |
5264 | 5262 | !! options |
5265 | 5263 | !! input |
5266 | 5264 | '''bold''''''bold''bolditalics''''' |
5267 | 5265 | !! result |
5268 | | -<p>'<i>bold'</i><b>bold<i>bolditalics</i></b> |
| 5266 | +<p><b>bold</b><b>bold<i>bolditalics</i></b> |
5269 | 5267 | </p> |
5270 | 5268 | !! end |
5271 | 5269 | |
— | — | @@ -6746,9 +6744,9 @@ |
6747 | 6745 | !! options |
6748 | 6746 | title=[[Dunav]] language=sr |
6749 | 6747 | !! input |
6750 | | -Both [[Dunav]] and [[Дунав]] are names for this river. |
| 6748 | +Both [[Dunav]] and [[?????]] are names for this river. |
6751 | 6749 | !! result |
6752 | | -<p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river. |
| 6750 | +<p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">?????</strong> are names for this river. |
6753 | 6751 | </p> |
6754 | 6752 | !!end |
6755 | 6753 | |
— | — | @@ -6758,9 +6756,9 @@ |
6759 | 6757 | !! options |
6760 | 6758 | language=sr |
6761 | 6759 | !! input |
6762 | | -Main Page can be written as [[Маин Паге]] |
| 6760 | +Main Page can be written as [[???? ????]] |
6763 | 6761 | !! result |
6764 | | -<p>Main Page can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> |
| 6762 | +<p>Main Page can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">???? ????</a> |
6765 | 6763 | </p> |
6766 | 6764 | !!end |
6767 | 6765 | |
— | — | @@ -6770,9 +6768,9 @@ |
6771 | 6769 | !! options |
6772 | 6770 | language=sr |
6773 | 6771 | !! input |
6774 | | -[[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. |
| 6772 | +[[Main Page]] can be written as [[???? ????]] same as [[???? ????]]. |
6775 | 6773 | !! result |
6776 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a>. |
| 6774 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">???? ????</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">???? ????</a>. |
6777 | 6775 | </p> |
6778 | 6776 | !!end |
6779 | 6777 | |
— | — | @@ -6782,7 +6780,7 @@ |
6783 | 6781 | !! options |
6784 | 6782 | language=sr |
6785 | 6783 | !! input |
6786 | | -{{тест}} |
| 6784 | +{{????}} |
6787 | 6785 | !! result |
6788 | 6786 | <p>This is a test template |
6789 | 6787 | </p> |
— | — | @@ -6794,7 +6792,7 @@ |
6795 | 6793 | !! options |
6796 | 6794 | language=sr |
6797 | 6795 | !! input |
6798 | | -{{Template:тест}} |
| 6796 | +{{Template:????}} |
6799 | 6797 | !! result |
6800 | 6798 | <p>This is a test template |
6801 | 6799 | </p> |
— | — | @@ -6806,7 +6804,7 @@ |
6807 | 6805 | !! options |
6808 | 6806 | language=sr |
6809 | 6807 | !! input |
6810 | | -{{парамтест|param=foo}} |
| 6808 | +{{?????????|param=foo}} |
6811 | 6809 | !! result |
6812 | 6810 | <p>This is a test template with parameter foo |
6813 | 6811 | </p> |
— | — | @@ -6818,9 +6816,9 @@ |
6819 | 6817 | !! options |
6820 | 6818 | language=sr cat |
6821 | 6819 | !! input |
6822 | | -[[Category:МедиаWики Усер'с Гуиде]] |
| 6820 | +[[Category:?????W??? ????'? ?????]] |
6823 | 6821 | !! result |
6824 | | -<a href="https://www.mediawiki.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a> |
| 6822 | +<a href="https://www.mediawiki.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="??????????:MediaWiki User's Guide">MediaWiki User's Guide</a> |
6825 | 6823 | !! end |
6826 | 6824 | |
6827 | 6825 | |
— | — | @@ -6843,7 +6841,7 @@ |
6844 | 6842 | !! input |
6845 | 6843 | Latinski: -{Ne nuntium necare}- |
6846 | 6844 | !! result |
6847 | | -<p>Латински: Ne nuntium necare |
| 6845 | +<p>????????: Ne nuntium necare |
6848 | 6846 | </p> |
6849 | 6847 | !! end |
6850 | 6848 | |
— | — | @@ -6855,7 +6853,7 @@ |
6856 | 6854 | !! input |
6857 | 6855 | Latinski: -{Ne nuntium necare}- |
6858 | 6856 | !! result |
6859 | | -<p>Латински: Ne nuntium necare |
| 6857 | +<p>????????: Ne nuntium necare |
6860 | 6858 | </p> |
6861 | 6859 | !! end |
6862 | 6860 | |
— | — | @@ -6879,7 +6877,7 @@ |
6880 | 6878 | !! input |
6881 | 6879 | == -{Naslov}- == |
6882 | 6880 | !! result |
6883 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2> |
| 6881 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="????? ???: Naslov">?????</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2> |
6884 | 6882 | |
6885 | 6883 | !! end |
6886 | 6884 | |
— | — | @@ -6979,7 +6977,7 @@ |
6980 | 6978 | !! input |
6981 | 6979 | Fridrih IV je car. |
6982 | 6980 | !! result |
6983 | | -<p>Фридрих IV је цар. |
| 6981 | +<p>??????? IV ?? ???. |
6984 | 6982 | </p> |
6985 | 6983 | !! end |
6986 | 6984 | |
— | — | @@ -7056,23 +7054,23 @@ |
7057 | 7055 | language=cs |
7058 | 7056 | title=[[Main Page]] |
7059 | 7057 | !! input |
7060 | | -{{PRVNÍVELKÉ:ěščř}} |
7061 | | -{{prvnívelké:ěščř}} |
7062 | | -{{PRVNÍMALÉ:ěščř}} |
7063 | | -{{prvnímalé:ěščř}} |
7064 | | -{{MALÁ:ěščř}} |
7065 | | -{{malá:ěščř}} |
7066 | | -{{VELKÁ:ěščř}} |
7067 | | -{{velká:ěščř}} |
| 7058 | +{{PRVNÍVELKÉ:ešcr}} |
| 7059 | +{{prvnívelké:ešcr}} |
| 7060 | +{{PRVNÍMALÉ:ešcr}} |
| 7061 | +{{prvnímalé:ešcr}} |
| 7062 | +{{MALÁ:ešcr}} |
| 7063 | +{{malá:ešcr}} |
| 7064 | +{{VELKÁ:ešcr}} |
| 7065 | +{{velká:ešcr}} |
7068 | 7066 | !! result |
7069 | | -<p>Ěščř |
7070 | | -Ěščř |
7071 | | -ěščř |
7072 | | -ěščř |
7073 | | -ěščř |
7074 | | -ěščř |
7075 | | -ĚŠČŘ |
7076 | | -ĚŠČŘ |
| 7067 | +<p>Ešcr |
| 7068 | +Ešcr |
| 7069 | +ešcr |
| 7070 | +ešcr |
| 7071 | +ešcr |
| 7072 | +ešcr |
| 7073 | +EŠCR |
| 7074 | +EŠCR |
7077 | 7075 | </p> |
7078 | 7076 | !! end |
7079 | 7077 | |
— | — | @@ -7339,7 +7337,7 @@ |
7340 | 7338 | !! input |
7341 | 7339 | [http://en.wikipedia.org/] |
7342 | 7340 | !! result |
7343 | | -<p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a> |
| 7341 | +<p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[?]</a> |
7344 | 7342 | </p> |
7345 | 7343 | !! end |
7346 | 7344 | |
— | — | @@ -7466,7 +7464,7 @@ |
7467 | 7465 | !! input |
7468 | 7466 | /* External links */ removed bogus entries |
7469 | 7467 | !! result |
7470 | | -<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries |
| 7468 | +<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#External_links" title="Main Page">?</a>External links: </span> removed bogus entries |
7471 | 7469 | !!end |
7472 | 7470 | |
7473 | 7471 | !! test |
— | — | @@ -7476,7 +7474,7 @@ |
7477 | 7475 | !! input |
7478 | 7476 | /* External links */ removed bogus entries |
7479 | 7477 | !! result |
7480 | | -<span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries |
| 7478 | +<span class="autocomment"><a href="#External_links">?</a>External links: </span> removed bogus entries |
7481 | 7479 | !!end |
7482 | 7480 | |
7483 | 7481 | !! test |
— | — | @@ -7537,10 +7535,86 @@ |
7538 | 7536 | <a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">#section</a> |
7539 | 7537 | !! end |
7540 | 7538 | |
| 7539 | +!! test |
| 7540 | +Bold/italic markup handled differently depending on leading whitespace (bug 18765) |
| 7541 | +!!input |
| 7542 | +'''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7543 | + |
| 7544 | +<!-- Comment -->'''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7545 | + |
| 7546 | +<span> '''Look at ''this edit'''s complicated bold/italic markup!'''</span> |
| 7547 | + |
| 7548 | +<nowiki></nowiki> '''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7549 | + |
| 7550 | +<!-- Hello world---> '''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7551 | + |
| 7552 | +{| |
| 7553 | +| '''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7554 | +|} |
| 7555 | + |
| 7556 | +'''This was Italic'' this was plain''' and this was bold''' |
| 7557 | +but '''This is bold'' this is bold italic''' and this is bold''' |
| 7558 | + |
| 7559 | +<!-- Wishlist: Breaking because <span> and | are treated as text |
| 7560 | +<span>'''Look at ''this edit'''s complicated bold/italic markup!'''</span> |
| 7561 | +{| |
| 7562 | +|'''Look at ''this edit'''s complicated bold/italic markup!''' |
| 7563 | +|} |
| 7564 | +--> |
| 7565 | +!! result |
| 7566 | +<p><b>Look at <i>this edit'</i>s complicated bold/italic markup!</b> |
| 7567 | +</p><p><b>Look at <i>this edit'</i>s complicated bold/italic markup!</b> |
| 7568 | +</p><p><span> <b>Look at <i>this edit'</i>s complicated bold/italic markup!</b></span> |
| 7569 | +</p><p> <b>Look at <i>this edit'</i>s complicated bold/italic markup!</b> |
| 7570 | +</p> |
| 7571 | +<pre><b>Look at <i>this edit'</i>s complicated bold/italic markup!</b> |
| 7572 | +</pre> |
| 7573 | +<table> |
| 7574 | +<tr> |
| 7575 | +<td> <b>Look at <i>this edit'</i>s complicated bold/italic markup!</b> |
| 7576 | +</td></tr></table> |
| 7577 | +<p><b>This was Italic<i> this was plain'</i> and this was bold</b> |
| 7578 | +but <b>This is bold<i> this is bold italic'</i> and this is bold</b> |
| 7579 | +</p><p><br /> |
| 7580 | +</p> |
| 7581 | +!! end |
| 7582 | + |
| 7583 | +!! test |
| 7584 | +Six quotes |
| 7585 | +!!input |
| 7586 | +''Italic''''''Bold |
| 7587 | + |
| 7588 | +'''Bold''BoldItalic''''''Normal |
| 7589 | + |
| 7590 | +''Italic'''BoldItalic''''''Normal''''' |
| 7591 | + |
| 7592 | +'''''BoldItalic''''''MoreBoldItalic'' |
| 7593 | + |
| 7594 | +''''''Normal |
| 7595 | +!!result |
| 7596 | +<p><i>Italic'</i><b>Bold</b> |
| 7597 | +</p><p><b>Bold<i>BoldItalic'</i></b>Normal |
| 7598 | +</p><p><i>Italic<b>BoldItalic'</b></i>Normal |
| 7599 | +</p><p><i><b>BoldItalic</b><b>MoreBoldItalic</b></i> |
| 7600 | +</p><p>Normal |
| 7601 | +</p> |
| 7602 | +!!end |
| 7603 | + |
| 7604 | + |
| 7605 | +!! test |
| 7606 | +Too many quotes |
| 7607 | +!!input |
| 7608 | +I '''like'''''quotes''''''''''' |
| 7609 | +!! result |
| 7610 | +<p>I <b>like</b><i>quotes''''''</i><b> </b> |
| 7611 | +</p> |
| 7612 | +!! end |
| 7613 | + |
| 7614 | + |
| 7615 | + |
| 7616 | + |
7541 | 7617 | TODO: |
7542 | 7618 | more images |
7543 | 7619 | more tables |
7544 | 7620 | math |
7545 | | -character entities |
7546 | | -and much more |
7547 | | -Try for 100% code coverage |
| 7621 | +char |
\ No newline at end of file |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1114,6 +1114,7 @@ |
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | /** |
| 1118 | + * Processes bolds and italics on a single line. |
1118 | 1119 | * Helper function for doAllQuotes() |
1119 | 1120 | */ |
1120 | 1121 | public function doQuotes( $text ) { |
— | — | @@ -1139,18 +1140,19 @@ |
1140 | 1141 | $arr[$i-1] .= "'"; |
1141 | 1142 | $arr[$i] = "'''"; |
1142 | 1143 | } |
1143 | | - # If there are more than 5 apostrophes in a row, assume they're all |
1144 | | - # text except for the last 5. |
1145 | | - else if ( strlen( $arr[$i] ) > 5 ) |
| 1144 | + # If there are more than 6 apostrophes in a row, assume they're all |
| 1145 | + # text except for the last 6. |
| 1146 | + else if ( strlen( $arr[$i] ) > 6 ) |
1146 | 1147 | { |
1147 | | - $arr[$i-1] .= str_repeat( "'", strlen( $arr[$i] ) - 5 ); |
1148 | | - $arr[$i] = "'''''"; |
| 1148 | + $arr[$i-1] .= str_repeat( "'", strlen( $arr[$i] ) - 6 ); |
| 1149 | + $arr[$i] = "''''''"; |
1149 | 1150 | } |
1150 | 1151 | # Count the number of occurrences of bold and italics mark-ups. |
1151 | 1152 | # We are not counting sequences of five apostrophes. |
1152 | 1153 | if ( strlen( $arr[$i] ) == 2 ) { $numitalics++; } |
1153 | 1154 | else if ( strlen( $arr[$i] ) == 3 ) { $numbold++; } |
1154 | 1155 | else if ( strlen( $arr[$i] ) == 5 ) { $numitalics++; $numbold++; } |
| 1156 | + else if ( strlen( $arr[$i] ) == 6 ) { $numbold+=2; } |
1155 | 1157 | } |
1156 | 1158 | $i++; |
1157 | 1159 | } |
— | — | @@ -1162,11 +1164,17 @@ |
1163 | 1165 | if ( ( $numbold % 2 == 1 ) && ( $numitalics % 2 == 1 ) ) |
1164 | 1166 | { |
1165 | 1167 | $i = 0; |
| 1168 | + |
| 1169 | + #These are indexes to the /next/ array entry than the |
| 1170 | + #one holding the text matching the condition. |
1166 | 1171 | $firstsingleletterword = -1; |
1167 | 1172 | $firstmultiletterword = -1; |
1168 | 1173 | $firstspace = -1; |
| 1174 | + |
1169 | 1175 | foreach ( $arr as $r ) |
1170 | 1176 | { |
| 1177 | + #Filter the "'''". Separators are on odd positions. |
| 1178 | + #$arr[0] will be an empty string if needed. |
1171 | 1179 | if ( ( $i % 2 == 1 ) and ( strlen( $r ) == 3 ) ) |
1172 | 1180 | { |
1173 | 1181 | $x1 = substr ($arr[$i-1], -1); |
— | — | @@ -1175,7 +1183,7 @@ |
1176 | 1184 | if ($firstspace == -1) $firstspace = $i; |
1177 | 1185 | } else if ($x2 === ' ') { |
1178 | 1186 | if ($firstsingleletterword == -1) $firstsingleletterword = $i; |
1179 | | - } else { |
| 1187 | + } else if ($arr[$i-1] != "") { |
1180 | 1188 | if ($firstmultiletterword == -1) $firstmultiletterword = $i; |
1181 | 1189 | } |
1182 | 1190 | } |
— | — | @@ -1205,9 +1213,9 @@ |
1206 | 1214 | } |
1207 | 1215 | |
1208 | 1216 | # Now let's actually convert our apostrophic mush to HTML! |
1209 | | - $output = ''; |
1210 | | - $buffer = ''; |
1211 | | - $state = ''; |
| 1217 | + $output = ''; #Processed text |
| 1218 | + $buffer = ''; #Content if $state is 'both' |
| 1219 | + $state = ''; #Flags with the order of open tags: '|b|i|bi|ib|both' |
1212 | 1220 | $i = 0; |
1213 | 1221 | foreach ($arr as $r) |
1214 | 1222 | { |
— | — | @@ -1261,6 +1269,21 @@ |
1262 | 1270 | else # ($state == '') |
1263 | 1271 | { $buffer = ''; $state = 'both'; } |
1264 | 1272 | } |
| 1273 | + else if (strlen ($r) == 6) |
| 1274 | + { |
| 1275 | + if ($state === 'b') |
| 1276 | + { $output .= '</b><b>'; $state = 'b'; } |
| 1277 | + else if ($state === 'i') |
| 1278 | + { $output .= '\'</i><b>'; $state = 'b'; } |
| 1279 | + else if ($state === 'bi') |
| 1280 | + { $output .= '\'</i></b>'; $state = ''; } |
| 1281 | + else if ($state === 'ib') |
| 1282 | + { $output .= '\'</b></i>'; $state = ''; } |
| 1283 | + else if ($state === 'both') |
| 1284 | + { $output .= '<i><b>'.$buffer.'</b><b>'; $state = 'ib'; } |
| 1285 | + else # ($state == '') |
| 1286 | + { $buffer = ''; $state = ''; } |
| 1287 | + } |
1265 | 1288 | } |
1266 | 1289 | $i++; |
1267 | 1290 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -704,6 +704,8 @@ |
705 | 705 | * (bug 9794) User rights log entries for foreign user now links to the foreign |
706 | 706 | user's page if possible |
707 | 707 | * (bug 14717) Don't load nonexistent CSS fix files for non-Monobook skins |
| 708 | +* (bug 18765) Increased consistency of bold-italic markup for unbalanced quotes. |
| 709 | + Improved representation of six quotes (may break existing markup). |
708 | 710 | |
709 | 711 | == API changes in 1.16 == |
710 | 712 | |