Arbeiten mit DPL3: Difference between revisions
Created page with "= Basics of DynamicPageList3 (23.07.2025)= DynamicPageList3 generates lists of pages, page properties (metadata), and/or template parameter values, for display in other articles. Manual: https://dpl3.wikitide.org/wiki/Main_Page There are different parameters to structure '''which pages''' are included, '''what content''' from these pages is included, and '''how the output is formatted'''. == Inclusion Criteria: Page Selection == DPL3 needs criteria for what to include..." |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
Manual: https://dpl3.wikitide.org/wiki/Main_Page | Manual: https://dpl3.wikitide.org/wiki/Main_Page | ||
Basic use of DPL3 works similar to that of Templates / Parser Functions: | |||
<code> | |||
<nowiki> | |||
{{#dpl: | |||
|parameter1 = xy | |||
|parameter2 = yx | |||
}} | |||
</nowiki> | |||
</code> | |||
The different parameters structure '''which pages''' are included, '''what content''' from these pages is included, and '''how the output is formatted'''. | |||
== Inclusion Criteria: Page Selection == | == Inclusion Criteria: Page Selection == | ||
| Line 18: | Line 29: | ||
** (uses=Template:ImageMetadata) | ** (uses=Template:ImageMetadata) | ||
* title (Select one single page by its (namespace and) title, requires additional parameters) | * title (Select one single page by its (namespace and) title, requires additional parameters) | ||
** title=Projektseite |include=#Temporäre Hilfe-Seiten | ** (title=Projektseite |include=#Temporäre Hilfe-Seiten) | ||
* contents | * contents | ||
Restricting the output to a certain number of results can be done with "count" (count=2). | Restricting the output to a certain number of results can be done with "count" (count=2). | ||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). | The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). | ||
Result of the function call: | |||
{{#dpl: | {{#dpl: | ||
|category=Illustration | |category=Illustration | ||
| Line 50: | Line 62: | ||
** (include={ImageMetadata}:work-title:year:%PAGE%) | ** (include={ImageMetadata}:work-title:year:%PAGE%) | ||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). Some include statements only make sense in combination with specific page selection criteria. | The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). Some include statements only make sense in combination with specific page selection criteria. | ||
Result of the function call: | |||
{{#dpl: | {{#dpl: | ||
|uses=Template:ImageMetadata | |uses=Template:ImageMetadata | ||
|resultsheader = <i>There are %PAGES% entries.</i> | |resultsheader = <i>There are %PAGES% entries.</i> | ||
|include={ImageMetadata}:work-title:year:%PAGE% | |include={ImageMetadata}:work-title:year:%PAGE% | ||
}} | |||
== Output Format == | |||
The Basic output format of DPL3 functions is a list. Without styling, additional text that is included via [[Arbeiten mit DPL3#Output Volume| Output Volume]] appears directly next to the page name link. | |||
There are some predefined styling options with many options for adjustment. Basic formatting includes the "mode" parameter: | |||
* (mode=unordered) (default) | |||
* (mode=ordered) | |||
* (mode=none) | |||
* (mode=inline) | |||
** (inlinetext= • ) | |||
* (mode=category) (requires "ordermethod" with one of the values: title; titlewithoutnamespace; category,title; or user,title). | |||
* (mode=userformat) | |||
OR the "table" parameter: | |||
* (include={ImageMetadata}:work-title:year |table=class="wikitable imageTable", Image, Work Title, Year) | |||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). Some include statements only make sense in combination with specific page selection criteria. | |||
Result of the function call: | |||
{{#dpl: | |||
|uses=Template:ImageMetadata | |||
|include={ImageMetadata}:work-title:year | |||
|table=class="wikitable imageTable", Image, Work Title, Year | |||
}} | |||
=== Userformat Output === | |||
"Userformat" mode makes the output fully flexible, enabling formatting with wikitext and supported html elements. This mode has a system of three tags which are used to enclose (a) the whole output, (b) each item, (c) each transcluded section of an item; they can also contain [https://dpl3.wikitide.org/wiki/Controlling_output_format#variables| variables]: | |||
* listseparators | |||
** (listseparators = <Outputstart>,<Itemstart>,<Itemend>,<Outputend>) | |||
** (listseparators = \n ''Start of the List'' \n,~ , \n,\n ''End of the List'') | |||
* secseparators | |||
** (secseparators=1a,1b,2a,2b,3a,3b) | |||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). | |||
Result of the function call: | |||
{{#dpl: | |||
|uses=Template:ImageMetadata | |||
|include={ImageMetadata}:work-title,{ImageMetadata}:year,{ImageMetadata}:id | |||
|mode=userformat | |||
|listseparators=A,B,C,D | |||
|secseparators=1a,1b,2a,2b,3a,3b | |||
}} | |||
Result of the function call: | |||
{{#dpl: | |||
|uses=Template:ImageMetadata | |||
|include={ImageMetadata}:work-title,{ImageMetadata}:year,{ImageMetadata}:id | |||
|mode=userformat | |||
|listseparators=A <br>, \n# B , C, <br> D | |||
|secseparators= [[%PAGE%|%TITLE%]] a '' , '' b , c (,) d , e ''',''' f | |||
}} | |||
The parameter "format" implicitly sets "mode=userformat" and enables similar styling to the "listseperator" parameter. | |||
* (format=A,B,C,D,E) | |||
* (format=,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]''',</span> \n ,) | |||
* (|uses=Template:ImageMetadata |format = «gallery mode="packed" widths="80px" heights="80px"»,%PAGE%\n,,«/gallery») | |||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). | |||
Result of the function call: | |||
{{#dpl: | |||
|uses=Template:ImageMetadata | |||
|include={ImageMetadata}:work-title,{ImageMetadata}:year,{ImageMetadata}:id | |||
|format=,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]''',</span> \n , | |||
}} | |||
=== Table Output === | |||
The "table" parameter creates a standard wikitable in wikitext syntax. If no class attribute is specified, the default class is "wikitable". | |||
Relevant parameters are: | |||
* table | |||
** (table= ,Header1,Header2,Header3,Header4,Header5) | |||
** (table= class="imageTable wikitable" style="color:seagreen; font-weight:600;", File, Title, Work Title, Year, Chapter) | |||
* tablerow | |||
** (tablerow=%%,%%,%%,%%,%%) | |||
** (|include={ImageMetadata}:%TITLE%:ill-title:work-title:year:chapt |table= ,-,Image,Title,Book Title,Year of Publication,Chapter |tablerow=[[File:%%{{!}}x100px]],'''%%''',''%%'',%%,%%) | |||
* tablesortcol (number starting at 1) | |||
'''Example:''' | |||
The example can be changed to see how the different parameters work in real time (using the Preview all changes can be observed while working on the parser function). | |||
Result of the function call: | |||
{{#dpl: | |||
|uses=Template:ImageMetadata | |||
|include={ImageMetadata}:ill-title:work-title:year:chapt | |||
|table= ,Image,Title,Book Title,Year of Publication,Chapter | |||
}} | }} | ||