Difference between revisions of "DPL Example 003"

From FollowTheScore
Jump to: navigation, search
Line 1: Line 1:
 
{{Example|Create a table of articles based on template parameters, apply individual formatting to columns, add meta data}}
 
{{Example|Create a table of articles based on template parameters, apply individual formatting to columns, add meta data}}
  
We show various template parameters. We add meta data (in this case the ''hit count''). We format huge hit counts using a big font.
+
We show various template parameters. We add meta data (in this case the ''hit count''). We format huge hit counts using a big font. We put a decimal point before the last three digits. Population is right justified and in small font.
Population is right justified and in small font.
 
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 10: Line 9:
 
   addpagecounter=true
 
   addpagecounter=true
 
   includepage ={Infobox Country or territory}:area:population_estimate
 
   includepage ={Infobox Country or territory}:area:population_estimate
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
+
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦%COUNT%}²,
 
   table      =,Country,Area,Population,#hits
 
   table      =,Country,Area,Population,#hits
 
   tablerow    =align=right|%%,align=right bgcolor=#ffffaa|<small>%%</small>
 
   tablerow    =align=right|%%,align=right bgcolor=#ffffaa|<small>%%</small>
Line 26: Line 25:
 
   includepage ={Infobox Country or territory}:area:population_estimate
 
   includepage ={Infobox Country or territory}:area:population_estimate
 
   table      =,Country,Area,Population,#hits
 
   table      =,Country,Area,Population,#hits
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
+
   format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦%COUNT%}²,
 
   tablerow    =align=right|%%,align=right bgcolor=#ffffaa|<small>%%</small>
 
   tablerow    =align=right|%%,align=right bgcolor=#ffffaa|<small>%%</small>
 
</dpl>
 
</dpl>

Revision as of 16:48, 18 May 2009

back to list of examples

Create a table of articles based on template parameters, apply individual formatting to columns, add meta data

We show various template parameters. We add meta data (in this case the hit count). We format huge hit counts using a big font. We put a decimal point before the last three digits. Population is right justified and in small font.

<dpl>
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>2400¦<big>'''²{#replace:%COUNT%¦/([0-9]{3})$/¦.\1}²'''</big>¦%COUNT%}²,
  table       =,Country,Area,Population,#hits
  tablerow    =align=right|%%,align=right bgcolor=#ffffaa|<small>%%</small>
</dpl>

The above DPL command produces the following output:



|- |Cameroon |align=right|475,442 |align=right bgcolor=#ffffaa|16,323,000 |align=right|Expression error: Unrecognized punctuation character "%". |- |Nigeria |align=right|923,768 |align=right bgcolor=#ffffaa|133,530,0001 |align=right|Expression error: Unrecognized punctuation character "%". |- |Somalia |align=right|637,657 |align=right bgcolor=#ffffaa|8,228,000 |align=right|Expression error: Unrecognized punctuation character "%".