Issue:Undesired vertical bar inserted in userformat mode output.

From FollowTheScore
Jump to: navigation, search
Description: Undesired vertical bar inserted in userformat mode output.
Extension / Version: DPL   /   1.7.4
Type / Status: Bug   /   open

Problem

My wiki has pages with templates with templates such as the following:

{{mytemplate
|parm1=parm1value
|parm2=parm2value
|parm3=parm3value
}}

I am attempting to generate a list of all uses of 'mytemplate' where parm1 = parmvalue1. I want the list to display the values of two other parameters of the template with separators that I can specify using other parameters. I'm attempting to use the following query:

{{#dpl:
|uses=Template:mytemplate
|mode=userformat
|includematch=/\s*parm1\s*=\s*parm1value/s
|includepage={mytemplate}:parm2:parm3
}}

I want it to give me the following output:

parm2valueparm3value

...and then let me specify what separators to put between them.

However, the query produces the following output:

parm2value
|parm3value

The code in includeTemplate() is inserting a vertical bar and newline into the output, apparently presuming that the output is being used to form a template call. But when I specify mode=userformat, I don't want DPL to add any formatting; I want to do that myself.

Reply

Thank you for the precise explanation. I see your problem: indeed DPL assumes that this kind of output will become part of a tabular report. Please have also in mind that a page might use a template more than once (with different parameters, presumably). In that case DPL inserts not only pipe symbols but an additional html-br-tag for separation purpose (as far as I remember).

I recommend that you think of the pipe symbol as a separator symbol which DPL inserts to make clear where different "items" within the result start and end. If you do not want the pipe char as a symbol in your output you can use a #replace function call to throw it away or to replace it by a space or whatever you feel would be appropriate. I recommend to use debug=5 if you get lost - sometimes it is not easy to understand why some formatting does not work as expected. debug=5 will wrap the output in nowiki-tags so that you see unwanted characters in the output text.

Good luck! Gero 21:43, 26 April 2010 (UTC)