From b969249f1ffe130d37215d8431964bfac08dda42 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Thu, 5 Nov 2009 23:18:12 +0000 Subject: [PATCH] * removed some debug statements * added more testLang examples --- js2/mwEmbed/mv_embed.js | 24 ++++++++++++------------ js2/mwEmbed/tests/testLang.html | 27 ++++++++++++++++----------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index c35e692a30..e23409d3ac 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -371,7 +371,7 @@ if( !mv_embed_path ) { * Plural matchRuleTest */ function matchRuleTest(cRule, val){ - js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); + //js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val ); function checkValue(compare, val){ if(typeof compare == 'string'){ @@ -440,12 +440,12 @@ if( !mv_embed_path ) { for(var ruleInx in rs){ cRule = rs[ruleInx]; if( matchRuleTest( cRule, tObj.arg ) ){ - js_log("matched rule: " + ruleInx ); + //js_log("matched rule: " + ruleInx ); return getTempParamFromRuleInx(tObj, rCount ); } rCount ++; } - js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] ); + //js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] ); //return the last /"other" template param return tObj.param [ tObj.param.length -1 ]; } @@ -603,7 +603,7 @@ if( !mv_embed_path ) { // ... but I am having fun with recursion so here it is... // or at least mirror: http://www.mediawiki.org/wiki/Extension:Page_Object_Model - function rdpp ( txt , cn){ + function rdpp ( txt , cn){ var node = {}; //inspect each char for(var a=0; a < txt.length; a++){ @@ -614,18 +614,18 @@ if( !mv_embed_path ) { node['c'] = new Array(); node['c'].push( rdpp( txt.substr( a ), true ) ); - }else if( txt[a] == '}' && txt[a+1] == '}'){ + }else if( txt[a] == '}' && txt[a+1] == '}'){ + a=a+2; if( !node['p'] ){ return node; - } - node = node['p']; - a=a+2; + } + node = node['p']; } if(!node['t']) node['t']=''; - - if( txt[a] ) - node['t']+=txt[a]; + //dont put closures into output: + if( txt[a] && txt[a]!='}' ) + node['t'] += txt[a]; } return node; @@ -648,7 +648,7 @@ if( !mv_embed_path ) { tObj["arg"] = tname.split(':').pop(); } - js_log("TNAME::" + tObj["name"] + ' from:: ' + ts); + //js_log("TNAME::" + tObj["name"] + ' from:: ' + ts); var pSet = ts.split('\|'); pSet.splice(0,1); if( pSet.length ){ diff --git a/js2/mwEmbed/tests/testLang.html b/js2/mwEmbed/tests/testLang.html index f129ce90cf..d20c098574 100644 --- a/js2/mwEmbed/tests/testLang.html +++ b/js2/mwEmbed/tests/testLang.html @@ -10,7 +10,7 @@ td{