Help:DynamicPageList3

From Constant Noble
Jump to navigation Jump to search

DynamicPageList3 (DPL3), a page-reporting tool, is enabled on this site as a substitute for Semantic MediaWiki (which Miraheze has long been unable to offer for various reasons). This list of usage examples is intended to compensate for the chronic outdatedness and apparent dearth/complexity of many currently available guides for this extension.

Basics

Based on Wikimedia's original DynamicPageList and its subsequent third-party fork, DPL3 is invoked by the {{#dpl: .... }} parser function or the <DPL>/<DynamicPageList> parser tags. Depending on the approach, all pages using these are automatically placed into Category:Pages using DynamicPageList parser function or Category:Pages using DynamicPageList parser tag (via {{Extension DPL}}, itself automatically created once the extension is enabled).

Escape characters

From the original DPL documentation at FollowTheScore.org:

Sometimes it is necessary to use a character as "plain data" at a place where it normally has a syntactical meaning. MediaWiki is not very clean at character escaping in general. So we had to define our own way in the jungle of "character escaping":

DPL escape character MediaWiki character Typical use
» > Call another MediaWiki extension into a parameter of a DPL call
« <
²{ {{ Call a template within the 'article loop' of DPL. This is especially useful for nesting DPL calls (DPL recursion)
}}
¦ |
newline Inserts a line break into DPL's wikitext output, to allow proper parsing of first-character syntax (such as * # : ;)
\n newline

DPL's mechanism of replacing %xx% variables then can be used to modify the arguments of that call before it will be resolved. Most DPL users will not need this, but for some advanced uses of DPL it is a real help.

Examples

Pages in category

This is the most basic function of DPL3. On this site, a list of characters from the Unspooled series can be generated with {{#dpl:category=Unspooled characters}} or <dpl>category=Unspooled characters</dpl>, resulting in:

(To reduce loading times, the result count is purposefully capped at 100 [but only takes effect once maxResultCount is set instead of allowUnlimitedResults by Miraheze staff].)

Most recently updated pages

To retrieve a list of project pages by most recent update, one can use:

<dpl>
namespace=Project
ordermethod=lastedit
order=desc
count=10
</dpl>

which gives the following output:

  • This code is only used as a demo to place this content into Category:Pages using DynamicPageList parser tag. In parser form, it is written as {{#dpl:namespace=Project |ordermethod=lastedit |order=desc |count=10}}.
  • |count= is intentionally used here to prevent a long list from dominating this section.

Scrolling through results

To get the previous and next five project pages alphabetically from a given position (e.g. "M"), use:

{{#dpl:title<=M|namespace=Project|order=descending|ordermethod=sortkey|count=5}}
{{#dpl:title>=M|namespace=Project|order=ascending|ordermethod=sortkey|count=5}}

to get:


The first segment of syntax respectively means "lower than M" and "higher than M", and the third tells DPL3 to go down or up the list.

This method is not effective on lists with mixed capitalisation and Unicode characters, as has recently been proven with {{Definition/Nearby}} on the entry pages of the Tovasala Dictionary.

Tables

DPL3 can also be used for table results, an example of which involves tracks in the Adanson Jukebox tagged under the Classical genre:

{{#dpl:category=Tracks|linksto=Genre:Classical
|include={Track box}:Artist:Composer\(s\):Lyricist\(s\):Length:Album:Date=¦Year:License:Appearances:AVA:Rating
|table=class="wikitable sortable discography",Track title,Artist,Composer(s),Lyricist(s),Length,Album,Release date,License,Appearances,{{abbr|Autrison Visual Album|AVA#}},{{abbr|As given by Autrison's curators|Rating}}
|tablerow=²{Artist¦%%}²,²{#if:%%¦%%¦—}²,²{#if:%%¦%%¦—}²,%%,²{#if:%%¦²{#switch:%%¦Single=Single-only release¦Download=Digital download¦#default=²{Album¦%%}²}²}²,%%,²{#if:%%¦%%¦Copyrighted}²,²{#arraymap:%%¦;¦##¦²{#ifeq:²{#sub:##¦0¦2}²¦4J¦²{Volume¦4J¦##}²¦²{Volume¦²{#sub:##¦0¦-4}²¦##}²}²¦\s•\s}²,%%|ordermethod=sortkey
}}

Track title Artist Composer(s) Lyricist(s) Length Album Release date License Appearances AVA# Rating
Denn alles Fleisch, es ist wie Gras The Holden Consort Orchestra and Choir Johannes Brahms 14:16 Ein deutsches Requiem 2001 CC-BY-SA 4J.09 0009
Isle of Beauty, Isle of Splendour U.S. Navy Band Lemuel McPherson Christian Wilfred Oscar Morgan Pond 0:48 National Anthems of the World 2009 PD-USGov 4J.04RF01.106RF02.106RF03.106RF04.106 0004
Orchestra Tuning Up Stan Smith & Ralph Harding 0:37 Digital download 2011-07-24 Copyrighted 4J.02RF01.102RF02.102RF03.102RF04.102 0002
The Star-Spangled Banner U.S. Navy Band John Stafford Smith Francis Scott Key 1:18 National Anthems of the World 1997 PD-USGov 4J.03RF01.104RF02.104RF03.104RF04.104 0003
Symphony No. 9, Op. 125 – IV. Presto Papalin Ludwig van Beethoven 22:29 Symphony No. 9, Op. 125 2011-06-07 CC-BY 4J.10 0010 ★★★

Listing template values

To list Unspooled characters by species and residence, one can start with the same category=Unspooled characters call as before, then add include={Character box}:Species,{Character box}:Residence next to it. The resulting

{{#dpl:category=Unspooled characters
|include={Character box}:Species,{Character box}:Residence
}}

becomes:

Since the above output is not desirable, one should add interpuncts as |secseparators= (short for "section separators") in the DPL calls, one for each comma-separated "include":

Code Output
{{#dpl:category=Unspooled characters
|include={Character box}:Species,{Character box}:Residence
|secseparators=, • ,
}}

The second comma is mandatory, since leaving it out will cause the interpuncts to immediately glue to the next value.

In this example, the namespace must be stripped away for presentability, and another interpunct must separate the name and first value. Hence:

Code Output
{{#dpl:category=Unspooled characters
|include={Character box}:Species,{Character box}:Residence
|listseparators=,\n*²{Character¦%TITLE%}² • ,
|secseparators=, • ,
}}
  • Samson • Guadeloupe raccoon • Panama City, Florida
  • Edison • Raccoon • Panama City, Florida
  • Marguerite • Guadeloupe raccoon • Panama City, Florida
  • Alfred • Guadeloupe raccoon • Panama City, Florida
  • Matthew • Raccoon • Toronto
  • Bernadette • Raccoon • Roseau
  • Jeremiah • Raccoon • Roseau
  • Gertha • Guadeloupe raccoon • Roseau
  • Victor • Guadeloupe raccoon • Panama City, Florida
  • Galina • Ferret • Panama City, Florida
  • Louise • Isthmian raccoon • Panama City, Florida
  • Jim • Cat • Marigot, Dominica
  • Violet • Ring-tailed cat • Panama City, Florida
  • Seán • European otter • Panama City, Florida
  • Ibrahim • Red squirrel • Panama City, Florida
  • Andrew • Mouse • Panama City, Florida
  • Daniel • Dog • Panama City, Florida
  • Jean-Pierre • Dog • Kings Hill
  • Elliot • Isthmian raccoon • Vieux Fort
  • Nathaniel • Bahamian raccoon • Thunder Bay
  • Malaika • Guadeloupe raccoon • Toronto
  • Geraldine • Guadeloupe raccoon • Salisbury
  • Alban • Guadeloupe raccoon • Pointe-à-Pitre
  • Devondra • Guadeloupe raccoon • Les Abymes
  • Xavier • Guadeloupe raccoon • Pointe-à-Pitre
  • Rhea Silvia • Guadeloupe raccoon • Petit-Bourg
  • Mars • Guadeloupe raccoon • Petit-Bourg
  • Romulus • Guadeloupe raccoon • Petit-Bourg
  • Remus • Guadeloupe raccoon • Petit-Bourg
  • Hersilia • Guadeloupe raccoon • Petit-Bourg
  • Elsinore • Guadeloupe raccoon • Pointe-à-Pitre
  • Ludovic • Guadeloupe raccoon • Salisbury
  • Hayley • Isthmian raccoon • Vieux Fort
  • Wilhelmo • Cozumel raccoon • Hillsborough, Carriacou
  • Bernice • Cozumel raccoon • Hillsborough, Carriacou
  • Elenatina • Cozumel raccoon • Hillsborough, Carriacou
  • Charlie • Cozumel raccoon • Hillsborough, Carriacou
  • Agatha • Cozumel raccoon • Hillsborough, Carriacou
  • Dalilah • Red squirrel • Panama City, Florida
  • Maurice • Hispaniolan solenodon • Hillsborough, Carriacou
  • Florence • Isthmian raccoon • Vieux Fort
  • Cendrine • Isthmian raccoon • Micoud
  • Jodi • Isthmian raccoon • Vieux Fort
  • Miquela • Cozumel raccoon • St. George's
  • Elias • Raccoon •
  • Clarena • Guadeloupe raccoon • Pointe-à-Pitre
  • Calluna • Guadeloupe raccoon • Pointe-à-Pitre
  • Cosmelia • Guadeloupe raccoon •
  • Catriona • Guadeloupe raccoon • Pointe-à-Pitre
  • Daboecia • Guadeloupe raccoon • Pointe-à-Pitre
  • Liberta • Guadeloupe raccoon • Liberta
  • Ketiley • Guadeloupe raccoon •
  • Evelina • Guadeloupe raccoon • Pointe-à-Pitre
  • Guillaume • Guadeloupe raccoon • Pointe-à-Pitre
  • Grégoire • Guadeloupe raccoon • Pointe-à-Pitre
  • Tyllus • Guadeloupe raccoon • Pointe-à-Pitre
  • Amelia • Raccoon • New Haven
  • Lorelle • Guadeloupe raccoon • Pointe-à-Pitre
  • Ileana • Guadeloupe raccoon • Pointe-à-Pitre
  • Cantabrica • Guadeloupe raccoon • Pointe-à-Pitre
  • Béthune • Guadeloupe raccoon • Pointe-à-Pitre
  • Clément • Guadeloupe raccoon • Goyave
  • Mariam • Guadeloupe raccoon • Pointe-à-Pitre
  • Geoffroy • Guadeloupe raccoon • Pointe-à-Pitre
  • Ruthanna • Guadeloupe raccoon • Plymouth, Monsterrat
  • Francesca • Guadeloupe raccoon • Pointe-à-Pitre
  • Fabricia • Guadeloupe raccoon • Pointe-à-Pitre
  • Geralyn • Guadeloupe raccoon • Pointe-à-Pitre
  • Bertrand • Guadeloupe raccoon • Pointe-à-Pitre
  • Hobrey • Red panda • Panama City, Florida

Here, \n signifies a new line, and * a list item. What is otherwise typed out as {{Character|%TITLE%}} is converted into ²{Character¦%TITLE%}² for DPL3 purposes. The square symbol (²) substitutes the first and last template brace, and a broken pipe symbol (¦) takes the place of the full symbol. (The latter is absent on standard keyboards and WikiEditor's "Special characters" list, and must be added via CharInsert during editing.)

Finally, to convert the bare values into links, one must use |tablerow=:

Code Output
{{#dpl:category=Unspooled characters
|include={Character box}:Species,{Character box}:Residence
|listseparators=,\n*²{Character¦%TITLE%}² • ,
|secseparators=, • ,
|tablerow=²{Species¦%%}²,²{Place¦%%}²
}}

where in the template calls, %% represents the respective template value.

Regex-based output

Through titleregexp=, DPL3 can output a list of headwords in the Tovasala Dictionary whose letters do not exceed the "x-height" (inspired by this now-closed challenge at the Puzzling StackExchange):

Code Output
{{#dpl:namespace=Entry|titleregexp=^-?[acemnorsuvwz]?[acemnorsuvxwz]+-?$}}

The caret (^) signifies the start of the term; -? checks whether the term is an affix/termison/intrafix; and [acemnorsuvwz]? looks for terms beginning with the "x-height" letters. (In Tovasala, c is represented by ch while lowercase x cannot begin a word.) [acemnorsuvxwz]+$ reiterates through the selected strings to find terms exclusively including those letters; the dollar sign signals the end of the target strings.

The {{#dplreplace:}} function operates similarly to the {{#replace:}} parser function and the localised {{ReplaceSet}}, but for alterations, {{!}} must be used for escape between the options searched for:

Code Output
{{#dplreplace:catch a tiger by the tail|/(^{{!}}\s)(c{{!}}t(?!h))/|<nowiki> </nowiki>L}}
Latch a Liger by the Lail