Difference between revisions of "Old Homepage"
(→Example) |
(→country list) |
||
Line 75: | Line 75: | ||
===== country list ===== | ===== country list ===== | ||
+ | ''parser extension syntax'' | ||
<DPL> | <DPL> | ||
category=Fictitious country | category=Fictitious country | ||
Line 84: | Line 85: | ||
secseparators=,\n|,, | secseparators=,\n|,, | ||
</DPL> | </DPL> | ||
+ | |||
+ | ===== country list (2) ===== | ||
DPL can also be used as a mediawiki parser '''function''', which is more powerful as it allows DPL to be used within templates, parameters being template calls or variable expansions. The disadvantage is that syntax looks less nice as the pipe character must be hidden in macros if used as a parameter contents. So the same example could also have been written as: | DPL can also be used as a mediawiki parser '''function''', which is more powerful as it allows DPL to be used within templates, parameters being template calls or variable expansions. The disadvantage is that syntax looks less nice as the pipe character must be hidden in macros if used as a parameter contents. So the same example could also have been written as: | ||
+ | ''parser function syntax'' | ||
<pre><nowiki> | <pre><nowiki> | ||
{{#dpl:category=Fictitious country | {{#dpl:category=Fictitious country |
Revision as of 22:43, 21 January 2007
Contents
DynamicPageList (DPL)
DPL is a MediaWiki extension which creates lists of articles that match certain criteria. Articles are listed by name; meta data like popularity or last access date can be added. And there are powerful mechanisms to extract content from the articles and show it as part of the list.
In short DPL aims to be a universal report generator for MediaWiki.
A typical situation ..
Assume you have written some articles about countries. Typically these articles will have three things in common:
- All articles will belong to a common category
- They will have a similar chapter structure, i.e. they will contain sections named 'Religion' or 'History'
- They will use a template which is used to present highly structured short data items ('Capital', 'Inhabitants', ..) in a nice way (e.g. as a wikitable)
What can DPL do for me?
DPL can
- generate a list of all those articles
- show metadata of the articles
- show one or more chapters of the articles
- show parameter values which are passed to the common template
Which steps are necessary?
Find the articles you want to list:
- select by a logical combination (AND,OR,NOT) of categories
- select by a logical combination (AND,OR,NOT) of namespaces
- define a pattern which must match their name
- name a page to which the articles must or must not refer
- exclude or include redirections
Order the articles descending or ascending according to
- name
- date of last change
- popularity
- user who changed them last
- ...
Define attributes you want to see
- article name
- article namespace
- date of last change
- date of last access
- user who changed them last
Define contents you want to show
- chapter contents (identified by headings)
- text portions (defined by special marker tags)
- values of template calls
Define the output format
- headlines
- ordered list, unordered list
- table, sorted table (using javascript)
- category style listing
- truncate title or contents to maximum length
- add a link to the article or to their chapters
Example
There are some articles on fictitious coutries (this is also the name of their common category). They all use a template named "Country" which receives facts like capital. The template produces a small table and a link to the country list we want to generate. There are chapters on religion and history in most of the articles. We show how to create a sortable wikitable list of those articles which gives some excerpts of the contents. <javascript src="sorttable"/>
DPL can be used as a mediawiki parser extension, which means that a special DPL tag is used:
<DPL> category=Fictitious country includepage={Country},#History,#Religion includemaxlength=50 addpagecounter=true mode=userformat listseparators=\n{|class=sortablewikitable id=123 \n!Country \n!Official Name \n!Capital \n!Dial Code \n!History \n!Religion \n|-,\n|-\n|[[%PAGE%]] (%COUNT%)\n,\n,\n|} secseparators=,\n|,, </DPL>
We select articles by category and explain that we want to see contents from the template "Country" and from two chapters. We truncate the excerpts. We create a sortable table which contains article name and access frequency in the first column and the content pieces in the other columns. Note that at the end of truncated contents you will find a small arrow which links directly to the chapter from where the contents was taken. The formatting for the template varibales is being done in a special template which is by convention named "Country dpl". This template is very simple; it only presents the values for name, capital and dial code as columns of a table.
country list
parser extension syntax
Country | Official Name | Capital | Dial Code | History | Religion | ||
---|---|---|---|---|---|---|---|
DPL Example 007 main page 1 (%COUNT%) | |||||||
Nigunda (%COUNT%)
see the country list .. |
some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda; | ||||||
Nigunda Test (%COUNT%)
see the country list .. |
Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL .. some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda Test; | ||||||
Somango (%COUNT%)
see the country list .. |
a text on the history of Somango; a text on the history of Somango; a text on the history of Somango; some facts about religion in Somango
|
country list (2)
DPL can also be used as a mediawiki parser function, which is more powerful as it allows DPL to be used within templates, parameters being template calls or variable expansions. The disadvantage is that syntax looks less nice as the pipe character must be hidden in macros if used as a parameter contents. So the same example could also have been written as:
parser function syntax
{{#dpl:category=Fictitious country |includepage={Country},#History,#Religion |includemaxlength=50 |addpagecounter=true |mode=userformat |listseparators=\n{{(!}} class=sortablewikitable id=123 \n!Country \n!Official Name \n!Capital \n!Dial Code \n!History \n!Religion \n{{!}}-,\n{{!-}}\n{{!}}[[%PAGE%]] (%COUNT%)\n,\n,\n{{!)}} |secseparators=,\n{{!}},, }}
Country | Official Name | Capital | Dial Code | History | Religion | ||
---|---|---|---|---|---|---|---|
DPL Example 007 main page 1 (%COUNT%) | |||||||
Nigunda (%COUNT%)
see the country list .. |
some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda; | ||||||
Nigunda Test (%COUNT%)
see the country list .. |
Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL .. some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda Test; | ||||||
Somango (%COUNT%)
see the country list .. |
a text on the history of Somango; a text on the history of Somango; a text on the history of Somango; some facts about religion in Somango
|