https://bugzilla.wikimedia.org/show_bug.cgi?id=31829
Web browser: ---
Bug #: 31829
Summary: New format "count".
Product: MediaWiki extensions
Version: any
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Unprioritized
Component: SubPageList
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 9254
--> https://bugzilla.wikimedia.org/attachment.cgi?id=9254
A patch, implementation of format `count'.
This is an implementation of format "count" for extension SubPageList:
{{ #subpages: Page | format = count }}
returns number of subpages as a plain text, suitable for using in `#ifeq' and
`#ifexpr' functions, for example:
{{ #ifexpr: {{ #subpages: Page | format = count }} > 0
| <!-- There are subpages. -->
| <!-- There is no subpages. -->
}}
Note that tricks with other formats will *not* work:
{{ #if: {{ #subpages: Page | format = list }}
| <!-- Always occurs. -->
| <!-- Never occurs. -->
}}
Result of `#subpages' (with non-`count' format) is never empty, even if there
are no subpages.
Another example: Let us assume template `x' unconditionally returns `x', so
{{ #subpages: Page | format = template | template = x }}
we hope result of construct will be character `x' repeated as many times as
subpages we have. But this does not work. Result of `#subpages' looks like
`x...x' but it cannot be used in function `#if':
{{ #ifeq: {{ #subpages: Page | format = template | template = x }} | x
| <!-- Never occurs. -->
| <!-- Always occurs. -->
}}
Format `count' is inspired by extension SemanticMediaWiki.
Possible improvements:
Currently `intro', `outro' and other parameters are ignored if format is
`count'. They could be implemented (later).
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l