Jump to content
This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

General usage and invocation syntax: Difference between revisions

m
Make it clear here that the manual is being switched to being mostly in parser function method, since one of the complaints of the manual prior was that people didn’t know how to convert things easily because it was mostly done in parser extension method, when many more use cases need the parser function method. Also, I don’t want to have to explain or remind every example or page that the block quotes are not part of the output.
imported>FrozenPlum
(class=)
imported>FrozenPlum
m (Make it clear here that the manual is being switched to being mostly in parser function method, since one of the complaints of the manual prior was that people didn’t know how to convert things easily because it was mostly done in parser extension method, when many more use cases need the parser function method. Also, I don’t want to have to explain or remind every example or page that the block quotes are not part of the output.)
Line 15:
 
;Example syntax
<pre>
<blockquote><pre><nowiki>
<dpl>
category = cat1|cat2
Line 21:
linksto = myPage
</dpl>
</nowiki></pre></blockquote>
 
;Parsing procedure
Line 36:
* Generally the syntax looks fairly simple and intuitive as it doesn't contain special characters (except for the two embracing tags).
* Tag case doesn't matter, so it can also be written <code><nowiki><dpl></nowiki></code>.
* In many cases, there is no need to have macro expansion within the parameter list. Note that in the example above, the pipe character (which is used to define a logical OR between the two categories) can be written as it is. The name of the page (''myPage''), however, must be a hard-coded constant.
* In the example above, the pipe character (which is used to define a logical OR between the two categories) can be written as it is. The name of the page (''myPage''), however, must be a hard-coded constant.
 
==Parser function method==
Line 42 ⟶ 43:
 
;Example syntax
<pre>
<blockquote><pre><nowiki>
{{#dpl: category = cat1{{!}}cat2 | linksto = {{{1}}} }}
</nowiki></pre></blockquote>
or
<pre>
<blockquote><pre><nowiki>
{{#dpl:
|category = cat1¦cat2
|linksto = {{{1}}}
}}
</nowiki></pre></blockquote>
 
;Parsing procedure
Line 66 ⟶ 67:
* What was said before regarding explicit line breaks also holds true for parser function syntax, i.e., the special symbols <code>\n</code> or <code>¶</code> must be used to insert an explicit linefeed character into the wiki output stream if wiki symbols are used which must stand at the beginning of a line.
 
Note‘’’Note:’’’ The pipe character, which is used to define a logical OR for the two categories, must be represented as a [[mw:Help:Magic words#Other|Magic Word]] <code><nowiki>{{!}}</nowiki></code> which 'hides' the pipe from the MediaWiki parser, ensuring that it is not considered until after other items have been expanded. The second example shows that the <code>¦</code> character acts as an alternative to this somewhat awkward notation.
 
The second example is not literally equivalent to the first one, as there is an additional pipe character before the first parameter. Technically, this creates an additional empty parameter, but as empty parameters are silently ignored by DPL it makes no difference.
Line 128 ⟶ 129:
 
==Syntax used in this manual==
If we give completeMost examples, we will typically use the tag-based parser extension-based syntax in this manual. Except when we want to make use of variable expansion.
 
Most of the manual deals with the explanation of individual parameters. This is independent of the choice between the two variants described above. So, if you read something like
Line 139 ⟶ 140:
==Interaction between your wiki text and DPL3 output==
As mentioned before, DPL3 will insert its output exactly at the position where you placed the DPL3 call. This means that you can put wiki syntax around your DPL call, like e.g.,:
<pre><nowiki>
{| class="wikitable"
|a table field
Line 149 ⟶ 150:
|...
|}
</nowiki></pre>
 
You could also use HTML syntax to surround DPL output, as in the following example:
<pre><nowiki>
<ul>
<li>Item1</li>
Line 161 ⟶ 162:
</li>
</ul>
</nowiki></pre>
 
==Special note on ''Self References''==
Line 189 ⟶ 190:
This means that every page containing a DPL statement will automatically create a link to [[:Template:Extension DPL]]. You should create this Template in your wiki. We suggest that you copy the source code from [[:Template:Extension DPL|our version]]. The idea is that via this connection, you can easily find out which pages in a wiki contain DPL calls.
 
Note‘’’Note:’’’ that theThe template does NOT produce any output—so it is practically invisible to the user. If you forget to create the template, however, the user will see a red link to the template.
 
==Debugging a DPL statement==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.