Difference between revisions of "DPL:FAQ"

From FollowTheScore
Jump to: navigation, search
Line 8: Line 8:
 
But with <tt><nowiki>{{#dpl:titlematch=%underscore|replaceintitle=/ /,&amp;#95;}}</nowiki></tt> you will get {{#dpl:titlematch=%underscore|replaceintitle=/ /,&#95;}}
 
But with <tt><nowiki>{{#dpl:titlematch=%underscore|replaceintitle=/ /,&amp;#95;}}</nowiki></tt> you will get {{#dpl:titlematch=%underscore|replaceintitle=/ /,&#95;}}
  
== I try to generate a table output with DPL but it looks weird - to hell with the syntax! ==
+
== I try to generate table formatting with DPL but it looks weird - to hell with the syntax! ==
  
 
Indeed, complex queries can be somewhat tricky. But this is not only a problem of DPL. MediaWiki is quite sensitive to blanks and linefeeds and half of your problems will probably come from there.
 
Indeed, complex queries can be somewhat tricky. But this is not only a problem of DPL. MediaWiki is quite sensitive to blanks and linefeeds and half of your problems will probably come from there.
Line 25: Line 25:
 
</nowiki></pre>
 
</nowiki></pre>
  
If we execute the above query the result is deeply unsatisfactory:
+
If we execute the above query the result will be deeply unsatisfactory:
  
 
<dpl>
 
<dpl>
Line 34: Line 34:
 
   format={|class=wikitable\n!article\n!beginning\n|-,\n[[%PAGE%|%TITLE%\n,\n,\n|}
 
   format={|class=wikitable\n!article\n!beginning\n|-,\n[[%PAGE%|%TITLE%\n,\n,\n|}
 
</dpl>
 
</dpl>
 
+
'''But why?'''
 
----
 
----
  
Line 48: Line 48:
  
 
----
 
----
And now we see: After the |- the next table row does not tsrta with a '|'; there is no "end of row" after each article. Now it is easy to correct the DPL query
+
And now we see: After the |- the next table row does not start with a '|'; and, apart from that, there is no "end of row" after each article. Now it is easy to correct the DPL query:
 
<pre><nowiki>
 
<pre><nowiki>
 
<dpl>
 
<dpl>
Line 60: Line 60:
  
 
<dpl>
 
<dpl>
 +
  titlematch=Nig%
 +
  include=%1[300]
 +
  format={|class=wikitable\n!article\n!beginning\n|-,\n|\n[[%PAGE%|%TITLE%]]\n,\n|-,\n|}
 +
  secseparators=\n|\n,
 +
</dpl>
 +
 +
In our "debugger" it looks like this:
 +
 +
<dpl>
 +
  resultsheader=<pre><nowiki>
 +
  resultsfooter=</nowiki></pre>
 
   titlematch=Nig%
 
   titlematch=Nig%
 
   include=%1[300]
 
   include=%1[300]

Revision as of 15:14, 27 July 2007

My article name contains underscores, but in the DPL result they don´t appear.

Normally, DPL replaces all undercores in article names by spaces when showing the result. You can replace underscores by their symbolic html name via the 'replaceintitle' statement. So DPL will no longer recognize the underscores and later the html engine will translate the symbolic name to underscores.

This wiki contains an Article_with_underscore. Normally DPL would show it as . But with {{#dpl:titlematch=%underscore|replaceintitle=/ /,&#95;}} you will get

I try to generate table formatting with DPL but it looks weird - to hell with the syntax!

Indeed, complex queries can be somewhat tricky. But this is not only a problem of DPL. MediaWiki is quite sensitive to blanks and linefeeds and half of your problems will probably come from there.

There is a simpe trick how you can DEBUG your DPL script:

Use a resultsheader and a resultsfooter to enclose all DPL output in pre/nowiki tags like this:

<dpl>
  resultsheader=<pre><nowiki>
  resultsfooter=</nowiki></pre>
  titlematch=Nig%
  include=%1[300]
  format={|class=wikitable\n!article\n!beginning\n|-,\n[[%PAGE%|%TITLE%\n,\n,\n|}
</dpl>

If we execute the above query the result will be deeply unsatisfactory:

<pre><nowiki>{|class=wikitable !article !beginning |- [[Nig1|Nig1


[[Nig2|Nig2


[[Nig3|Nig3


[[Nig4|Nig4


[[Nigunda Test|Nigunda Test

Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL ..


[[Nigunda|Nigunda

some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda;[[Nigeria|Nigeria

Main article: History of Nigeria
See also: Nigerian military juntas of 1966-1979 and 1983-1998

More than 2,000 years ago. the Nok ..→

|}</nowiki></pre> But why?


With out little trick we see the output of DPL which will normally be rendered by the wiki parser:

{{Extension DPL}}{|class=wikitable
!article
!beginning
|-
[[Nig1|Nig1


[[Nig2|Nig2


[[Nig3|Nig3


[[Nig4|Nig4


[[Nigunda Test|Nigunda Test

Nigunda Test History - Chapter  Sequence in the article doesn´t matter for DPL ..


[[Nigunda|Nigunda

some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda;


[[Category:Tag_Event2]]

[[Nigeria|Nigeria

:<div class="noprint">''Main article: [[History of Nigeria|History of Nigeria]]''</div>
:<span class="boilerplate seealso">''See also: [[:Nigerian military juntas of 1966-1979 and 1983-1998|Nigerian military juntas of 1966-1979 and 1983-1998]]''</span>
More than 2,000 years ago. the [[Nok]]  [[Nigeria#History|..→]]

|}

And now we see: After the |- the next table row does not start with a '|'; and, apart from that, there is no "end of row" after each article. Now it is easy to correct the DPL query:

<dpl>
  titlematch=Nig%
  include=%1[300]
  format={|class=wikitable\n!article\n!beginning\n|-,\n|\n[[%PAGE%|%TITLE%]]\n,\n|-,\n|}
  secseparators=\n|\n,
</dpl>

.. and we get the desired result:

article beginning

Nig1

Nig2

Nig3

Nig4

Nigunda Test

Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL ..

Nigunda

some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda;

Nigeria

Main article: History of Nigeria
See also: Nigerian military juntas of 1966-1979 and 1983-1998

More than 2,000 years ago. the Nok ..→

In our "debugger" it looks like this:

{{Extension DPL}}{|class=wikitable
!article
!beginning
|-
|
[[Nig1|Nig1]]

|

|-
|
[[Nig2|Nig2]]

|

|-
|
[[Nig3|Nig3]]

|

|-
|
[[Nig4|Nig4]]

|

|-
|
[[Nigunda Test|Nigunda Test]]

|

Nigunda Test History - Chapter  Sequence in the article doesn´t matter for DPL ..

|-
|
[[Nigunda|Nigunda]]

|

some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda;


[[Category:Tag_Event2]]
|-
|
[[Nigeria|Nigeria]]

|

:<div class="noprint">''Main article: [[History of Nigeria|History of Nigeria]]''</div>
:<span class="boilerplate seealso">''See also: [[:Nigerian military juntas of 1966-1979 and 1983-1998|Nigerian military juntas of 1966-1979 and 1983-1998]]''</span>
More than 2,000 years ago. the [[Nok]]  [[Nigeria#History|..→]]
|-
|}