Arbeiten mit DPL3: Difference between revisions
No edit summary |
No edit summary |
||
(3 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 | ||
Line 69: | Line 82: | ||
* (mode=none) | * (mode=none) | ||
* (mode=inline) | * (mode=inline) | ||
** | ** (inlinetext= • ) | ||
* (mode=category) (requires "ordermethod" with one of the values: title; titlewithoutnamespace; category,title; or user,title). | * (mode=category) (requires "ordermethod" with one of the values: title; titlewithoutnamespace; category,title; or user,title). | ||
* (mode=userformat) | * (mode=userformat) | ||
Line 76: | Line 89: | ||
* (include={ImageMetadata}:work-title:year |table=class="wikitable imageTable", Image, Work Title, Year) | * (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. | 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 | ||
Line 88: | Line 102: | ||
=== Userformat Output === | === 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. | "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 | |||
}} | |||
'''Result of the function call: | 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: | {{#dpl: | ||
|uses=Template:ImageMetadata | |uses=Template:ImageMetadata | ||
|include={ImageMetadata}:work-title:year | |include={ImageMetadata}:work-title,{ImageMetadata}:year,{ImageMetadata}:id | ||
| | |format=,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]''',</span> \n , | ||
}} | }} | ||
=== Table Output === | === 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 | |||
}} |