-
-
Save qt-6/e2c8349a2c3cdec7e2d6a2a261b949ae to your computer and use it in GitHub Desktop.
Things related to Extension:Cargo
Failing storage:
If a template seems to stop storing data to a table after one certain call on a page, it's likely that that template is attempting a faulty call. This can indicate that there's a field in the table that doesn't receive its expected datatype. Remember to recreate after modifying the table's fields.
Integer formatting:
Ints are formatted with decimal separators, e.g. 1,427
. Use fields=CONCAT(<fieldname>)
to convert the int to a string, which removes the decimal separator (e.g. 1427
).
Null-editing:
Pages that transclude some cargo query might need a null edit to display properly.
Declaring:
Some consider it good practice to put the {{#cargo_declare:}}
part of a template in a subtemplate, e.g. /CargoDec
.
Things related to Extension:Cite
Advanced wikitext inside ref:
The <ref>
tag doesn't allow any arbitrary wikitext. More advanced wikitext might require the {{#tag:}}
parser function, e.g. {{#tag:ref|ref text}}
.
https://www.mediawiki.org/wiki/Help:Magic_words#Miscellaneous
Things related to the use of CSS
Vendor-prefixed rules:
Those should appear before standard rules (e.g. -moz-border-radius
and -webkit-border-radius
before border-radius
).
Imports:
Importing another stylesheet only works if the @import
statement is placed at the top of the CSS page, before any CSS rules.
Selectors with problematic characters:
Selectors may contain characters like colons, spaces, or periods (although they really shouldn't). When using them in a CSS rule, the problematic character needs to be escaped with a backslash in order for the rule to work.
(first sentence here: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#escaping_special_characters)
For example, to select <div id="foo.bar"></div>
, use #foo\.bar
.
Things related to Extension:DynamicPageList3
List uncategorized mainspace articles:
{{#dpl:namespace=|titlematch=%|categoriesminmax=,0}}
Variable definitions:
In surrogate templates, normal {{#vardefine:}}
and {{#var:}}
have unexpected behavior. Use {{#dplvar:set}}
and {{#dplvar:}}
instead.
Collecting template parameters:
In surrogate templates, there is an additional parameter not mentioned in the documentation: %ARGS%
. It contains a list of all parameters used in the template, separated by the character §
.
Things related to the use of JavaScript
ES6:
ES6 (ECMAScript 2015) is not supported by the ResourceLoader (RL). This means that ES6+ features will throw the following error:
JavaScript parse error: Parse error: Missing ; before statement in file 'MediaWiki:Gadget-gadgetname.js' on line x
(ES6+ features are things like let
/const
, the for...of
construct, classes, arrow functions, string interpolation, etc. – see more at: 1, 2)
The error is thrown because the linter expects ES5 syntax and will break on ES6-only syntax. This happens if the ES6+ features are used inside any code that is directly loaded with the RL, i.e. Gadgets, Special:MyPage/common.js, etc. It is not thrown if the ES6+ features are used inside code that is loaded indirectly, i.e. via mw.loader.load()
.
Hence, to circumvent the RL's limitations and use ES6+ features, offload the code with the problematic ES6+ features to any JS subpage of a user page and import it into the directly loaded code, e.g. via the following line:
mw.loader.load('https://terraria.fandom.com/wiki/User:Rye_Greenwood/sandbox.js?action=raw&ctype=text/javascript');
About this, see also:
- https://phabricator.wikimedia.org/T75714
- https://zh.wikipedia.org/wiki/MediaWiki:Gadget-confirm-logout.js
- https://www.mediawiki.org/wiki/ResourceLoader/ES6 (note that Fandom doesn't use MW 1.36 yet)
Things related to Extension:Scribunto
Printing a table:
Remember that table.concat()
only works for non-associative arrays, i.e. tables with purely numerical indices.
General things about the MediaWiki software
Bot rights:
Cascade-protected pages can only be edited if the protect
right is granted. editprotected
or editsemiprotected
will not suffice.
https://www.mediawiki.org/wiki/Special:ListGroupRights (search for "cascade")
Search methods:
go
= Clicking the search button after typing the text in the search boxfulltext
= Clicking the button labeled "Search for pages containing ..." below all the search suggestions
Documentation of load.php
:
https://doc.wikimedia.org/mediawiki-core/master/php/load_8php_source.html
Interesting URL parameters:
https://en.wikipedia.org/wiki/Help:URL#URLs_of_Wikipedia_pages
Backend errors:
500
when viewing any regular page might be caused by the wiki's skin. Try ?useskin=
or, to permanently switch the skin option, the API call new mw.Api().saveOption('skin','<targetskin>')
in the browser console.
503: Backend fetch failed
on Special:RecentChanges is most likely caused by a too-high limit in the user preferences. Set it to something really low, like 10 edits and 5 days, and try again.
Example of a soft redirect:
https://de.wikipedia.org/wiki/Benutzer:Ghettoblaster
Strip markers:
Those "UNIQ--QINU" strings
https://www.mediawiki.org/wiki/Strip_marker
ce
:
The abbreviation "ce" stands for "copy edit".
Things related to Extension:ParserPower
Template parameters in list pattern:
In the pattern
parameter of a list function like #lstmap
, template parameters must not be escaped in order to work as expected.
Things related to Extension:RegexFunctions
Failing regexes:
The extension has a built-in variable called RegexFunctionsPerPage
that limits the number of total parser functions from that extension on a page. Any parser function call beyond the limit will fail. The variable is set to 10 by default but can be increased in the wiki's backend.
https://gitlab.com/hydrawiki/extensions/regexfunctions/-/blob/master/RegexFunctions.hooks.php#L37
https://gitlab.com/hydrawiki/extensions/regexfunctions/-/blob/master/extension.json#L27
Unexpected expansions:
It seems like #rreplace
always expands its replacement
parameter, and only "hides" it if nothing is matched. This means that other parser functions in replacement
are called unexpectedly. For example, in {{#rreplace:string|[0-9]|X{{#vardefine:v|yes}}}}
the #vardefine
is expanded even though the pattern has no matches and the X
is not visible.
General things about wikitext
Ignored whitespace:
If a category is immediately followed by anything (e.g. [[Category:Foo]][[File:Bar.png]]
, then all whitespace in front of the category will be ignored.
For the example of {{rare}}
, the categorization must be placed after the file output (https://terraria.gamepedia.com/Template:Rare?diff=960315&oldid=959770 and https://terraria.gamepedia.com/Template:Rare?diff=1106778&oldid=1106766).
Converted apostrophes:
Magic words like {{PAGENAME}}
and {{BASEPAGENAME}}
will convert apostrophes to HTML entities. Wrap them in {{#titleparts:}}
to prevent that.
Blank vs. omitted template parameters:
If a template parameter is set to a blank value, e.g. {{test|param=}}
, then {{{param|fallback}}}
is parsed to the empty string
, not fallback
.
If the parameter is omitted, however, e.g. {{test}}
, then {{{param|fallback}}}
is parsed to fallback
.
This facilitates checking if a parameter is omitted, e.g. via {{#ifeq:{{{param|-unset}}}|{{{param|unset-}}}|param is set|param was omitted}}
. If the parameter is set (even to blank), then {{{param|-unset}}}
and {{{param|unset-}}}
will both be parsed to the same. If it's omitted, however, then they will be parsed to their defaults, -unset
and unset-
in this case, which are not the same.