https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113909

Revision: 113909
Author:   gwicke
Date:     2012-03-15 11:43:49 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
Enable support for block-level wiki constructs in template arguments. This
gets a bit closer to supporting table fragments passed through template
arguments. Next, we'll need a way to indicate start-of-line position to
enable sol block-levels in template parameters. 

Example:

{|
{{#if: true|{{!}}Table cell|}}
|}

Modified Paths:
--------------
    trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js
    trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt

Modified: 
trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js
===================================================================
--- trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js     
2012-03-15 11:33:48 UTC (rev 113908)
+++ trunk/extensions/VisualEditor/modules/parser/mediawiki.tokenizer.peg.js     
2012-03-15 11:43:49 UTC (rev 113909)
@@ -12,6 +12,7 @@
        fs = require('fs'),
        $ = require('jquery'),
        events = require('events'),
+       //colors = require('colors'),
        defines = require('./mediawiki.parser.defines.js');
 
 function PegTokenizer() {

Modified: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt
===================================================================
--- trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt 
2012-03-15 11:33:48 UTC (rev 113908)
+++ trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt 
2012-03-15 11:43:49 UTC (rev 113909)
@@ -432,17 +432,17 @@
  * The actual contents of each block.
  */
 block
-  =   block_lines
+  = block_lines
     / & '<' r:( pre // tag variant can start anywhere
             / comment &eolf
             / nowiki
             // avoid a paragraph if we know that the line starts with a block 
tag
             / bt:block_tag { return [bt] } 
             ) { return r; }
-    / para
+    / paragraph
     // Inlineline includes generic tags; wrapped into paragraphs in token
     // transform and DOM postprocessor
-    / inlineline 
+    / inlineline
     / sol
 
 /*
@@ -484,9 +484,9 @@
 /*
  * A paragraph. We don't emit 'p' tokens to avoid issues with template
  * transclusions, <p> tags in the source and the like. Instead, we perform
- * some paragraph wrapping on the DOM.
+ * some paragraph wrapping on the token stream and the DOM.
  */
-para
+paragraph
   = s1:sol s2:sol c:inlineline { 
       return s1.concat(s2, /* [new TagTk('p')],*/ c); 
   }
@@ -794,7 +794,7 @@
 // FIXME: handle template args and templates in key! (or even parser 
functions?)
 template_param_name
   = & { return stops.push( 'equal', true ) }
-    tpt:template_param_text
+    tpt:(template_param_text / &'=' { return '' })
     {
         stops.pop( 'equal' );
         //console.warn( 'template param name matched: ' + pp( tpt ) );
@@ -815,8 +815,14 @@
   / & { return stops.pop( 'equal' ) }
 
 template_param_text
-  = & { stops.push('table', false ); return stops.inc('template') }
-    il:( inline / nested_block )+ {
+  = & { /*console.warn( 'tpt: ' + 
+          input.substr( pos - 10, 9) + 
+          input[pos].green +
+          input.substr( pos +1, 9) ); */
+        stops.push('table', false ); 
+        return stops.inc('template') 
+    }
+    il:nested_block+ {
         stops.pop('table');
         stops.dec('template');
         //console.warn( 'tpt match: ' + pp (il));


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to