Difference between revisions of "Issue:Html-comments in parameter names"

From FollowTheScore
Jump to: navigation, search
(New page: {{Issue |Type = Bug |Extension = DPL |Version = 1.7.4 |Description = parameters like <tt><nowiki>|</nowiki> parametername <nowiki><!-- comment --></nowiki> =</tt> behave u...)
 
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
  |Extension  = DPL
 
  |Extension  = DPL
 
  |Version    = 1.7.4
 
  |Version    = 1.7.4
  |Description = parameters like <tt><nowiki>|</nowiki> parametername <nowiki><!-- comment --></nowiki> =</tt> behave unlike standard Wiki-syntax
+
  |Description = parameters which contain html/xml comments behave unlike standard Wiki-syntax
  |Status      = open
+
  |Status      = closed
 
}}
 
}}
  
Line 33: Line 33:
 
Sorry for my lack of English. I hope you understand my problem. Greetings --[[User:WiMu|WiMu]] 10:44, 4 May 2009 (UTC)
 
Sorry for my lack of English. I hope you understand my problem. Greetings --[[User:WiMu|WiMu]] 10:44, 4 May 2009 (UTC)
 
== Reply ==
 
== Reply ==
 +
 +
You are right, DPL currently is not aware of comments which might be embedded within template parameter assignments.
 +
You can change this with the following patch in line 540ff of ''DynamicPageList2Include.php'':
 +
 +
<pre>
 +
          if (!$found) {
 +
            // named parameter
 +
            $exParmQuote = str_replace('/','\/',$exParm);
 +
            foreach ($parms as $parm) {
 +
              if (!preg_match("/^\s*$exParmQuote\s*(<!--.*-->)*\s*=/",$parm)) continue;
 +
              $found=true;
 +
              $output[$n] .= $dpl->formatTemplateArg(preg_replace("/^$exParmQuote\s*(<!--.*-->)*\s*=\s*/","",$parm),$dplNr,$exParmKey,$firstCall,$maxlen);
 +
              break;
 +
            }
 +
          }
 +
</pre>
 +
 +
I will make this change part of the next release. 22:52, 5 May 2009 (UTC)

Latest revision as of 21:20, 7 June 2009

Description: parameters which contain html/xml comments behave unlike standard Wiki-syntax
Extension / Version: DPL   /   1.7.4
Type / Status: Bug   /   closed

Problem

With standard Wiki-syntax it is possible to use comments ahead the equal sign. Consider a template call like:

{{Infobox Country or territory
| area                <!-- in km²        --> =
| population_estimate <!-- other comment --> =
}}

The result will be the same as without the comments (so the comments are completely ignored). The DPL query does not work like this and the result of the query below will be an empty string:

{{#dpl:
| mode = userformat
| ...
| include = {Infobox Country or territory}:area
}}

The parameter names have to be exactly like the template call, including the comment and whitespaces:

{{#dpl:
| mode = userformat
| ...
| include = {Infobox Country or territory}:area                «!-- in km²        --»
}}

Sorry for my lack of English. I hope you understand my problem. Greetings --WiMu 10:44, 4 May 2009 (UTC)

Reply

You are right, DPL currently is not aware of comments which might be embedded within template parameter assignments. You can change this with the following patch in line 540ff of DynamicPageList2Include.php:

           if (!$found) {
             // named parameter
             $exParmQuote = str_replace('/','\/',$exParm);
             foreach ($parms as $parm) {
               if (!preg_match("/^\s*$exParmQuote\s*(<!--.*-->)*\s*=/",$parm)) continue;
               $found=true;
               $output[$n] .= $dpl->formatTemplateArg(preg_replace("/^$exParmQuote\s*(<!--.*-->)*\s*=\s*/","",$parm),$dplNr,$exParmKey,$firstCall,$maxlen);
               break;
             }
           }

I will make this change part of the next release. 22:52, 5 May 2009 (UTC)