User:Shushugah/documentation
From Wikipedia, the free encyclopedia
Personal notes on useful templates and examples
Help:A_quick_guide_to_templates functions that generate wiki markdown content. By default, templates are transclusive so you'll see the template used rather than the compiled text. It has syntax of {{some_function}}. To use it with substitution (i.e. permanently create text at publish time, such as {{subst:some_function}}. A real example would be {{subst:Uw-plagiarism}} which can be found on Template:Uw-plagiarism. A common example would be signing posts with ~~~~. Templates are platform specific, and can accept arguments. Templates can be nested.
Personal use cases
Markup and compiled result
This substituted Mra code {{subst:Mra|{{ill|Jüdische Rundschau|de|Jüdische Rundschau|he|יידישה רונדשאו}}}} produces what you see in immediate section below.
Interlanguage Links
English wikilink with German and Hebrew interlanguage links in this edit
| Markup | Renders as |
|---|---|
{{ill|Jüdische Rundschau|de|Jüdische Rundschau|he|יידישה רונדשאו}} |
Nested infoboxes
Note the param module, and embed=yes. Used in this edit
| Markup | Renders as | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
{{Infobox person
| image = Uri Avneri 1965-11-01 (cropped).jpg
| caption = Avnery in 1965
| birth_name = '''Helmut Ostermann'''
| birth_date = {{Birth date|df=y|1923|9|10|}}
| birth_place = [[Beckum, Germany|Beckum]], Germany
| death_date = {{death date and age|df=y|2018|8|20|1923|9|10|}}
| death_place = [[Tel Aviv]], [[Israel]]
|module = {{Infobox member of the Knesset
|embed = yes
| Year of Aliyah = 1933
| Knesset(s) = [[Israeli legislative election, 1965|6]], [[Israeli legislative election, 1969|7]], [[Israeli legislative election, 1977|9]]
| party1 = [[Meri (political party)|Meri]]
| partyyears1 = 1965–1974
| party2 = [[Left Camp of Israel]]
| partyyears2 = 1979–1981
}}
}} |
| ||||||||||
Using Wikidata
Wikidata is exciting, because it has potential to replace or compliment the manual updating of infoboxes with structured data. As a live demo, I emptied out most of the attributes below, such as birth and death dates. Note the image changed too. As off this publication, the death_dates were not sourced on wikidata, so they do not appear here. For non biography (or no BLP?), you can use onlysourced=false param, to include everything. You can whitelist or blacklist specific params if needed.
The documentation for Template:Infobox_person/Wikidata/sandbox was incomplete and confusing. So far I understand that the params qid and fetchwikidata are required. Embedded Wikidatas is my next challenge to figure out.
| Markup | Renders as | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{Infobox person/Wikidata
| qid = Q325679
| fetchwikidata = ALL
| onlysourced = yes
| image =
| caption =
| birth_name =
| birth_date =
| birth_place =
| spouse =
|module = {{Infobox member of the Knesset
|embed = yes
| Year of Aliyah = 1933
| Knesset(s) = [[Israeli legislative election, 1965|6]], [[Israeli legislative election, 1969|7]], [[Israeli legislative election, 1977|9]]
| party1 = [[Meri (political party)|Meri]]
| partyyears1 = 1965–1974
| party2 = [[Left Camp of Israel]]
| partyyears2 = 1979–1981
}}
}} |
| ||||||||||||||||
Template:Coord
A convenient javascript function to extract coordinates from console of a Google maps web page in nearly any browser for the Coordinate values in the Infobox;
(function () { var matches = location.toString().match("\/maps\/.*@([0-9.-]+),([0-9.-]+)"); prompt('',"{{coord|" + matches[1] + "|" + matches[2] + "}}"); }());
Gadgets and tools
- Trying to update publications with a wikidata author item? Use https://author-disambiguator.toolforge.org/ which I made extensive use of in Paul Brombacher's dozens of publications.