Module:Galeria/doc: Difference between revisions
More actions
mNo edit summary |
m format |
||
| Line 21: | Line 21: | ||
A small function "converse" gets a size parameter (possible formats: 100, 150px, | A small function "converse" gets a size parameter (possible formats: 100, x260, 200x240 or 150px, x280px, 220x250px)<br> | ||
and returns the <tt>widths</tt> and/or the <tt>heights</tt> values. | and returns the <tt>widths</tt> and/or the <tt>heights</tt> values; the local function "parseval" is used to parse the values. | ||
<includeonly> | <includeonly> | ||
[[Category:Scribunto modules without test API|Gallery]]. | [[Category:Scribunto modules without test API|Gallery]]. | ||
</includeonly> | </includeonly> | ||
Revision as of 18:47, 7 February 2020
This module gets all parameters from the parent template of G, creates the attributes and values, and passes them to the gallery tag.
The mainly invoker is template:{{G}}.
The template G itself does nothing than to invoke this module, it does not specify any own parameters.
The module analyzes these parameters. In special, the unnamed parameter(s) can contain an unlimited number of items.
First of all the contents of all unnamed parameters are concatenated to one string:
- concatenates all pipe-separated items and separates them by ACK
- changes also the newline separators to ACK separators.
Then when the parameter for 'format' is not specified, but
- a second parameter exists (after a pipe), and
- the first parameter is preceded by a newline, and
- the second parameter does not specify a file name,
- the first parameter is preceded by a newline, and
- then the format parameter is defaulted to the value "2".
Using the ACK instead of the slash "/" tolerates items containing slashes, as URL web addresses.
For the format 2, pairs of items are built, with possible defaulting of the description item.
Finally the total amount of items is passed to the Template:{{G/layout}}, together with the other parameters.
Because the gallery tag does not support the suppression of the showfilename option,
two transclusions of the gallery tag are necessary - one with, and the other one without showfilename.
A small function "converse" gets a size parameter (possible formats: 100, x260, 200x240 or 150px, x280px, 220x250px)
and returns the widths and/or the heights values; the local function "parseval" is used to parse the values.