Merge "(bug 21660) "Pipe trick" full width commas (with test!)"
authorGWicke <gwicke@wikimedia.org>
Sun, 17 Jun 2012 12:26:45 +0000 (12:26 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 17 Jun 2012 12:26:45 +0000 (12:26 +0000)
1  2 
includes/parser/Parser.php
tests/parser/parserTests.txt

@@@ -2859,8 -2859,7 +2859,8 @@@ class Parser 
                                $value = $pageLang->formatNum( SiteStats::edits() );
                                break;
                        case 'numberofviews':
 -                              $value = $pageLang->formatNum( SiteStats::views() );
 +                              global $wgDisableCounters;
 +                              $value = !$wgDisableCounters ? $pageLang->formatNum( SiteStats::views() ) : '';
                                break;
                        case 'currenttimestamp':
                                $value = wfTimestamp( TS_MW, $ts );
  
                $p1 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\))\\|]]/";           # [[ns:page (context)|]]
                $p4 = "/\[\[(:?$nc+:|:|)($tc+?)( ?($tc+))\\|]]/";           # [[ns:page(context)|]]
-               $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\)|)($tc+|)\\|]]/"; # [[ns:page (context), context|]]
+               $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\)|)((?:, |,)$tc+|)\\|]]/"; # [[ns:page (context), context|]]
                $p2 = "/\[\[\\|($tc+)]]/";                                      # [[|page]]
  
                # try $p1 first, to turn "[[A, B (C)|]]" into "[[A, B (C)|A, B]]"
@@@ -640,17 -640,6 +640,17 @@@ Definition and unordered list using wik
  
  !! end
  
 +!! test
 +Definition list with empty definition and following paragraph
 +!! input
 +; term:
 +Paragraph text
 +!! result
 +<dl><dt> term</dt><dd>
 +</dd></dl>
 +<p>Paragraph text
 +</p>
 +!! end
  
  ###
  ### External links
@@@ -2124,8 -2113,6 +2124,8 @@@ Mixed lis
  **#Number on level 3
  *#number level 2
  *Level 1
 +*** Level 3
 +#** Level 3, but ordered
  !! result
  <ul><li>Mixed list
  <ol><li> with numbers
  <ol><li>number level 2
  </li></ol>
  </li><li>Level 1
 +<ul><li><ul><li> Level 3
  </li></ul>
 +</li></ul>
 +</li></ul>
 +<ol><li><ul><li><ul><li> Level 3, but ordered
 +</li></ul>
 +</li></ul>
 +</li></ol>
  
  !! end
  
 +!! test
 +Nested lists 1
 +!! input
 +*foo
 +**bar
 +!! result
 +<ul><li>foo
 +<ul><li>bar
 +</li></ul>
 +</li></ul>
 +
 +!! end
 +
 +!! test
 +Nested lists 2
 +!! input
 +**foo
 +*bar
 +!! result
 +<ul><li><ul><li>foo
 +</li></ul>
 +</li><li>bar
 +</li></ul>
 +
 +!! end
 +
 +!! test
 +Nested lists 3 (first element empty)
 +!! input
 +*
 +**bar
 +!! result
 +<ul><li>
 +<ul><li>bar
 +</li></ul>
 +</li></ul>
 +
 +!! end
 +
 +!! test
 +Nested lists 4 (first element empty)
 +!! input
 +**
 +*bar
 +!! result
 +<ul><li><ul><li>
 +</li></ul>
 +</li><li>bar
 +</li></ul>
 +
 +!! end
 +
 +!! test
 +Nested lists 5 (both elements empty)
 +!! input
 +**
 +*
 +!! result
 +<ul><li><ul><li>
 +</li></ul>
 +</li><li>
 +</li></ul>
 +
 +!! end
 +
 +!! test
 +Nested lists 6 (both elements empty)
 +!! input
 +*
 +**
 +!! result
 +<ul><li>
 +<ul><li>
 +</li></ul>
 +</li></ul>
 +
 +!! end
 +
 +
  !! test
  List items are not parsed correctly following a <pre> block (bug 785)
  !! input
@@@ -2282,27 -2183,6 +2282,27 @@@ List items from templat
  
  !! end
  
 +!! test
 +List interrupted by empty line or heading
 +!! input
 +* foo
 +
 +** bar
 +== A heading ==
 +* Another list item
 +!! result
 +<ul><li> foo
 +</li></ul>
 +<ul><li><ul><li> bar
 +</li></ul>
 +</li></ul>
 +<h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2>
 +<ul><li> Another list item
 +</li></ul>
 +
 +!!end
 +
 +
  ###
  ### Magic Words
  ###
  [[Bar:Article(context)|]]
  [[:Bar:Article(context)|]]
  [[|Article(context)]]
- [[Bar:X (Y) Z|]]
- [[:Bar:X (Y) Z|]]
+ [[Bar:X(Y)Z|]]
+ [[:Bar:X(Y)Z|]]
  !! result
  [[Article(context)|Article]]
  [[Bar:Article(context)|Article]]
  [[:Bar:Article(context)|Article]]
  [[Article(context)]]
- [[Bar:X (Y) Z|X (Y) Z]]
- [[:Bar:X (Y) Z|X (Y) Z]]
+ [[Bar:X(Y)Z|X(Y)Z]]
+ [[:Bar:X(Y)Z|X(Y)Z]]
  !! end
  
  !! test
  [[:Bar:X(Y)Z|X(Y)Z]]
  !! end
  
+ !! test
+ pre-save transform: context links ("pipe trick") with commas (bug 21660)
+ !! options
+ pst
+ !! input
+ [[Article (context), context|]]
+ [[Article (context),context|]]
+ [[Bar:Article (context), context|]]
+ [[Bar:Article (context),context|]]
+ [[:Bar:Article (context), context|]]
+ [[:Bar:Article (context),context|]]
+ !! result
+ [[Article (context), context|Article]]
+ [[Article (context),context|Article]]
+ [[Bar:Article (context), context|Article]]
+ [[Bar:Article (context),context|Article]]
+ [[:Bar:Article (context), context|Article]]
+ [[:Bar:Article (context),context|Article]]
+ !! end
  !! test
  pre-save transform: trim trailing empty lines
  !! options
@@@ -9470,17 -9370,6 +9490,17 @@@ Language parser functio
  </p>
  !! end
  
 +!!test
 +Padleft and padright as substr
 +!! input
 +{{padleft:|3|abcde}}
 +{{padright:|3|abcde}}
 +!! result
 +<p>abc
 +abc
 +</p>
 +!! end
 +
  TODO:
  more images
  more tables