Wiktionary
gdwiktionary
https://gd.wiktionary.org/wiki/Pr%C3%AComh-Dhuilleag
MediaWiki 1.47.0-wmf.13
case-sensitive
Meadhan
Sònraichte
Deasbaireachd
Cleachdaiche
Deasbaireachd a' chleachdaiche
Wiktionary
An deasbaireachd aig Wiktionary
Faidhle
Deasbaireachd an fhaidhle
MediaWiki
Deasbaireachd MediaWiki
Teamplaid
Deasbaireachd na teamplaid
Cobhair
Deasbaireachd na cobharach
Roinn-seòrsa
Deasbaireachd na roinn-seòrsa
TimedText
TimedText talk
Mòideal
Deasbaireachd mòideil
Event
Event talk
Èirinn
0
17769
88764
88679
2026-08-03T23:23:47Z
Altronic
4137
88764
wikitext
text/x-wiki
==Gàidhlig==
[[Image:LocationIslandIreland.png|thumb|Àite an Eilean '''Èireann'''.]]
===Cruthan eile===
* [[Éirinn]] {{lb|gd|mì-GOC litreachadh}}
===Ainmear sònrachaidh===
{{gd-proper noun|b|Èireann|-}}
# [[eilean|Eilean]] mòr a th' ann an [[Roinn-Eòrpa]] iar-thuathach, ri taobh Eilean na [[Breatann Mòr|Breatainne Mòire]].
# [[dùthaich|Dùthaich]] a th' ann an [[Roinn-Eòrpa]] iar-thuathach, anns an Eilean Èireann.
#: {{synonyms|gd|Poblachd na h-Èireann}}
====Teàrnadh====
{{gd-decl-Èirinn}}
===Mùthachadh===
{{gd-mut}}
===Barrachd fiosrachaidh===
* {{R:Dwelly}}
qyqshenfqb9v29caxtqoa4f9d8myb1b
Teamplaid:verbal noun of
10
17860
88765
88696
2026-08-04T00:27:04Z
Altronic
4137
text
88765
wikitext
text/x-wiki
{{#invoke:form of/templates|tagged_form_of_t|vnoun|cat=ainmeir ghnìomhaireach}}<!--
--><noinclude>{{documentation}}</noinclude>
ir4s96kgb2yb4qypy78zcqtdhu3dpkx
Teamplaid:gd-prep
10
17879
88750
2026-08-01T16:08:54Z
en>SaoiDunNeachdain
0
88750
wikitext
text/x-wiki
{{#invoke:checkparams|error}}<!-- Validate template parameters
-->{{head|gd|preposition|head={{{head|}}}|<!--
--->{{#switch:{{{1|}}}|nom=+ nominative|dat=+ dative|gen=+ genitive|gen+=+ genitive or possessive determiner|nd=+ nominative with the definite article, + dative otherwise}}<!--
--->||{{#switch:{{{2|}}}|L=triggers lenition|H=triggers H-prothesis|T=triggers T-prothesis|L+=triggers lenition of consonants and Dh-prothesis of vowels|L-=triggers lenition except before d, t, n or s|-L=triggers lenition in certain established phrases|N=triggers eclipsis of a vowel|-=no mutation}}||{{{desc|}}}||{{#if:{{{def|}}}|before the definite article|}}|{{#if:{{{def|}}}|{{{def}}}|}}|{{#if:{{{def2|}}}|combined with the singular definite article|}}|{{#if:{{{def2|}}}|{{{def2}}}|}}|{{#if:{{{def3|}}}|combined with the plural definite article|}}|{{#if:{{{def3|}}}|{{{def3}}}|}}|cat2=prepositions governing the {{#switch:{{{1|}}}|nom|nd=nominative|dat|nd=dative|gen|gen+=genitive||}}}}<!--
---><!--
---><noinclude>{{documentation}}{{tcat|hw}}</noinclude>
7njk0ummd7r4spzw41je3fhy26w1mcs
88751
88750
2026-08-03T14:24:17Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:gd-prep]]
88750
wikitext
text/x-wiki
{{#invoke:checkparams|error}}<!-- Validate template parameters
-->{{head|gd|preposition|head={{{head|}}}|<!--
--->{{#switch:{{{1|}}}|nom=+ nominative|dat=+ dative|gen=+ genitive|gen+=+ genitive or possessive determiner|nd=+ nominative with the definite article, + dative otherwise}}<!--
--->||{{#switch:{{{2|}}}|L=triggers lenition|H=triggers H-prothesis|T=triggers T-prothesis|L+=triggers lenition of consonants and Dh-prothesis of vowels|L-=triggers lenition except before d, t, n or s|-L=triggers lenition in certain established phrases|N=triggers eclipsis of a vowel|-=no mutation}}||{{{desc|}}}||{{#if:{{{def|}}}|before the definite article|}}|{{#if:{{{def|}}}|{{{def}}}|}}|{{#if:{{{def2|}}}|combined with the singular definite article|}}|{{#if:{{{def2|}}}|{{{def2}}}|}}|{{#if:{{{def3|}}}|combined with the plural definite article|}}|{{#if:{{{def3|}}}|{{{def3}}}|}}|cat2=prepositions governing the {{#switch:{{{1|}}}|nom|nd=nominative|dat|nd=dative|gen|gen+=genitive||}}}}<!--
---><!--
---><noinclude>{{documentation}}{{tcat|hw}}</noinclude>
7njk0ummd7r4spzw41je3fhy26w1mcs
Teamplaid:R:gd:Borgstrom1941
10
17880
88752
2025-12-31T14:09:05Z
en>SaoiDunNeachdain
0
This is a book in a series, not a chapter in a book.
88752
wikitext
text/x-wiki
{{#invoke:quote|call_template
|template=cite-book
|last=Borgstrøm
|first=Carl Hj.
|authorlink=Carl Borgstrøm
|title=A linguistic survey of the Gaelic dialects of Scotland, Vol. II: The dialects of Skye and Ross-shire
|year=1941
|location=Oslo
|publisher=Norsk Tidsskrift for Sprogvidenskap
|pageparam=1
}}<noinclude>{{refcat}}</noinclude>
5jha51i0w2fkfpaiob4xs26ekrm4yru
88753
88752
2026-08-03T14:25:36Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:R:gd:Borgstrom1941]]
88752
wikitext
text/x-wiki
{{#invoke:quote|call_template
|template=cite-book
|last=Borgstrøm
|first=Carl Hj.
|authorlink=Carl Borgstrøm
|title=A linguistic survey of the Gaelic dialects of Scotland, Vol. II: The dialects of Skye and Ross-shire
|year=1941
|location=Oslo
|publisher=Norsk Tidsskrift for Sprogvidenskap
|pageparam=1
}}<noinclude>{{refcat}}</noinclude>
5jha51i0w2fkfpaiob4xs26ekrm4yru
Teamplaid:R:gd:Borgstrom1940
10
17881
88754
2026-06-12T18:38:21Z
en>Surjection
0
Protected "[[Template:R:gd:Borgstrom1940]]": Highly visible template/module ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
88754
wikitext
text/x-wiki
{{#invoke:quote|call_template
|template=cite-book
|last=Borgstrøm |first=Carl Hj. |authorlink=Carl Borgstrøm
|title=A linguistic survey of the Gaelic dialects of Scotland, Vol. I: The dialects of the Outer Hebrides
|year=1940 |location=Oslo |publisher=Norsk Tidsskrift for Sprogvidenskap
|pageparam = 2
}}<noinclude>{{documentation}}</noinclude>
rir3d0jxwk7sp0diugdjo9qpr58m5gi
88755
88754
2026-08-03T14:25:39Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:R:gd:Borgstrom1940]]
88754
wikitext
text/x-wiki
{{#invoke:quote|call_template
|template=cite-book
|last=Borgstrøm |first=Carl Hj. |authorlink=Carl Borgstrøm
|title=A linguistic survey of the Gaelic dialects of Scotland, Vol. I: The dialects of the Outer Hebrides
|year=1940 |location=Oslo |publisher=Norsk Tidsskrift for Sprogvidenskap
|pageparam = 2
}}<noinclude>{{documentation}}</noinclude>
rir3d0jxwk7sp0diugdjo9qpr58m5gi
Teamplaid:R:gd:MacPherson:1945
10
17882
88756
2025-12-10T15:40:55Z
en>AutoDooz
0
checkparam: use error instead of warning
88756
wikitext
text/x-wiki
{{#invoke:checkparams|error}}<!-- Validate template parameters
-->{{cite-thesis
|author=John MacPherson
|title=The Gaelic dialect of North Uist
|year=1945 |publisher=University of Edinburgh |location=Edinburgh
|url = https://era.ed.ac.uk/handle/1842/28515
|page = {{{page|{{{2|}}}}}}
|pages = {{{pages|}}}
}}<noinclude>{{documentation}}</noinclude>
42r8c75kym1r511xaimt5esly6pb8j6
88757
88756
2026-08-03T14:25:48Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:R:gd:MacPherson:1945]]
88756
wikitext
text/x-wiki
{{#invoke:checkparams|error}}<!-- Validate template parameters
-->{{cite-thesis
|author=John MacPherson
|title=The Gaelic dialect of North Uist
|year=1945 |publisher=University of Edinburgh |location=Edinburgh
|url = https://era.ed.ac.uk/handle/1842/28515
|page = {{{page|{{{2|}}}}}}
|pages = {{{pages|}}}
}}<noinclude>{{documentation}}</noinclude>
42r8c75kym1r511xaimt5esly6pb8j6
Teamplaid:cite-thesis
10
17883
88758
2026-04-18T01:04:46Z
en>沈澄心
0
[IPE-NEXT] Quick edit
88758
wikitext
text/x-wiki
{{#invoke:checkparams|warn}}<!-- Validate template parameters
--><includeonly>{{cite-meta
|author = {{{author|{{{2|}}}}}}
|last = {{{last|}}}
|first = {{{first|}}}
|authorlink = {{{authorlink|}}}
|author2 = {{{author2|}}}
|last2 = {{{last2|}}}
|first2 = {{{first2|}}}
|authorlink2 = {{{authorlink2|}}}
|author3 = {{{author3|}}}
|last3 = {{{last3|}}}
|first3 = {{{first3|}}}
|authorlink3 = {{{authorlink3|}}}
|author4 = {{{author4|}}}
|last4 = {{{last4|}}}
|first4 = {{{first4|}}}
|authorlink4 = {{{authorlink4|}}}
|author5 = {{{author5|}}}
|last5 = {{{last5|}}}
|first5 = {{{first5|}}}
|authorlink5 = {{{authorlink5|}}}
|coauthors = {{{coauthors|}}}
|quotee = {{{quotee|}}}
|chapter = {{{chapter|}}}
|chapterurl = {{{chapterurl|}}}
|entry = {{{entry|}}}
|entryurl = {{{entryurl|}}}
|trans-chapter = {{{trans-chapter|{{{trans-entry|}}}}}}
|translator = {{{trans|{{{translator|{{{translators|}}}}}}}}}
|editor = {{{editor|}}}
|editors = {{{editors|}}}
|title = {{{title|{{{3|}}}}}}
|trans-title = {{{trans-title|}}}
|type = {{{type|{{{5|Thesis}}}}}}
|series = {{{series|}}}
|seriesvolume = {{{seriesvolume|}}}
|url = {{{url|{{{6|}}}}}}
|archiveurl = {{{archiveurl|}}}
|archivedate = {{{archivedate|}}}
|edition = {{{edition|}}}
|location = {{{location|}}}
|publisher = {{{publisher|{{{4|}}}}}}
|month = {{{month|}}}
|year = {{{year|{{{1|}}}}}}
|year_published = {{{year_published|}}}
|date = {{{date|}}}
|genre = {{{genre|}}}
|lang = {{{language|{{{lang|{{{worklang|}}}}}}}}}
|volume = {{{volume|}}}
|issue = {{{issue|}}}
|others = {{{others|}}}
|section = {{{section|}}}
|sectionurl = {{{sectionurl|}}}
|page = {{{page|{{{7|}}}}}}
|pages = {{{pages|}}}
|pageurl = {{{pageurl|{{{link|}}}}}}
|column = {{{column|}}}
|columns = {{{columns|}}}
|columnurl = {{{columnurl|}}}
|bibcode = {{{bibcode|}}}
|doi = {{{doi|}}}
|isbn = {{{isbn|}}}
|issn = {{{issn|}}}
|jstor = {{{jstor|}}}
|lccn = {{{lccn|}}}
|oclc = {{{oclc|}}}
|pmid = {{{pmid|}}}
|ssrn = {{{ssrn|}}}
|hdl = {{{hdl|}}}
|id = {{{id|}}}
|accessdate = {{{accessdate|}}}
|passage = {{{passage|{{{quote|{{{text|{{{8|}}}}}}}}}}}}
|passage_block = {{{text_block|{{{passage_block|}}}}}}
|translation = {{{t|{{{translation|{{{9|}}}}}}}}}
|footer = {{{footer|}}}
}}<!--Temporary tracking categories-->{{#if:{{{author|{{{last|{{{editor|{{{editors|}}}}}}}}}}}}||[[Category:Reference templates lacking the author or editor parameters]]}}{{#if:{{{title|}}}||[[Category:Reference templates lacking the title parameter]]}}{{#if:{{{date|{{{year|}}}}}}||[[Category:Reference templates lacking the date or year parameters]]}}</includeonly><noinclude>{{documentation}}</noinclude>
cq8ncqavizcoqefrkh7k8eapk1t0gyr
88759
88758
2026-08-03T14:28:05Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:cite-thesis]]
88758
wikitext
text/x-wiki
{{#invoke:checkparams|warn}}<!-- Validate template parameters
--><includeonly>{{cite-meta
|author = {{{author|{{{2|}}}}}}
|last = {{{last|}}}
|first = {{{first|}}}
|authorlink = {{{authorlink|}}}
|author2 = {{{author2|}}}
|last2 = {{{last2|}}}
|first2 = {{{first2|}}}
|authorlink2 = {{{authorlink2|}}}
|author3 = {{{author3|}}}
|last3 = {{{last3|}}}
|first3 = {{{first3|}}}
|authorlink3 = {{{authorlink3|}}}
|author4 = {{{author4|}}}
|last4 = {{{last4|}}}
|first4 = {{{first4|}}}
|authorlink4 = {{{authorlink4|}}}
|author5 = {{{author5|}}}
|last5 = {{{last5|}}}
|first5 = {{{first5|}}}
|authorlink5 = {{{authorlink5|}}}
|coauthors = {{{coauthors|}}}
|quotee = {{{quotee|}}}
|chapter = {{{chapter|}}}
|chapterurl = {{{chapterurl|}}}
|entry = {{{entry|}}}
|entryurl = {{{entryurl|}}}
|trans-chapter = {{{trans-chapter|{{{trans-entry|}}}}}}
|translator = {{{trans|{{{translator|{{{translators|}}}}}}}}}
|editor = {{{editor|}}}
|editors = {{{editors|}}}
|title = {{{title|{{{3|}}}}}}
|trans-title = {{{trans-title|}}}
|type = {{{type|{{{5|Thesis}}}}}}
|series = {{{series|}}}
|seriesvolume = {{{seriesvolume|}}}
|url = {{{url|{{{6|}}}}}}
|archiveurl = {{{archiveurl|}}}
|archivedate = {{{archivedate|}}}
|edition = {{{edition|}}}
|location = {{{location|}}}
|publisher = {{{publisher|{{{4|}}}}}}
|month = {{{month|}}}
|year = {{{year|{{{1|}}}}}}
|year_published = {{{year_published|}}}
|date = {{{date|}}}
|genre = {{{genre|}}}
|lang = {{{language|{{{lang|{{{worklang|}}}}}}}}}
|volume = {{{volume|}}}
|issue = {{{issue|}}}
|others = {{{others|}}}
|section = {{{section|}}}
|sectionurl = {{{sectionurl|}}}
|page = {{{page|{{{7|}}}}}}
|pages = {{{pages|}}}
|pageurl = {{{pageurl|{{{link|}}}}}}
|column = {{{column|}}}
|columns = {{{columns|}}}
|columnurl = {{{columnurl|}}}
|bibcode = {{{bibcode|}}}
|doi = {{{doi|}}}
|isbn = {{{isbn|}}}
|issn = {{{issn|}}}
|jstor = {{{jstor|}}}
|lccn = {{{lccn|}}}
|oclc = {{{oclc|}}}
|pmid = {{{pmid|}}}
|ssrn = {{{ssrn|}}}
|hdl = {{{hdl|}}}
|id = {{{id|}}}
|accessdate = {{{accessdate|}}}
|passage = {{{passage|{{{quote|{{{text|{{{8|}}}}}}}}}}}}
|passage_block = {{{text_block|{{{passage_block|}}}}}}
|translation = {{{t|{{{translation|{{{9|}}}}}}}}}
|footer = {{{footer|}}}
}}<!--Temporary tracking categories-->{{#if:{{{author|{{{last|{{{editor|{{{editors|}}}}}}}}}}}}||[[Category:Reference templates lacking the author or editor parameters]]}}{{#if:{{{title|}}}||[[Category:Reference templates lacking the title parameter]]}}{{#if:{{{date|{{{year|}}}}}}||[[Category:Reference templates lacking the date or year parameters]]}}</includeonly><noinclude>{{documentation}}</noinclude>
cq8ncqavizcoqefrkh7k8eapk1t0gyr
Mòideal:template cat
828
17884
88760
2026-02-16T05:24:04Z
en>Benwing2
0
allow reference templates to have etym-lang name
88760
Scribunto
text/plain
-- Author: Benwing
local export = {}
local require_when_needed = require("Module:utilities/require when needed")
local is_callable = require_when_needed("Module:fun", "is_callable")
local format_categories = require_when_needed("Module:utilities", "format_categories")
local parse_interface_module = "Module:parse interface"
local m_string_utilities = require("Module:string utilities")
local und_lang = require("Module:languages").getByCode("und", true)
local ugsub = m_string_utilities.gsub
local ufind = m_string_utilities.find
local split = m_string_utilities.split
local insert = table.insert
local concat = table.concat
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
-- This table detects the category type of the template given its name. When this is invoked, the language code has
-- already been removed from the beginning, and anything starting with a slash has been truncated. The entries are
-- processed in order and are two-element lists of Lua patterns (anchored on both sides; beware of hyphens, which need
-- to be %-escaped) and the category type to use. The category types themselves are mapped to categories in
-- category_type_to_category.
local detect_category_type_list = {
-- order is important here
-- nouns, proper nouns, pronouns
-- (1) unambiguous decl/infl templates
{"decl%-.*proper.*", "noun inflection-table"},
{"infl%-.*proper.*", "noun inflection-table"},
{"decl%-.*pron.*", "pronoun inflection-table"},
{"infl%-.*pron.*", "pronoun inflection-table"},
{"decl%-noun.*", "noun inflection-table"},
{"infl%-noun.*", "noun inflection-table"},
-- (2) nouns
{"noun", "headword-line"},
{"noun[ -]form", "headword-line"},
{"noun[ -]pl", "headword-line"},
{"noun[ -]plonly", "headword-line"},
-- Some languages, e.g. Urdu, have inflection templates called e.g. [[Template:ur-noun-f-ī]]. They should be called
-- [[Template:ur-decl-noun-f-ī]] but we can autodetect them if we exclude the likely cases that are not declension
-- templates.
{"noun%-.*", "noun inflection-table"},
{"ndecl", "noun inflection-table"},
{"ndecl%-.*", "noun inflection-table"},
-- (3) proper nouns
{"proper[ -]?noun", "headword-line"},
{"proper[ -]?noun[ -]form", "headword-line"},
{"proper[ -]?noun[ -]pl", "headword-line"},
{"proper[ -]?noun[ -]plonly", "headword-line"},
{"pnoun", "headword-line"},
{"pnoun[ -]form", "headword-line"},
{"pnoun[ -]pl", "headword-line"},
{"pnoun[ -]plonly", "headword-line"},
{"propn", "headword-line"},
{"propn[ -]form", "headword-line"},
{"propn[ -]pl", "headword-line"},
{"propn[ -]plonly", "headword-line"},
-- See above for inflection templates without 'decl' or 'infl' in them.
{"proper[ -]?noun%-.*", "noun inflection-table"},
{"pnoun%-.*", "noun inflection-table"},
{"propn%-.*", "noun inflection-table"},
-- (4) pronouns
{"pron", "headword-line"},
{"pronoun", "headword-line"},
{"pron[ -]form", "headword-line"},
{"pronoun[ -]form", "headword-line"},
{"prondecl", "pronoun inflection-table"},
{"prondecl%-.*", "pronoun inflection-table"},
-- adjectives
{"decl%-adj.*", "adjective inflection-table"},
{"infl%-adj.*", "adjective inflection-table"},
{"adj", "headword-line"},
{"adjective", "headword-line"},
{"adj[ -]form", "headword-line"},
{"adjective[ -]form", "headword-line"},
{"adj[ -]comp", "headword-line"},
{"adjective[ -]comp", "headword-line"},
{"adj[ -]sup", "headword-line"},
{"adjective[ -]sup", "headword-line"},
-- Some languages, e.g. Urdu and Lithuanian, have inflection templates called e.g. [[Template:ur-adj-1]] and
-- [[Template:lt-adj-is]]. They should be called [[Template:ur-decl-adj-1]] and [[Template:lt-decl-adj-is]] but we
-- can autodetect them if we exclude the likely cases that are not declension templates.
{"adj%-.*", "adjective inflection-table"},
{"adecl", "adjective inflection-table"},
{"adecl%-.*", "adjective inflection-table"},
-- verbs; need to avoid including conjunctions
{"verb", "headword-line"},
{"conj", "verb inflection-table"},
{"conj[0-9 -].*", "verb inflection-table"},
{"conjug.*", "verb inflection-table"},
{"infl%-verb.*", "verb inflection-table"},
-- pronunciation
{".*IPA.*", "pronunciation"},
{"pronunciation", "pronunciation"},
{"pr", "pronunciation"},
{"p", "pronunciation"},
-- form-of
{".*form of", "form-of"},
-- pronominal boxes
{".*personal pronouns", "personal pronoun"},
{".*demonstrative.*", "demonstrative"},
{".*interrogative.*", "interrogative"},
{".*possessives", "possessive"},
{".*possessive .*", "possessive"},
{".*reflexives", "reflexive"},
{".*reflexive .*", "reflexive"},
-- these next two should precede 'relative'
{".*correlatives", "pro-form"},
{".*correlative .*", "pro-form"},
{".*relative .*", "relative"},
{".*articles", "article"},
{".*prefixes", "affix"},
{".*suffixes", "affix"},
-- TOC tables
{".*TOC", "TOC"},
-- numbers, numerals
{".*numbers", "number"},
{".*numerals", "number"},
{".*ordinals", "ordinal"},
{".*cardinals", "cardinal"},
{".*digits", "digit"},
-- transliteration
{".*xlit", "orthographic conversion"},
{".*translit", "orthographic conversion"},
-- orthographic and regional variants
{".*variant", "orthographic variant"},
{".*regional", "regional variant"},
-- sign production templates
-- FIXME: We should limit this to sign languages. As it is, we put it near the bottom of the
-- pattern list so it doesn't accidentally override other patterns for non-sign languages.
{"prod .*", "sign production"},
}
-- This table indicates how to convert template category types to categories. It consists of a list of pairs, where the
-- first element is the category type and the second element is a key-value table containing the following keys:
-- * `aliases`: Optional list of aliases for the category type, which can be used when explicitly specifying the type,
-- e.g. {{tcat|hw}} instead of {{tcat|headword-line}}.
-- * `cats`: List of categories to add the template to. Each entry either specifies a ''raw'' category (if the category
-- name begins with "Category:"), a ''full table'' category (if the category name begins with "label:", where what
-- follows specifies the full label without the prefixed language name) or a ''regular label'' category (for other
-- strings, where e.g. if the label is "noun inflection-table", the category name is
-- "LANG noun inflection-table templates"). An entry is either a string, directly specifying the category name, or a
-- key-value table with keys `name` (the category name) and `sort` (how to generate the sort base). By default, the
-- sort base for raw categories is a comma-separated list of the language names (not codes) associated with the
-- template, or the full template name if there are no languages, and the sort base for label categories is the
-- template name minus the initial language code. If this isn't correct, the `sort` field specifies how to compute the
-- sort base. It is either a function of two arguments, the template name and language object, which should return the
-- sort base; or a table of specs telling how to compute the sort base. In the case of a function, the template name
-- passed in is the full name for raw categories, but the name minus any language code prefix in the case of label
-- categories; and for raw categories, a list of all associated language objects is passed in, or {nil} if none, while
-- for label categories, a single language object is passed in. (Label categories can only exist if there are
-- associated languages.) In the case where `sort` is a table of specs, it is a list where each element is a
-- two-element list of a Lua pattern anchored on both sides and the corresponding pattern replacement string. The
-- specs are processed in order.
local category_type_to_category = {
-- Inflection-table templates
{"noun inflection-table", {
aliases = {"nouninfl", "noundecl", "ndecl"},
cats = {{name = "noun inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"noun%-(.*)", "%1"},
-- put this twice to catch noun-decl-* and decl-noun-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"noun", "*"},
{"ndecl%-base%-(.*)", " %1"},
{"ndecl%-base", " "},
{"ndecl%-(.*)", "%1"},
{"ndecl", "*"},
{"propndecl%-base%-(.*)", " %1"},
{"propndecl%-base", " "},
{"propndecl%-(.*)", "%1"},
{"propndecl", "*"},
{"proper[ -]?noun%-(.*)", "%1"},
{"propn%-(.*)", "%1"},
{"pnoun%-(.*)", "%1"},
}}},
}},
{"pronoun inflection-table", {
aliases = {"proninfl", "prondecl"},
cats = {{name = "pronoun inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"pronoun%-(.*)", "%1"},
{"pron%-(.*)", "%1"},
-- put this twice to catch pron-decl-* and decl-pron-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"pronoun", "*"},
{"pron", "*"},
{"prondecl%-base%-(.*)", " %1"},
{"prondecl%-base", " "},
{"prondecl%-(.*)", "%1"},
{"prondecl", "*"},
}}},
}},
{"article inflection-table", {
aliases = {"artinfl", "artdecl"},
cats = {{name = "article inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"article%-(.*)", "%1"},
{"art%-(.*)", "%1"},
-- put this twice to catch art-decl-* and decl-art-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"article", "*"},
{"art", "*"},
{"artdecl%-base%-(.*)", " %1"},
{"artdecl%-base", " "},
{"artdecl%-(.*)", "%1"},
{"artdecl", "*"},
}}},
}},
{"determiner inflection-table", {
aliases = {"detinfl", "detdecl"},
cats = {{name = "determiner inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"determiner%-(.*)", "%1"},
{"det%-(.*)", "%1"},
-- put this twice to catch det-decl-* and decl-det-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"determiner", "*"},
{"det", "*"},
{"detdecl%-base%-(.*)", " %1"},
{"detdecl%-base", " "},
{"detdecl%-(.*)", "%1"},
{"detdecl", "*"},
}}},
}},
{"preposition inflection-table", {
aliases = {"prepinfl", "prepdecl"},
cats = {{name = "preposition inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"preposition%-(.*)", "%1"},
{"prep%-(.*)", "%1"},
-- put this twice to catch prep-decl-* and decl-prep-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"preposition", "*"},
{"prep", "*"},
{"prepdecl%-base%-(.*)", " %1"},
{"prepdecl%-base", " "},
{"prepdecl%-(.*)", "%1"},
{"prepdecl", "*"},
{"prepinfl%-base%-(.*)", " %1"},
{"prepinfl%-base", " "},
{"prepinfl%-(.*)", "%1"},
{"prepinfl", "*"},
}}},
}},
{"postposition inflection-table", {
aliases = {"postpinfl", "postpdecl"},
cats = {{name = "postposition inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"postposition%-(.*)", "%1"},
{"postp%-(.*)", "%1"},
{"post%-(.*)", "%1"},
-- put this twice to catch postp-decl-* and decl-postp-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"postposition", "*"},
{"postp", "*"},
{"post", "*"},
{"postpdecl%-base%-(.*)", " %1"},
{"postpdecl%-base", " "},
{"postpdecl%-(.*)", "%1"},
{"postpdecl", "*"},
{"postpinfl%-base%-(.*)", " %1"},
{"postpinfl%-base", " "},
{"postpinfl%-(.*)", "%1"},
{"postpinfl", "*"},
}}},
}},
{"adjective inflection-table", {
aliases = {"adjinfl", "adjdecl", "adecl"},
cats = {{name = "adjective inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adj%-(.*)", "%1"},
{"adjective%-(.*)", "%1"},
-- put this twice to catch adj-decl-* and decl-adj-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adj", "*"},
{"adjective", "*"},
{"adecl%-base%-(.*)", " %1"},
{"adecl%-base", " "},
{"adecl%-(.*)", "%1"},
{"adecl", "*"},
}}},
}},
{"numeral inflection-table", {
aliases = {"numinfl", "numdecl"},
cats = {{name = "numeral inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"numeral%-(.*)", "%1"},
{"number%-(.*)", "%1"},
{"num%-(.*)", "%1"},
-- put this twice to catch num-decl-* and decl-num-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"numeral", "*"},
{"number", "*"},
{"num", "*"},
{"numdecl%-base%-(.*)", " %1"},
{"numdecl%-base", " "},
{"numdecl%-(.*)", "%1"},
{"numdecl", "*"},
}}},
}},
{"nominal inflection-table", {
aliases = {"nominfl", "nomdecl"},
cats = {{name = "nominal inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"nominal%-(.*)", "%1"},
{"nom%-(.*)", "%1"},
-- put this twice to catch nom-decl-* and decl-nom-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"nominal", "*"},
{"nom", "*"},
{"nomdecl%-base%-(.*)", " %1"},
{"nomdecl%-base", " "},
{"nomdecl%-(.*)", "%1"},
{"nomdecl", "*"},
}}},
}},
{"verb inflection-table", {
aliases = {"verbinfl", "conj"},
cats = {{name = "verb inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"verb%-(.*)", "%1"},
-- put this twice to catch verb-infl-* and infl-verb-*
{"infl%-(.*)", "%1"},
{"conj%-base%-(.*)", " %1"},
{"conj%-base", " "},
-- handle conj2, conj1-c, etc.
{"conj%-?(.*)", "%1"},
{"conj", "*"},
}}},
}},
{"adverb inflection-table", {
aliases = {"advinfl"},
cats = {{name = "adverb inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adverb%-(.*)", "%1"},
{"adv%-(.*)", "%1"},
-- put this twice to catch adv-decl-* and decl-adv-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adverb", "*"},
{"adv", "*"},
{"advinfl%-base%-(.*)", " %1"},
{"advinfl%-base", " "},
{"advinfl%-(.*)", "%1"},
{"advinfl", "*"},
}}},
}},
-- Inflection-table subtemplates
{"inflection-table sub", {
aliases = {"inflsub"},
cats = {"label:inflection-table subtemplates"},
}},
-- Definition templates
-- Headword-line templates
{"headword-line", {
aliases = {"hw", "headword"},
cats = {"headword-line"},
}},
-- Definition templates
{"definition", {
aliases = {"def", "defn"},
cats = {"definition"},
}},
{"form-of", {
aliases = {"form of"},
cats = {"form-of"},
}},
-- Etymology and pronunciation templates
{"etymology", {
aliases = {"etym"},
cats = {"etymology"},
}},
{"morphology", {
aliases = {"morph"},
cats = {"etymology", "Category:Language-specific morphology templates"},
}},
{"pronunciation", {
aliases = {"pron"},
cats = {"pronunciation"},
}},
{"sign production", {
aliases = {"signprod"},
cats = {{name = "sign production", sort = {
{"prod (.*)", "%1"},
}}},
}},
-- Pseudo-namespace templates
{"reference", {
aliases = {"ref"},
cats = {{name = "reference", allow_etym = true}},
}},
{"quotation", {
aliases = {"quote"},
cats = {"quotation"},
}},
{"usage", {
cats = {"usage"},
}},
{"list", {
cats = {"list"},
}},
{"auto-table", {
aliases = {"table"},
cats = {"auto-table"},
}},
-- Navigation templates
-- Pro-form box templates
{"pro-form", {
aliases = {"pro-forms"},
cats = {"navigation", "Category:Pro-form box templates"},
}},
{"adposition", {
aliases = {"adpositions", "preposition", "prepositions", "postposition", "postpositions"},
cats = {"navigation", "Category:Adposition box templates"},
}},
{"affix", {
aliases = {"affixes", "prefix", "prefixes", "suffix", "suffixes"},
cats = {"navigation", "Category:Pro-form affix box templates"},
}},
{"article", {
aliases = {"articles"},
cats = {"navigation", "Category:Grammatical article box templates"},
}},
{"demonstrative", {
aliases = {"demonstratives"},
cats = {"navigation", "Category:Demonstrative box templates"},
}},
{"interrogative", {
aliases = {"interrogatives"},
cats = {"navigation", "Category:Interrogative box templates"},
}},
{"personal pronoun", {
aliases = {"perspron", "personal pronouns"},
cats = {"navigation", "Category:Personal pronoun box templates"},
}},
{"possessive", {
aliases = {"possessives"},
cats = {"navigation", "Category:Possessive pronoun and determiner box templates"},
}},
{"reflexive", {
aliases = {"reflexives"},
cats = {"navigation", "Category:Reflexive pronoun and determiner box templates"},
}},
{"relative", {
aliases = {"relatives"},
cats = {"navigation", "Category:Relative pronoun and determiner box templates"},
}},
{"navigation", {
-- miscellaneous navigation box templates like {{eu-aux verbs}}, {{pt-forms of address}}
aliases = {"nav"},
cats = {"navigation"},
}},
{"TOC", {
cats = {{name = "navigation", sort = {
{"categoryTOC", "TOC"},
}}, "Category:TOC templates"},
}},
{"number", {
aliases = {"numbers"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"cardinal", {
aliases = {"cardinals"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"ordinal", {
aliases = {"ordinals"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"digit", {
aliases = {"digits"},
cats = {"list", "Category:Language-specific number templates"},
}},
-- Entry templates
{"entry", {
cats = {"entry"},
}},
-- Orthographic conversion templates (e.g. for converting between scripts)
{"orthographic conversion", {
aliases = {"transliteration", "translit", "xlit", "orthconv", "scriptconv"},
cats = {"conversion", "Category:Orthographic conversion templates"},
}},
-- Orthographic and regional variant templates (for displaying orthographic, script and/or regional variants)
{"orthographic variant", {
aliases = {"orthvar", "scriptvar"},
-- Currently we categorize orthographic and regional variants the same but we could split them if needed
cats = {"navigation", "Category:Orthographic and regional variant templates"},
}},
{"regional variant", {
aliases = {"regvar"},
cats = {"navigation", "Category:Orthographic and regional variant templates"},
}},
-- Internal link templates
{"link", {
cats = {"link", "Category:Language-specific internal link templates"},
}},
}
local category_type_to_category_map = {}
for _, category_type_to_category_spec in ipairs(category_type_to_category) do
local category_type, props = unpack(category_type_to_category_spec)
category_type_to_category_map[category_type] = props
if props.aliases then
for _, alias in ipairs(props.aliases) do
category_type_to_category_map[alias] = props
end
end
end
-- Split an argument on comma, but not comma followed by whitespace; split off sort base after a colon.
local function split_on_comma_and_split_off_sort_base(val)
local cattypes
if val:find(",") then
-- Don't optimize more than this because there can be commas backslashed, inside of links or followed by
-- whitespace that don't cause splitting.
cattypes = require(parse_interface_module).split_on_comma(val)
else
cattypes = {val}
end
for i, cattype_spec in ipairs(cattypes) do
if cattype_spec:find(":") then
local cattype, sort_base = cattype_spec:match("^(.-):(.*)$")
sort_base = sort_base:gsub("_", " ")
cattypes[i] = {name = cattype, sort_base = sort_base}
end
end
return cattypes
end
local function get_lang_or_script(code)
return code == "-" and code or
require("Module:languages").getByCode(code, nil, "allow etym") or
require("Module:languages").getByCode(code .. "-pro", nil, "allow etym") or
require("Module:scripts").getByCode(code)
end
local function obj_code(obj)
if obj == "-" then
return obj
end
return obj:getCode()
end
local function get_prefixed_obj(after_prefix)
return after_prefix:match("^(%a[%a-]*%a):(.+)$")
end
local function get_suffixed_obj(after_prefix)
local rest, objcode = after_prefix:match("^(.+)/(%a[%a-]*%a)$")
return objcode, rest
end
local pseudo_namespace_templates = {
{"R:", {
category_type = "reference",
get_obj_and_rest = get_prefixed_obj,
}},
{"RQ:", {
category_type = "quotation",
get_obj_and_rest = get_prefixed_obj,
}},
{"U:", {
category_type = "usage",
get_obj_and_rest = get_prefixed_obj,
}},
{"list:", {
category_type = "list",
get_obj_and_rest = get_suffixed_obj,
}},
{"table:", {
category_type = "auto-table",
get_obj_and_rest = get_suffixed_obj,
}},
}
local function infer_lang_or_script_code_and_category_type(name)
if name:find(":") then -- only check for pseudo-namespace prefix when a colon is present
for _, pseudo_namespace_spec in ipairs(pseudo_namespace_templates) do
local prefix, props = unpack(pseudo_namespace_spec)
local after_prefix = name:match("^" .. prefix .. "(.+)$")
if after_prefix then
local objcode, rest = props.get_obj_and_rest(after_prefix)
local obj
if objcode then
obj = get_lang_or_script(objcode) -- may return nil
if not obj then
rest = after_prefix
end
else
rest = after_prefix
end
return obj, rest, props.category_type
end
end
end
local hyphen_parts = split(name, "%-")
for i = #hyphen_parts - 1, 1, -1 do
local code = concat(hyphen_parts, "-", 1, i)
local obj = get_lang_or_script(code)
if obj then
local rest = concat(hyphen_parts, "-", i + 1)
return obj, rest, nil
end
end
return nil, name, nil
end
local function process_sortbase_specs(sortbase, specs)
for _, spec in ipairs(specs) do
local from, to = unpack(spec)
sortbase = ugsub(sortbase, "^" .. from .. "$", to)
end
return sortbase
end
local function template_name_minus_langcode_to_category_type(name)
for _, type_spec in ipairs(detect_category_type_list) do
local pattern, intended_type = unpack(type_spec)
if ufind(name, "^" .. pattern .. "$") then
return intended_type
end
end
return nil
end
local function compute_categories_for_template(full_template_name, template_name_minus_langcode, category_type,
langs_or_scripts)
local overriding_sort_base
if type(category_type) == "table" then
overriding_sort_base = category_type.sort_base
category_type = category_type.name
end
if not category_type_to_category_map[category_type] then
error("Unrecognized template category type: " .. category_type)
end
local props = category_type_to_category_map[category_type]
if not props.cats then
error("Internal error: No categories given for category type: " .. category_type)
end
local categories = {}
for _, catspec in ipairs(props.cats) do
if type(catspec) == "string" then
catspec = {name = catspec}
end
local rawcat = catspec.name:match("^Category:(.*)")
if rawcat then
local sortbase
-- User-specified sort base does not apply to raw categories, which have a different sort key format
-- than language-specific categories.
if not catspec.sort then
if langs_or_scripts then
local langnames = {}
for _, lang_or_sc in ipairs(langs_or_scripts) do
insert(langnames, lang_or_sc:getCanonicalName()) -- FIXME: or lang:getFullName()?
end
sortbase = concat(langnames, ",")
else
sortbase = full_template_name
end
elseif is_callable(catspec.sort) then
sortbase = catspec.sort(full_template_name, langs_or_scripts)
else
sortbase = process_sortbase_specs(full_template_name, catspec.sort)
end
insert(categories, {cat = rawcat, lang = und_lang, sort_base = sortbase})
elseif langs_or_scripts then
for _, lang_or_sc in ipairs(langs_or_scripts) do
local sortbase
if overriding_sort_base then
sortbase = overriding_sort_base
elseif not catspec.sort then
sortbase = template_name_minus_langcode
elseif is_callable(catspec.sort) then
sortbase = catspec.sort(template_name_minus_langcode, lang_or_sc)
else
sortbase = process_sortbase_specs(template_name_minus_langcode, catspec.sort)
end
if lang_or_sc:hasType("script") then
insert(categories, {
cat = ("%s templates"):format(lang_or_sc:getCategoryName()), lang = und_lang, sc = lang_or_sc,
sort_base = sortbase,
})
else
local cat
local full_label = catspec.name:match("^label:(.*)$")
local lang_name = catspec.allow_etym and lang_or_sc:getCanonicalName() or lang_or_sc:getFullName()
if full_label then
cat = ("%s %s"):format(lang_name, full_label)
else
cat = ("%s %s templates"):format(lang_name, catspec.name)
end
insert(categories, {
cat = cat, lang = lang_or_sc:getFull(), sort_base = sortbase,
})
end
end
end
end
if not categories[1] then
error(("No categories generated for template [[Template:%s]] with category type '%s'"):format(
full_template_name, category_type))
end
return categories
end
--[==[
Main entry point.
]==]
function export.categorize(frame)
local params = {
[1] = {}, -- comma-separated list of category types; by default, inferred from template name
lang = {}, -- comma-separated list of languages; by default, inferred from template name
["pagename"] = {}, -- for testing
["json"] = {type = "boolean"}, -- for testing
}
local parent_args = frame:getParent().args
args = require("Module:parameters").process(parent_args, params)
local category_specs = {}
local function insert_cat(cat, sort_key)
for _, existing_cat in ipairs(category_specs) do
if existing_cat.cat == cat then
return
end
end
insert(category_specs, {cat = cat, sort_key = sort_key})
end
local pagename = args.pagename
if not pagename then
title = mw.title.getCurrentTitle()
pagename = title.fullText
end
if pagename:find("/documentation$") or pagename:find("/documentation/") then
return ""
end
if pagename:find("^Template:User:") then
insert_cat("User sandbox templates", (pagename:gsub("^Template:User:", "")))
elseif pagename:find("^User:") then
insert_cat("User sandbox templates", (pagename:gsub("^User:", "")))
else
if not pagename:find("^Template:") then
error(("This template should only be used in the Template namespace, not on page '%s'"):format(pagename))
end
local full_template_name = pagename:gsub("^Template:", "")
local rootpage = full_template_name:gsub("/.*", "")
if full_template_name:find("/sandbox") then
insert_cat("Sandbox templates", full_template_name)
elseif full_template_name:find("^sandbox/") then
insert_cat("Sandbox templates", full_template_name:gsub("^sandbox/", ""))
else
local template_objs
if args.lang == "-" then
template_objs = false
elseif args.lang then
template_objs = {}
for _, code in ipairs(split(args.lang, ",")) do
-- We need to have an indicator of families because we allow bare family codes to stand for proto-languages.
if code:find("^fam:") then
code = code:gsub("^fam:", "")
local family = require("Module:families").getByCode(code) or
error(("Unrecognized family code '%s' in [[Module:template cat]]"):format(code))
local descendants = family:getDescendantCodes()
for _, desc in ipairs(descendants) do
local obj = get_lang_or_script(desc)
if obj then
-- make sure we skip families without proto-languages
insert(template_objs, obj)
end
end
else
local obj = get_lang_or_script(code)
if not obj then
error(("Unrecognized language or script code '%s'"):format(code))
end
insert(template_objs, obj)
end
end
end
local cattypes
if args[1] then
cattypes = split_on_comma_and_split_off_sort_base(args[1])
end
local inferred_obj, inferred_rest, inferred_cattype =
infer_lang_or_script_code_and_category_type(rootpage)
if template_objs == nil or not cattypes then
if template_objs == nil then
if not inferred_obj then
if not inferred_cattype then
error(("Unable to infer language or script from template root page '%s' for template '%s'; specify lang/script and type explicitly"):format(
rootpage, pagename))
else
error(("Unable to infer language or script from template root page '%s' for template '%s', inferred category type '%s'; specify lang/script explicitly"):format(
rootpage, pagename, inferred_cattype))
end
else
template_objs = {inferred_obj}
end
end
if not cattypes then
inferred_cattype = inferred_cattype or
template_name_minus_langcode_to_category_type(inferred_rest)
if not inferred_cattype then
error(("Unable to infer template category type from template remainder (after stripping langcode) '%s' for template '%s'; specify type explicitly"):format(
inferred_rest, pagename))
end
cattypes = {inferred_cattype}
end
end
for _, cattype in ipairs(cattypes) do
local cats = compute_categories_for_template(full_template_name, inferred_rest, cattype, template_objs)
for _, cat in ipairs(cats) do
insert(category_specs, cat)
end
end
end
end
-- We are returning categories for templates or user-space pages, so we need to force the output.
local retval = format_categories(category_specs, nil, nil, nil, "force_output")
if args.json then
return require("Module:JSON").toJSON {
category_specs = category_specs,
retval = mw.text.nowiki(retval),
}
else
return retval
end
end
--[==[Table used in the documentation to {{tl|template cat}}.]==]
function export.pattern_to_category_type_table()
local parts = {}
local function ins(text)
insert(parts, text)
end
ins('{|class="wikitable"')
ins("! Pattern !! Inferred category type")
for _, detect_spec in ipairs(detect_category_type_list) do
local pattern, category_type = unpack(detect_spec)
ins("|-")
ins(("| <code>%s</code> || <code>%s</code>"):format(pattern, category_type))
end
ins("|}")
return concat(parts, "\n")
end
--[==[Table used in the documentation to {{tl|template cat}}.]==]
function export.category_type_to_category_table()
local parts = {}
local function ins(text)
insert(parts, text)
end
local category_types = {}
local category_type_to_aliases = {}
for _, category_type_to_category_spec in ipairs(category_type_to_category) do
local category_type, props = unpack(category_type_to_category_spec)
insert(category_types, category_type)
category_type_to_aliases[category_type] = {}
if props.aliases then
for _, alias in ipairs(props.aliases) do
insert(category_type_to_aliases[category_type], alias)
end
table.sort(category_type_to_aliases[category_type])
end
end
table.sort(category_types)
local function get_category_type_categories(category_type)
local cats = {}
for _, catspec in ipairs(category_type_to_category_map[category_type].cats) do
if type(catspec) == "string" then
catspec = {name = catspec}
end
local cat = catspec.name
if cat:find("^Category:") then
insert(cats, ("<code>%s</code>"):format((cat:gsub("^Category:", ""))))
elseif cat:find("^label:") then
insert(cats, ("<code><var>LANG</var> %s</code>"):format((cat:gsub("^label:", ""))))
else
insert(cats, ("<code><var>LANG</var> %s templates</code>"):format(cat))
end
end
return concat(cats, ", ")
end
ins('{|class="wikitable"')
ins("! Category type !! Canonical category type !! Categories")
for _, category_type in ipairs(category_types) do
ins("|-")
ins(("| <code>'''%s'''</code> || ''(same)'' || <code>%s</code>"):format(
category_type, get_category_type_categories(category_type)))
for _, alias in ipairs(category_type_to_aliases[category_type]) do
ins("|-")
ins(("| <code>%s</code> || <code>'''%s'''</code> || <code>%s</code>"):format(
alias, category_type, get_category_type_categories(category_type)))
end
end
ins("|}")
return concat(parts, "\n")
end
return export
33dgd2grqionii83906l7r69sspy2t1
88761
88760
2026-08-03T20:56:29Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Module:template_cat]]
88760
Scribunto
text/plain
-- Author: Benwing
local export = {}
local require_when_needed = require("Module:utilities/require when needed")
local is_callable = require_when_needed("Module:fun", "is_callable")
local format_categories = require_when_needed("Module:utilities", "format_categories")
local parse_interface_module = "Module:parse interface"
local m_string_utilities = require("Module:string utilities")
local und_lang = require("Module:languages").getByCode("und", true)
local ugsub = m_string_utilities.gsub
local ufind = m_string_utilities.find
local split = m_string_utilities.split
local insert = table.insert
local concat = table.concat
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
-- This table detects the category type of the template given its name. When this is invoked, the language code has
-- already been removed from the beginning, and anything starting with a slash has been truncated. The entries are
-- processed in order and are two-element lists of Lua patterns (anchored on both sides; beware of hyphens, which need
-- to be %-escaped) and the category type to use. The category types themselves are mapped to categories in
-- category_type_to_category.
local detect_category_type_list = {
-- order is important here
-- nouns, proper nouns, pronouns
-- (1) unambiguous decl/infl templates
{"decl%-.*proper.*", "noun inflection-table"},
{"infl%-.*proper.*", "noun inflection-table"},
{"decl%-.*pron.*", "pronoun inflection-table"},
{"infl%-.*pron.*", "pronoun inflection-table"},
{"decl%-noun.*", "noun inflection-table"},
{"infl%-noun.*", "noun inflection-table"},
-- (2) nouns
{"noun", "headword-line"},
{"noun[ -]form", "headword-line"},
{"noun[ -]pl", "headword-line"},
{"noun[ -]plonly", "headword-line"},
-- Some languages, e.g. Urdu, have inflection templates called e.g. [[Template:ur-noun-f-ī]]. They should be called
-- [[Template:ur-decl-noun-f-ī]] but we can autodetect them if we exclude the likely cases that are not declension
-- templates.
{"noun%-.*", "noun inflection-table"},
{"ndecl", "noun inflection-table"},
{"ndecl%-.*", "noun inflection-table"},
-- (3) proper nouns
{"proper[ -]?noun", "headword-line"},
{"proper[ -]?noun[ -]form", "headword-line"},
{"proper[ -]?noun[ -]pl", "headword-line"},
{"proper[ -]?noun[ -]plonly", "headword-line"},
{"pnoun", "headword-line"},
{"pnoun[ -]form", "headword-line"},
{"pnoun[ -]pl", "headword-line"},
{"pnoun[ -]plonly", "headword-line"},
{"propn", "headword-line"},
{"propn[ -]form", "headword-line"},
{"propn[ -]pl", "headword-line"},
{"propn[ -]plonly", "headword-line"},
-- See above for inflection templates without 'decl' or 'infl' in them.
{"proper[ -]?noun%-.*", "noun inflection-table"},
{"pnoun%-.*", "noun inflection-table"},
{"propn%-.*", "noun inflection-table"},
-- (4) pronouns
{"pron", "headword-line"},
{"pronoun", "headword-line"},
{"pron[ -]form", "headword-line"},
{"pronoun[ -]form", "headword-line"},
{"prondecl", "pronoun inflection-table"},
{"prondecl%-.*", "pronoun inflection-table"},
-- adjectives
{"decl%-adj.*", "adjective inflection-table"},
{"infl%-adj.*", "adjective inflection-table"},
{"adj", "headword-line"},
{"adjective", "headword-line"},
{"adj[ -]form", "headword-line"},
{"adjective[ -]form", "headword-line"},
{"adj[ -]comp", "headword-line"},
{"adjective[ -]comp", "headword-line"},
{"adj[ -]sup", "headword-line"},
{"adjective[ -]sup", "headword-line"},
-- Some languages, e.g. Urdu and Lithuanian, have inflection templates called e.g. [[Template:ur-adj-1]] and
-- [[Template:lt-adj-is]]. They should be called [[Template:ur-decl-adj-1]] and [[Template:lt-decl-adj-is]] but we
-- can autodetect them if we exclude the likely cases that are not declension templates.
{"adj%-.*", "adjective inflection-table"},
{"adecl", "adjective inflection-table"},
{"adecl%-.*", "adjective inflection-table"},
-- verbs; need to avoid including conjunctions
{"verb", "headword-line"},
{"conj", "verb inflection-table"},
{"conj[0-9 -].*", "verb inflection-table"},
{"conjug.*", "verb inflection-table"},
{"infl%-verb.*", "verb inflection-table"},
-- pronunciation
{".*IPA.*", "pronunciation"},
{"pronunciation", "pronunciation"},
{"pr", "pronunciation"},
{"p", "pronunciation"},
-- form-of
{".*form of", "form-of"},
-- pronominal boxes
{".*personal pronouns", "personal pronoun"},
{".*demonstrative.*", "demonstrative"},
{".*interrogative.*", "interrogative"},
{".*possessives", "possessive"},
{".*possessive .*", "possessive"},
{".*reflexives", "reflexive"},
{".*reflexive .*", "reflexive"},
-- these next two should precede 'relative'
{".*correlatives", "pro-form"},
{".*correlative .*", "pro-form"},
{".*relative .*", "relative"},
{".*articles", "article"},
{".*prefixes", "affix"},
{".*suffixes", "affix"},
-- TOC tables
{".*TOC", "TOC"},
-- numbers, numerals
{".*numbers", "number"},
{".*numerals", "number"},
{".*ordinals", "ordinal"},
{".*cardinals", "cardinal"},
{".*digits", "digit"},
-- transliteration
{".*xlit", "orthographic conversion"},
{".*translit", "orthographic conversion"},
-- orthographic and regional variants
{".*variant", "orthographic variant"},
{".*regional", "regional variant"},
-- sign production templates
-- FIXME: We should limit this to sign languages. As it is, we put it near the bottom of the
-- pattern list so it doesn't accidentally override other patterns for non-sign languages.
{"prod .*", "sign production"},
}
-- This table indicates how to convert template category types to categories. It consists of a list of pairs, where the
-- first element is the category type and the second element is a key-value table containing the following keys:
-- * `aliases`: Optional list of aliases for the category type, which can be used when explicitly specifying the type,
-- e.g. {{tcat|hw}} instead of {{tcat|headword-line}}.
-- * `cats`: List of categories to add the template to. Each entry either specifies a ''raw'' category (if the category
-- name begins with "Category:"), a ''full table'' category (if the category name begins with "label:", where what
-- follows specifies the full label without the prefixed language name) or a ''regular label'' category (for other
-- strings, where e.g. if the label is "noun inflection-table", the category name is
-- "LANG noun inflection-table templates"). An entry is either a string, directly specifying the category name, or a
-- key-value table with keys `name` (the category name) and `sort` (how to generate the sort base). By default, the
-- sort base for raw categories is a comma-separated list of the language names (not codes) associated with the
-- template, or the full template name if there are no languages, and the sort base for label categories is the
-- template name minus the initial language code. If this isn't correct, the `sort` field specifies how to compute the
-- sort base. It is either a function of two arguments, the template name and language object, which should return the
-- sort base; or a table of specs telling how to compute the sort base. In the case of a function, the template name
-- passed in is the full name for raw categories, but the name minus any language code prefix in the case of label
-- categories; and for raw categories, a list of all associated language objects is passed in, or {nil} if none, while
-- for label categories, a single language object is passed in. (Label categories can only exist if there are
-- associated languages.) In the case where `sort` is a table of specs, it is a list where each element is a
-- two-element list of a Lua pattern anchored on both sides and the corresponding pattern replacement string. The
-- specs are processed in order.
local category_type_to_category = {
-- Inflection-table templates
{"noun inflection-table", {
aliases = {"nouninfl", "noundecl", "ndecl"},
cats = {{name = "noun inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"noun%-(.*)", "%1"},
-- put this twice to catch noun-decl-* and decl-noun-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"noun", "*"},
{"ndecl%-base%-(.*)", " %1"},
{"ndecl%-base", " "},
{"ndecl%-(.*)", "%1"},
{"ndecl", "*"},
{"propndecl%-base%-(.*)", " %1"},
{"propndecl%-base", " "},
{"propndecl%-(.*)", "%1"},
{"propndecl", "*"},
{"proper[ -]?noun%-(.*)", "%1"},
{"propn%-(.*)", "%1"},
{"pnoun%-(.*)", "%1"},
}}},
}},
{"pronoun inflection-table", {
aliases = {"proninfl", "prondecl"},
cats = {{name = "pronoun inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"pronoun%-(.*)", "%1"},
{"pron%-(.*)", "%1"},
-- put this twice to catch pron-decl-* and decl-pron-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"pronoun", "*"},
{"pron", "*"},
{"prondecl%-base%-(.*)", " %1"},
{"prondecl%-base", " "},
{"prondecl%-(.*)", "%1"},
{"prondecl", "*"},
}}},
}},
{"article inflection-table", {
aliases = {"artinfl", "artdecl"},
cats = {{name = "article inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"article%-(.*)", "%1"},
{"art%-(.*)", "%1"},
-- put this twice to catch art-decl-* and decl-art-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"article", "*"},
{"art", "*"},
{"artdecl%-base%-(.*)", " %1"},
{"artdecl%-base", " "},
{"artdecl%-(.*)", "%1"},
{"artdecl", "*"},
}}},
}},
{"determiner inflection-table", {
aliases = {"detinfl", "detdecl"},
cats = {{name = "determiner inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"determiner%-(.*)", "%1"},
{"det%-(.*)", "%1"},
-- put this twice to catch det-decl-* and decl-det-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"determiner", "*"},
{"det", "*"},
{"detdecl%-base%-(.*)", " %1"},
{"detdecl%-base", " "},
{"detdecl%-(.*)", "%1"},
{"detdecl", "*"},
}}},
}},
{"preposition inflection-table", {
aliases = {"prepinfl", "prepdecl"},
cats = {{name = "preposition inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"preposition%-(.*)", "%1"},
{"prep%-(.*)", "%1"},
-- put this twice to catch prep-decl-* and decl-prep-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"preposition", "*"},
{"prep", "*"},
{"prepdecl%-base%-(.*)", " %1"},
{"prepdecl%-base", " "},
{"prepdecl%-(.*)", "%1"},
{"prepdecl", "*"},
{"prepinfl%-base%-(.*)", " %1"},
{"prepinfl%-base", " "},
{"prepinfl%-(.*)", "%1"},
{"prepinfl", "*"},
}}},
}},
{"postposition inflection-table", {
aliases = {"postpinfl", "postpdecl"},
cats = {{name = "postposition inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"postposition%-(.*)", "%1"},
{"postp%-(.*)", "%1"},
{"post%-(.*)", "%1"},
-- put this twice to catch postp-decl-* and decl-postp-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"postposition", "*"},
{"postp", "*"},
{"post", "*"},
{"postpdecl%-base%-(.*)", " %1"},
{"postpdecl%-base", " "},
{"postpdecl%-(.*)", "%1"},
{"postpdecl", "*"},
{"postpinfl%-base%-(.*)", " %1"},
{"postpinfl%-base", " "},
{"postpinfl%-(.*)", "%1"},
{"postpinfl", "*"},
}}},
}},
{"adjective inflection-table", {
aliases = {"adjinfl", "adjdecl", "adecl"},
cats = {{name = "adjective inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adj%-(.*)", "%1"},
{"adjective%-(.*)", "%1"},
-- put this twice to catch adj-decl-* and decl-adj-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adj", "*"},
{"adjective", "*"},
{"adecl%-base%-(.*)", " %1"},
{"adecl%-base", " "},
{"adecl%-(.*)", "%1"},
{"adecl", "*"},
}}},
}},
{"numeral inflection-table", {
aliases = {"numinfl", "numdecl"},
cats = {{name = "numeral inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"numeral%-(.*)", "%1"},
{"number%-(.*)", "%1"},
{"num%-(.*)", "%1"},
-- put this twice to catch num-decl-* and decl-num-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"numeral", "*"},
{"number", "*"},
{"num", "*"},
{"numdecl%-base%-(.*)", " %1"},
{"numdecl%-base", " "},
{"numdecl%-(.*)", "%1"},
{"numdecl", "*"},
}}},
}},
{"nominal inflection-table", {
aliases = {"nominfl", "nomdecl"},
cats = {{name = "nominal inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"nominal%-(.*)", "%1"},
{"nom%-(.*)", "%1"},
-- put this twice to catch nom-decl-* and decl-nom-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"nominal", "*"},
{"nom", "*"},
{"nomdecl%-base%-(.*)", " %1"},
{"nomdecl%-base", " "},
{"nomdecl%-(.*)", "%1"},
{"nomdecl", "*"},
}}},
}},
{"verb inflection-table", {
aliases = {"verbinfl", "conj"},
cats = {{name = "verb inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"verb%-(.*)", "%1"},
-- put this twice to catch verb-infl-* and infl-verb-*
{"infl%-(.*)", "%1"},
{"conj%-base%-(.*)", " %1"},
{"conj%-base", " "},
-- handle conj2, conj1-c, etc.
{"conj%-?(.*)", "%1"},
{"conj", "*"},
}}},
}},
{"adverb inflection-table", {
aliases = {"advinfl"},
cats = {{name = "adverb inflection-table", sort = {
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adverb%-(.*)", "%1"},
{"adv%-(.*)", "%1"},
-- put this twice to catch adv-decl-* and decl-adv-*
{"infl%-(.*)", "%1"},
{"decl%-(.*)", "%1"},
{"adverb", "*"},
{"adv", "*"},
{"advinfl%-base%-(.*)", " %1"},
{"advinfl%-base", " "},
{"advinfl%-(.*)", "%1"},
{"advinfl", "*"},
}}},
}},
-- Inflection-table subtemplates
{"inflection-table sub", {
aliases = {"inflsub"},
cats = {"label:inflection-table subtemplates"},
}},
-- Definition templates
-- Headword-line templates
{"headword-line", {
aliases = {"hw", "headword"},
cats = {"headword-line"},
}},
-- Definition templates
{"definition", {
aliases = {"def", "defn"},
cats = {"definition"},
}},
{"form-of", {
aliases = {"form of"},
cats = {"form-of"},
}},
-- Etymology and pronunciation templates
{"etymology", {
aliases = {"etym"},
cats = {"etymology"},
}},
{"morphology", {
aliases = {"morph"},
cats = {"etymology", "Category:Language-specific morphology templates"},
}},
{"pronunciation", {
aliases = {"pron"},
cats = {"pronunciation"},
}},
{"sign production", {
aliases = {"signprod"},
cats = {{name = "sign production", sort = {
{"prod (.*)", "%1"},
}}},
}},
-- Pseudo-namespace templates
{"reference", {
aliases = {"ref"},
cats = {{name = "reference", allow_etym = true}},
}},
{"quotation", {
aliases = {"quote"},
cats = {"quotation"},
}},
{"usage", {
cats = {"usage"},
}},
{"list", {
cats = {"list"},
}},
{"auto-table", {
aliases = {"table"},
cats = {"auto-table"},
}},
-- Navigation templates
-- Pro-form box templates
{"pro-form", {
aliases = {"pro-forms"},
cats = {"navigation", "Category:Pro-form box templates"},
}},
{"adposition", {
aliases = {"adpositions", "preposition", "prepositions", "postposition", "postpositions"},
cats = {"navigation", "Category:Adposition box templates"},
}},
{"affix", {
aliases = {"affixes", "prefix", "prefixes", "suffix", "suffixes"},
cats = {"navigation", "Category:Pro-form affix box templates"},
}},
{"article", {
aliases = {"articles"},
cats = {"navigation", "Category:Grammatical article box templates"},
}},
{"demonstrative", {
aliases = {"demonstratives"},
cats = {"navigation", "Category:Demonstrative box templates"},
}},
{"interrogative", {
aliases = {"interrogatives"},
cats = {"navigation", "Category:Interrogative box templates"},
}},
{"personal pronoun", {
aliases = {"perspron", "personal pronouns"},
cats = {"navigation", "Category:Personal pronoun box templates"},
}},
{"possessive", {
aliases = {"possessives"},
cats = {"navigation", "Category:Possessive pronoun and determiner box templates"},
}},
{"reflexive", {
aliases = {"reflexives"},
cats = {"navigation", "Category:Reflexive pronoun and determiner box templates"},
}},
{"relative", {
aliases = {"relatives"},
cats = {"navigation", "Category:Relative pronoun and determiner box templates"},
}},
{"navigation", {
-- miscellaneous navigation box templates like {{eu-aux verbs}}, {{pt-forms of address}}
aliases = {"nav"},
cats = {"navigation"},
}},
{"TOC", {
cats = {{name = "navigation", sort = {
{"categoryTOC", "TOC"},
}}, "Category:TOC templates"},
}},
{"number", {
aliases = {"numbers"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"cardinal", {
aliases = {"cardinals"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"ordinal", {
aliases = {"ordinals"},
cats = {"navigation", "Category:Language-specific number templates"},
}},
{"digit", {
aliases = {"digits"},
cats = {"list", "Category:Language-specific number templates"},
}},
-- Entry templates
{"entry", {
cats = {"entry"},
}},
-- Orthographic conversion templates (e.g. for converting between scripts)
{"orthographic conversion", {
aliases = {"transliteration", "translit", "xlit", "orthconv", "scriptconv"},
cats = {"conversion", "Category:Orthographic conversion templates"},
}},
-- Orthographic and regional variant templates (for displaying orthographic, script and/or regional variants)
{"orthographic variant", {
aliases = {"orthvar", "scriptvar"},
-- Currently we categorize orthographic and regional variants the same but we could split them if needed
cats = {"navigation", "Category:Orthographic and regional variant templates"},
}},
{"regional variant", {
aliases = {"regvar"},
cats = {"navigation", "Category:Orthographic and regional variant templates"},
}},
-- Internal link templates
{"link", {
cats = {"link", "Category:Language-specific internal link templates"},
}},
}
local category_type_to_category_map = {}
for _, category_type_to_category_spec in ipairs(category_type_to_category) do
local category_type, props = unpack(category_type_to_category_spec)
category_type_to_category_map[category_type] = props
if props.aliases then
for _, alias in ipairs(props.aliases) do
category_type_to_category_map[alias] = props
end
end
end
-- Split an argument on comma, but not comma followed by whitespace; split off sort base after a colon.
local function split_on_comma_and_split_off_sort_base(val)
local cattypes
if val:find(",") then
-- Don't optimize more than this because there can be commas backslashed, inside of links or followed by
-- whitespace that don't cause splitting.
cattypes = require(parse_interface_module).split_on_comma(val)
else
cattypes = {val}
end
for i, cattype_spec in ipairs(cattypes) do
if cattype_spec:find(":") then
local cattype, sort_base = cattype_spec:match("^(.-):(.*)$")
sort_base = sort_base:gsub("_", " ")
cattypes[i] = {name = cattype, sort_base = sort_base}
end
end
return cattypes
end
local function get_lang_or_script(code)
return code == "-" and code or
require("Module:languages").getByCode(code, nil, "allow etym") or
require("Module:languages").getByCode(code .. "-pro", nil, "allow etym") or
require("Module:scripts").getByCode(code)
end
local function obj_code(obj)
if obj == "-" then
return obj
end
return obj:getCode()
end
local function get_prefixed_obj(after_prefix)
return after_prefix:match("^(%a[%a-]*%a):(.+)$")
end
local function get_suffixed_obj(after_prefix)
local rest, objcode = after_prefix:match("^(.+)/(%a[%a-]*%a)$")
return objcode, rest
end
local pseudo_namespace_templates = {
{"R:", {
category_type = "reference",
get_obj_and_rest = get_prefixed_obj,
}},
{"RQ:", {
category_type = "quotation",
get_obj_and_rest = get_prefixed_obj,
}},
{"U:", {
category_type = "usage",
get_obj_and_rest = get_prefixed_obj,
}},
{"list:", {
category_type = "list",
get_obj_and_rest = get_suffixed_obj,
}},
{"table:", {
category_type = "auto-table",
get_obj_and_rest = get_suffixed_obj,
}},
}
local function infer_lang_or_script_code_and_category_type(name)
if name:find(":") then -- only check for pseudo-namespace prefix when a colon is present
for _, pseudo_namespace_spec in ipairs(pseudo_namespace_templates) do
local prefix, props = unpack(pseudo_namespace_spec)
local after_prefix = name:match("^" .. prefix .. "(.+)$")
if after_prefix then
local objcode, rest = props.get_obj_and_rest(after_prefix)
local obj
if objcode then
obj = get_lang_or_script(objcode) -- may return nil
if not obj then
rest = after_prefix
end
else
rest = after_prefix
end
return obj, rest, props.category_type
end
end
end
local hyphen_parts = split(name, "%-")
for i = #hyphen_parts - 1, 1, -1 do
local code = concat(hyphen_parts, "-", 1, i)
local obj = get_lang_or_script(code)
if obj then
local rest = concat(hyphen_parts, "-", i + 1)
return obj, rest, nil
end
end
return nil, name, nil
end
local function process_sortbase_specs(sortbase, specs)
for _, spec in ipairs(specs) do
local from, to = unpack(spec)
sortbase = ugsub(sortbase, "^" .. from .. "$", to)
end
return sortbase
end
local function template_name_minus_langcode_to_category_type(name)
for _, type_spec in ipairs(detect_category_type_list) do
local pattern, intended_type = unpack(type_spec)
if ufind(name, "^" .. pattern .. "$") then
return intended_type
end
end
return nil
end
local function compute_categories_for_template(full_template_name, template_name_minus_langcode, category_type,
langs_or_scripts)
local overriding_sort_base
if type(category_type) == "table" then
overriding_sort_base = category_type.sort_base
category_type = category_type.name
end
if not category_type_to_category_map[category_type] then
error("Unrecognized template category type: " .. category_type)
end
local props = category_type_to_category_map[category_type]
if not props.cats then
error("Internal error: No categories given for category type: " .. category_type)
end
local categories = {}
for _, catspec in ipairs(props.cats) do
if type(catspec) == "string" then
catspec = {name = catspec}
end
local rawcat = catspec.name:match("^Category:(.*)")
if rawcat then
local sortbase
-- User-specified sort base does not apply to raw categories, which have a different sort key format
-- than language-specific categories.
if not catspec.sort then
if langs_or_scripts then
local langnames = {}
for _, lang_or_sc in ipairs(langs_or_scripts) do
insert(langnames, lang_or_sc:getCanonicalName()) -- FIXME: or lang:getFullName()?
end
sortbase = concat(langnames, ",")
else
sortbase = full_template_name
end
elseif is_callable(catspec.sort) then
sortbase = catspec.sort(full_template_name, langs_or_scripts)
else
sortbase = process_sortbase_specs(full_template_name, catspec.sort)
end
insert(categories, {cat = rawcat, lang = und_lang, sort_base = sortbase})
elseif langs_or_scripts then
for _, lang_or_sc in ipairs(langs_or_scripts) do
local sortbase
if overriding_sort_base then
sortbase = overriding_sort_base
elseif not catspec.sort then
sortbase = template_name_minus_langcode
elseif is_callable(catspec.sort) then
sortbase = catspec.sort(template_name_minus_langcode, lang_or_sc)
else
sortbase = process_sortbase_specs(template_name_minus_langcode, catspec.sort)
end
if lang_or_sc:hasType("script") then
insert(categories, {
cat = ("%s templates"):format(lang_or_sc:getCategoryName()), lang = und_lang, sc = lang_or_sc,
sort_base = sortbase,
})
else
local cat
local full_label = catspec.name:match("^label:(.*)$")
local lang_name = catspec.allow_etym and lang_or_sc:getCanonicalName() or lang_or_sc:getFullName()
if full_label then
cat = ("%s %s"):format(lang_name, full_label)
else
cat = ("%s %s templates"):format(lang_name, catspec.name)
end
insert(categories, {
cat = cat, lang = lang_or_sc:getFull(), sort_base = sortbase,
})
end
end
end
end
if not categories[1] then
error(("No categories generated for template [[Template:%s]] with category type '%s'"):format(
full_template_name, category_type))
end
return categories
end
--[==[
Main entry point.
]==]
function export.categorize(frame)
local params = {
[1] = {}, -- comma-separated list of category types; by default, inferred from template name
lang = {}, -- comma-separated list of languages; by default, inferred from template name
["pagename"] = {}, -- for testing
["json"] = {type = "boolean"}, -- for testing
}
local parent_args = frame:getParent().args
args = require("Module:parameters").process(parent_args, params)
local category_specs = {}
local function insert_cat(cat, sort_key)
for _, existing_cat in ipairs(category_specs) do
if existing_cat.cat == cat then
return
end
end
insert(category_specs, {cat = cat, sort_key = sort_key})
end
local pagename = args.pagename
if not pagename then
title = mw.title.getCurrentTitle()
pagename = title.fullText
end
if pagename:find("/documentation$") or pagename:find("/documentation/") then
return ""
end
if pagename:find("^Template:User:") then
insert_cat("User sandbox templates", (pagename:gsub("^Template:User:", "")))
elseif pagename:find("^User:") then
insert_cat("User sandbox templates", (pagename:gsub("^User:", "")))
else
if not pagename:find("^Template:") then
error(("This template should only be used in the Template namespace, not on page '%s'"):format(pagename))
end
local full_template_name = pagename:gsub("^Template:", "")
local rootpage = full_template_name:gsub("/.*", "")
if full_template_name:find("/sandbox") then
insert_cat("Sandbox templates", full_template_name)
elseif full_template_name:find("^sandbox/") then
insert_cat("Sandbox templates", full_template_name:gsub("^sandbox/", ""))
else
local template_objs
if args.lang == "-" then
template_objs = false
elseif args.lang then
template_objs = {}
for _, code in ipairs(split(args.lang, ",")) do
-- We need to have an indicator of families because we allow bare family codes to stand for proto-languages.
if code:find("^fam:") then
code = code:gsub("^fam:", "")
local family = require("Module:families").getByCode(code) or
error(("Unrecognized family code '%s' in [[Module:template cat]]"):format(code))
local descendants = family:getDescendantCodes()
for _, desc in ipairs(descendants) do
local obj = get_lang_or_script(desc)
if obj then
-- make sure we skip families without proto-languages
insert(template_objs, obj)
end
end
else
local obj = get_lang_or_script(code)
if not obj then
error(("Unrecognized language or script code '%s'"):format(code))
end
insert(template_objs, obj)
end
end
end
local cattypes
if args[1] then
cattypes = split_on_comma_and_split_off_sort_base(args[1])
end
local inferred_obj, inferred_rest, inferred_cattype =
infer_lang_or_script_code_and_category_type(rootpage)
if template_objs == nil or not cattypes then
if template_objs == nil then
if not inferred_obj then
if not inferred_cattype then
error(("Unable to infer language or script from template root page '%s' for template '%s'; specify lang/script and type explicitly"):format(
rootpage, pagename))
else
error(("Unable to infer language or script from template root page '%s' for template '%s', inferred category type '%s'; specify lang/script explicitly"):format(
rootpage, pagename, inferred_cattype))
end
else
template_objs = {inferred_obj}
end
end
if not cattypes then
inferred_cattype = inferred_cattype or
template_name_minus_langcode_to_category_type(inferred_rest)
if not inferred_cattype then
error(("Unable to infer template category type from template remainder (after stripping langcode) '%s' for template '%s'; specify type explicitly"):format(
inferred_rest, pagename))
end
cattypes = {inferred_cattype}
end
end
for _, cattype in ipairs(cattypes) do
local cats = compute_categories_for_template(full_template_name, inferred_rest, cattype, template_objs)
for _, cat in ipairs(cats) do
insert(category_specs, cat)
end
end
end
end
-- We are returning categories for templates or user-space pages, so we need to force the output.
local retval = format_categories(category_specs, nil, nil, nil, "force_output")
if args.json then
return require("Module:JSON").toJSON {
category_specs = category_specs,
retval = mw.text.nowiki(retval),
}
else
return retval
end
end
--[==[Table used in the documentation to {{tl|template cat}}.]==]
function export.pattern_to_category_type_table()
local parts = {}
local function ins(text)
insert(parts, text)
end
ins('{|class="wikitable"')
ins("! Pattern !! Inferred category type")
for _, detect_spec in ipairs(detect_category_type_list) do
local pattern, category_type = unpack(detect_spec)
ins("|-")
ins(("| <code>%s</code> || <code>%s</code>"):format(pattern, category_type))
end
ins("|}")
return concat(parts, "\n")
end
--[==[Table used in the documentation to {{tl|template cat}}.]==]
function export.category_type_to_category_table()
local parts = {}
local function ins(text)
insert(parts, text)
end
local category_types = {}
local category_type_to_aliases = {}
for _, category_type_to_category_spec in ipairs(category_type_to_category) do
local category_type, props = unpack(category_type_to_category_spec)
insert(category_types, category_type)
category_type_to_aliases[category_type] = {}
if props.aliases then
for _, alias in ipairs(props.aliases) do
insert(category_type_to_aliases[category_type], alias)
end
table.sort(category_type_to_aliases[category_type])
end
end
table.sort(category_types)
local function get_category_type_categories(category_type)
local cats = {}
for _, catspec in ipairs(category_type_to_category_map[category_type].cats) do
if type(catspec) == "string" then
catspec = {name = catspec}
end
local cat = catspec.name
if cat:find("^Category:") then
insert(cats, ("<code>%s</code>"):format((cat:gsub("^Category:", ""))))
elseif cat:find("^label:") then
insert(cats, ("<code><var>LANG</var> %s</code>"):format((cat:gsub("^label:", ""))))
else
insert(cats, ("<code><var>LANG</var> %s templates</code>"):format(cat))
end
end
return concat(cats, ", ")
end
ins('{|class="wikitable"')
ins("! Category type !! Canonical category type !! Categories")
for _, category_type in ipairs(category_types) do
ins("|-")
ins(("| <code>'''%s'''</code> || ''(same)'' || <code>%s</code>"):format(
category_type, get_category_type_categories(category_type)))
for _, alias in ipairs(category_type_to_aliases[category_type]) do
ins("|-")
ins(("| <code>%s</code> || <code>'''%s'''</code> || <code>%s</code>"):format(
alias, category_type, get_category_type_categories(category_type)))
end
end
ins("|}")
return concat(parts, "\n")
end
return export
33dgd2grqionii83906l7r69sspy2t1
Teamplaid:cite-meta
10
17885
88762
2026-04-18T01:03:19Z
en>沈澄心
0
+HDL
88762
wikitext
text/x-wiki
<includeonly>{{#if:{{{author|}}}{{{last|}}}
| {{#if:{{{authorlink|}}}
| [[w:{{{authorlink}}}|{{#if:{{{author|}}}
| {{{author}}}
| {{#if:{{{last|}}}
| {{{last}}}{{#if:{{{first|}}}|, {{{first}}}}}
}}
}}]]
| {{#if:{{{author|}}}
| {{{author}}}
| {{#if:{{{last|}}}
| {{{last}}}{{#if:{{{first|}}}|, {{{first}}}}}
}}
}}
}}{{#if:{{{author2|}}}{{{last2|}}}
| {{#if:{{{authorlink2|}}}
|;<!--semicolon--> [[w:{{{authorlink2}}}|{{#if:{{{author2|}}}
| {{{author2}}}
| {{#if:{{{last2|}}}
| {{{last2}}}{{#if:{{{first2|}}}|, {{{first2}}}}}
}}
}}]]
|; {{#if:{{{author2|}}}
| {{{author2}}}
| {{#if:{{{last2|}}}
| {{{last2}}}{{#if:{{{first2|}}}|, {{{first2}}}}}
}}
}}
}}
}}{{#if:{{{author3|}}}{{{last3|}}}
| {{#if:{{{authorlink3|}}}
|;<!--semicolon--> [[w:{{{authorlink3}}}|{{#if:{{{author3|}}}
| {{{author3}}}
| {{#if:{{{last3|}}}
| {{{last3}}}{{#if:{{{first3|}}}|, {{{first3}}}}}
}}
}}]]
|; {{#if:{{{author3|}}}
| {{{author3}}}
| {{#if:{{{last3|}}}
| {{{last3}}}{{#if:{{{first3|}}}|, {{{first3}}}}}
}}
}}
}}
}}{{#if:{{{author4|}}}{{{last4|}}}
| {{#if:{{{authorlink4|}}}
|;<!--semicolon--> [[w:{{{authorlink4}}}|{{#if:{{{author4|}}}
| {{{author4}}}
| {{#if:{{{last4|}}}
| {{{last4}}}{{#if:{{{first4|}}}|, {{{first4}}}}}
}}
}}]]
|; {{#if:{{{author4|}}}
| {{{author4}}}
| {{#if:{{{last4|}}}
| {{{last4}}}{{#if:{{{first4|}}}|, {{{first4}}}}}
}}
}}
}}
}}{{#if:{{{author5|}}}{{{last5|}}}
| {{#if:{{{authorlink5|}}}
|;<!--semicolon--> [[w:{{{authorlink5}}}|{{#if:{{{author5|}}}
| {{{author5}}}
| {{#if:{{{last5|}}}
| {{{last5}}}{{#if:{{{first5|}}}|, {{{first5}}}}}
}}
}}]]
|; {{#if:{{{author5|}}}
| {{{author5}}}
| {{#if:{{{last5|}}}
| {{{last5}}}{{#if:{{{first5|}}}|, {{{first5}}}}}
}}
}}
}}
}}{{#if:{{{coauthors|}}}
| ; {{{coauthors}}} 
|  
}}
| {{#if:{{{translator|}}}<!--If editor and/or translator stated without author, display them here.-->
| {{{translator|}}}, transl.{{#if:{{{editor|}}}{{{editors|}}}|; |,}}
}}{{#if:{{{mainauthor|}}}{{{mainauthors|}}}
| {{{mainauthor|{{{mainauthors|}}}}}}, 
}}{{#if:{{{editor|}}}
| {{{editor}}}, editor 
| {{#if:{{{editors|}}}
| {{{editors}}}, editors 
}}
}}
}}{{#if:{{{author|}}}{{{last|}}}{{{editor|}}}{{{editors|}}}{{{translator|}}}<!--Only display quotee and date here if these parameters present. Otherwise, display date after publisher's name.-->
| {{#if:{{{quotee|}}}
|, quoting {{{quotee|}}} 
}}{{#if:{{{nodate|}}}|<!--Do nothing-->|({{#if:{{{year|}}}
| {{#if:{{{month|}}}
| {{{month}}} {{{year}}}
| {{#switch:{{padleft:|2|{{{year}}}}}
| a. = ''[[Appendix:Glossary#a.|a.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| c. = ''[[Appendix:Glossary#c.|c.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| p. = ''[[Appendix:Glossary#p.|p.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| {{{year}}}
}}
}}
| {{#if:{{{date|}}}
| {{#formatdate:{{{date}}}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}
| {{#if:{{{archivedate|}}}
|<!--Do nothing-->
|{{#if:{{{archivedate|}}}
|<!--Do nothing-->
|accessed {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}<!--Use accessdate as a backstop if year or date not specified.-->
}}
}}
| <!-- using und is a hack but avoids the need to pass a lang to all cite-* templates -->{{rfdate|und<noinclude>|nocat=true</noinclude>}}
}}
}}
}})
}}}}{{#if:{{{author|}}}{{{last|}}}{{{editor|}}}{{{editors|}}}{{{translator|}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}{{{date|}}}{{{year|}}}
| {{#if:{{{chapter|}}}{{{entry|}}}
|, <!--Add a comma before chapter or entry if author or editor specified together with date or year. Otherwise, do nothing. (If chapter or entry, and date or year, are specified but author or editor not specified, date or year is relocated after the publisher's name.)-->
}}
}}
}}{{#if:{{{entry|}}}
| {{#invoke:italics|unitalicize_brackets|{{#if:{{{entryurl|}}}
| “[{{{entryurl}}} {{{entry}}}]
| {{#if:{{{url|}}}
| “[{{{url}}} {{{entry}}}]
| “{{{entry}}}
}}
}}}}{{#if:{{{trans-chapter|}}}
| [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter}}}}}]”
|”
}}{{#if:{{{notitle|}}}||, in }}
| {{#if:{{{chapter|}}}
| {{#if:{{num|{{{chapter}}}}}<!--Arabic chapter number?-->
| chapter {{#if:{{{chapterurl|}}}
| [{{{chapterurl}}} {{{chapter}}}]
| {{{chapter}}}
}}
| {{#if:{{R2A|{{{chapter}}}|no_error=1}}<!--Roman chapter number?-->
| chapter {{#if:{{{chapterurl|}}}
| [{{{chapterurl}}} {{uc:{{{chapter}}}}}]
| {{uc:{{{chapter}}}}}
}}
| “{{#invoke:italics|unitalicize_brackets|{{#if:{{{chapterurl|}}}<!--Must be a chapter name-->
| [{{{chapterurl}}} {{{chapter}}}]
| {{{chapter}}}
}}}}{{#if:{{{trans-chapter|}}}
| [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter}}}}}]
}}”
}}
}}{{#if:{{{notitle|}}}||, in }}
}}
}}{{#if:{{{author|}}}{{{last|}}}<!--Only display editor here if author also provided. If author not provided, do nothing – editor is displayed before date.-->
| {{#if:{{{translator|}}}
|, {{{translator|}}}, transl.{{#if:{{{editor|}}}{{{editors|}}}|;|,}} 
}}{{#if:{{{mainauthor|}}}{{{mainauthors|}}}
| {{{mainauthor|{{{mainauthors|}}}}}}, 
}}{{#if:{{{editor|}}}{{{editors|}}}
| {{#if:{{{chapter|}}}{{{entry|}}}{{{translator|}}}|<!--Do nothing.-->|, }}{{#if:{{{editor|}}}
| {{{editor}}}, editor, 
| {{#if:{{{editors|}}}
| {{{editors}}}, editors, 
}}
}}
}}
}}{{#if:{{{chapter|}}}{{{entry|}}}|<!--Do nothing.-->| <!--If these parameters are not used, add a space.-->}}{{#if:{{{title|}}}
|<cite>{{#invoke:italics|unitalicize_brackets|{{{title}}}}}</cite>
| {{#if:{{{notitle|}}}
|<!--Do nothing.-->
| {{maintenance line|please provide the title of the work}}
}}
}}{{#if:{{{trans-title|}}}
|  [<cite>{{#invoke:italics|unitalicize_brackets|{{{trans-title}}}}}</cite>]
}}{{#if:{{{type|}}}
|  ({{{type|}}})
}}{{#if:{{{series|}}}
|  ({{{series}}}{{#if:{{{seriesvolume|}}}|; {{{seriesvolume}}}}})
}}{{#if:{{{url|}}}{{{archiveurl|}}}
| {{#if:{{{entry|}}}
| {{#if:{{{entryurl|}}}<!--If {{{entryurl}} exists, then {{{url}} was not linked to {{{entry}}} and should be displayed here-->
| {{#if:{{{archiveurl}}}
| ‎<!--Left-to-right mark to manage right-to-left languages--><sup>[{{{archiveurl}}}]</sup>
| ‎<sup>[{{{url}}}]</sup>
}}
}}
| {{#if:{{{archiveurl|}}}<!--If {{{entry}}} doesn't exist but {{{url}}} is specified, display it-->
| ‎<!--Left-to-right mark to manage right-to-left languages--><sup>[{{{archiveurl}}}]</sup>
| ‎<sup>[{{{url}}}]</sup>
}}
}}
}}{{#if:{{{format|}}}{{{genre|}}}
| {{#if:{{{lang|}}}{{{worklang|}}}
|  ({{#if:{{{format|}}}
| {{{format}}}
| {{#if:{{{genre|}}}
| {{{genre}}}
}}
}}, in {{#invoke:languages/templates|getCanonicalName|{{{lang|{{{worklang|}}}}}}|return_if_invalid=1}})
|  ({{#if:{{{format|}}}
| {{{format}}}
| {{#if:{{{genre|}}}
| {{{genre}}}
}}
}})
}}
| {{#if:{{{lang|}}}{{{worklang|}}}
|  (in {{#invoke:languages/templates|getCanonicalName|{{{lang|{{{worklang|}}}}}}|return_if_invalid=1}})
}}
}}{{#if:{{{version|}}}
|, {{{version}}}
}}{{#if:{{{volume|}}}
|, volume {{{volume}}}
}}{{#if:{{{issue|}}}
|, issue {{{issue}}}
}}{{#if:{{{others|}}}
|, {{{others}}}
}}{{#if:{{{edition|}}}
|, {{{edition}}} edition
}}{{#if:{{{publisher|}}}
| {{#if:{{{location|}}}
|, {{{location}}}:<!--colon-->
|,
}} {{{publisher}}}
| {{#if:{{{location|}}}
|, {{{location}}}
}}
}}{{#if:{{{author|}}}{{{last|}}}
|<!--Do nothing if present.-->
| {{#if:{{{editor|}}}{{{editors|}}}{{{translator|}}}
|<!--Do nothing if present.-->
| {{#if:{{{nodate|}}}|<!--Do nothing-->|, {{#if:{{{year|}}}<!--If author, editor and translator all absent, display date here.-->
| {{#if:{{{month|}}}
| {{{month}}} {{{year}}}
| {{{year}}}
}}
| {{#if:{{{date|}}}
| {{#formatdate:{{{date}}}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}
| accessed {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}<!--Use accessdate as a backstop if year or date not specified.-->
| {{maintenance line|please provide a date or year}}
}}
}}
}}}}
}}
}}{{#if:{{{year_published|}}}
|, published {{{year_published}}}
}}{{#if:{{{bibcode|}}}
|, <small>[https://ui.adsabs.harvard.edu/abs/{{urlencode:{{{bibcode}}}}} →Bibcode]</small>
}}{{#if:{{{doi|}}}
|, <small>{{#if:{{{doi_brokendate|}}}
| {{#tag:nowiki|{{{doi}}}}} (inactive [[{{{doi_brokendate}}}]]){{#ifeq:{{NAMESPACE}}|{{ns:0}}|[[Category:Pages with DOIs broken since {{#time:Y|{{{doi_brokendate}}} }}]]}}
| <span class="neverexpand">[https://doi.org/{{urlencode:{{{doi}}}}} →DOI]</span>
}}</small>
}}{{#if:{{{isbn|}}}
|, <small>{{ISBN|{{{isbn}}}}}</small>
}}{{#if:{{{issn|}}}
|, <small>{{ISSN|{{{issn}}}}}</small>
}}{{#if:{{{jstor|}}}
|, <small>[https://www.jstor.org/stable/{{urlencode:{{{jstor}}}}} →JSTOR]</small>
}}{{#if:{{{lccn|}}}
|, <small>[https://lccn.loc.gov/{{urlencode:{{{lccn}}}}} →LCCN]</small>
}}{{#if:{{{oclc|}}}
|, <small>[https://search.worldcat.org/title/{{urlencode:{{{oclc}}}}} →OCLC]</small>
}}{{#if:{{{pmid|}}}
|, <small>[https://www.ncbi.nlm.nih.gov/pubmed/{{urlencode:{{{pmid}}}}} →PMID]</small>
}}{{#if:{{{ol|}}}
|, <small>[https://openlibrary.org/works/OL{{urlencode:{{{ol}}}}}/ →OL]</small>
}}{{#if:{{{ssrn|}}}
|, <small>[https://ssrn.com/abstract={{urlencode:{{{ssrn}}}}} →SSRN]</small>
}}{{#if:{{{hdl|}}}
|, <small>[https://hdl.handle.net/{{urlencode:{{{hdl}}}}} →HDL]</small>
}}{{#if:{{{id|}}}
|, <small>{{{id}}}</small>
}}{{#if:{{{archiveurl|}}}
|, archived from [{{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
| {{#invoke:string/templates|sub|{{{archiveurl}}}|44|}}
| {{{url}}}
}} the original] on {{#formatdate:{{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
| {{#invoke:string/templates|sub|{{{archiveurl}}}|29|32}}-{{#invoke:string/templates|sub|{{{archiveurl}}}|33|34}}-{{#invoke:string/templates|sub|{{{archiveurl}}}|35|36}}
| {{{archivedate}}}
}}}}
}}{{#if:{{{accessdate|{{{access-date|}}}}}}
| {{#if:{{{date|}}}{{{year|}}}<!--Only display accessdate if either date or year is specified, as accessdate is already used earlier in place of these parameters if they are missing.-->
|{{#if:{{{archivedate|}}}
|<!--Do nothing-->
|, retrieved {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}
}}
}}
}}{{#if:{{{section|}}}
|, {{#if:{{{sectionurl|}}}
| [{{{sectionurl}}} {{{section}}}]
| {{{section}}}
}}
}}{{#if:{{{line|}}}
|, line {{{line}}}
| {{#if:{{{lines|}}}
|, lines {{{lines}}}
}}
}}{{#if:{{{pages|}}}
| {{#if:{{{page|}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} page {{{page}}}]
| page {{{page}}}
}} of {{{pages}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} pages {{{pages}}}]
| pages {{{pages}}}
}}
}}
| {{#if:{{{page|}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} page {{{page}}}]
| page {{{page}}}
}}
}}
}}{{#if:{{{column|}}}{{{columns|}}}
|, {{#if:{{{columnurl|}}}
| [{{{columnurl}}} {{#if:{{{columns|}}}
| columns {{{columns}}}
| column {{{column}}}
}}]
| {{#if:{{{columns|}}}
| columns {{{columns}}}
| column {{{column}}}
}}
}}
}}{{#if:{{{newversion|}}}{{{location2|}}}{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}<!--Test for new version of work.-->
|; {{#if:{{{newversion|}}}
| {{{newversion}}}
| {{#if:{{{edition2|}}}
|<!--Do nothing-->
| {{#if:{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}
| republished as
| republished
}}
}}
}} 
}}{{#if:{{{2ndauthor|}}}{{{2ndlast|}}}
| {{#if:{{{2ndauthorlink|}}}
|  [[w:{{{2ndauthorlink}}}|{{#if:{{{2ndauthor|}}}
| {{{2ndauthor}}}, 
| {{#if:{{{2ndlast|}}}
| {{{2ndlast}}}{{#if:{{{2ndfirst|}}}|, {{{2ndfirst}}}}}, 
}}
}}]]
| {{#if:{{{2ndauthor|}}}
|  {{{2ndauthor}}}, 
| {{#if:{{{2ndlast|}}}
|  {{{2ndlast}}}{{#if:{{{2ndfirst|}}}|, {{{2ndfirst}}}}}, 
}}
}}
}}
}}{{#if:{{{translator2|}}}
| ; {{{translator2|}}}, transl., 
}}{{#if:{{{chapter2|}}}{{{entry2|}}}
| {{#if:{{{entry2|}}}
| {{#invoke:italics|unitalicize_brackets|{{#if:{{{entryurl2|}}}
| “[{{{entryurl2}}} {{{entry2}}}]
| “{{{entry2}}}
}}}}{{#if:{{{trans-chapter2|}}}
|  [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter2}}}}}]”
| ”
}}{{#if:{{{notitle2|}}}||, in }}
| {{#if:{{{chapter2|}}}
| {{#if:{{num|{{{chapter2}}}}}<!--Arabic chapter number?-->
|  chapter {{#if:{{{chapterurl2|}}}
| [{{{chapterurl2}}} {{{chapter2}}}]
| {{{chapter2}}}
}}
| {{#if:{{R2A|{{{chapter2}}}|no_error=1}}<!--Roman chapter number?-->
|  chapter {{#if:{{{chapterurl2|}}}
| [{{{chapterurl2}}} {{uc:{{{chapter2}}}}}]
| {{uc:{{{chapter2}}}}}
}}
|  “{{#invoke:italics|unitalicize_brackets|{{#if:{{{chapterurl2|}}}<!--Must be a chapter name-->
| [{{{chapterurl2}}} {{{chapter2}}}]
| {{{chapter2}}}
}}}}{{#if:{{{trans-chapter2|}}}
|  [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter2}}}}}]
}}”
}}
}}{{#if:{{{notitle2|}}}||, in }}
}}
}}
}}{{#if:{{{mainauthor2|}}}
| {{{mainauthor2}}}{{#if:{{{editor2|}}}{{{editors2|}}}|; |,}}
}}{{#if:{{{editor2|}}}{{{editors2|}}}
| {{#if:{{{editor2|}}}
| {{{editor2}}}, editor,
| {{#if:{{{editors2|}}}
| {{{editors2}}}, editors,
}}
}}
}}{{#if:{{{title2|}}}
|  <cite>{{#invoke:italics|unitalicize_brackets|{{{title2}}}}}</cite>
}}{{#if:{{{trans-title2|}}}
|  [<cite>{{#invoke:italics|unitalicize_brackets|{{{trans-title2}}}}}</cite>]
}}{{#if:{{{type2|}}}
|  ({{{type2}}})
}}{{#if:{{{series2|}}}
|  ({{{series2}}}{{#if:{{{seriesvolume2|}}}|; {{{seriesvolume2}}}}})
}}{{#if:{{{url2|}}}
| {{#if:{{{archiveurl2|}}}
| ‎<sup>[{{{archiveurl2}}}]</sup>
| ‎<sup>[{{{url2}}}]</sup>
}}
}}{{#if:{{{format2|}}}{{{genre2|}}}
| {{#if:{{{lang2|}}}{{{worklang2|}}}
|  ({{#if:{{{format2|}}}
| {{{format2}}}
| {{#if:{{{genre2|}}}
| {{{genre2}}}
}}
}}, in {{#invoke:languages/templates|getCanonicalName|{{{lang2|{{{worklang2|}}}}}}|return_if_invalid=1}})
|  ({{#if:{{{format2|}}}
| {{{format2}}}
| {{#if:{{{genre2|}}}
| {{{genre2}}}
}}
}})
}}
| {{#if:{{{lang2|}}}{{{worklang2|}}}
|  (in {{#invoke:languages/templates|getCanonicalName|{{{lang2|{{{worklang2|}}}}}}|return_if_invalid=1}})
}}
}}{{#if:{{{version2|}}}
|, {{{version2}}}
}}{{#if:{{{volume2|}}}
|, volume {{{volume2}}}
| {{#if:{{{volume_plain2|}}}
|, {{{volume_plain2}}}
}}
}}{{#if:{{{issue2|}}}
|, number {{{issue2}}}
}}{{#if:{{{edition2|}}}
| {{#if:{{{title2|}}}|, }}{{{edition2}}} edition
}}{{#if:{{{others2|}}}
|, {{{others2}}}
}}{{#if:{{{publisher2|}}}
| {{#if:{{{location2|}}}
| {{#if:{{{edition2|}}}{{{title2|}}}|, }}{{{location2}}}:
|,
}} {{{publisher2}}}
| {{#if:{{{location2|}}}
| {{#if:{{{edition2|}}}{{{title2|}}}|, }}{{{location2}}}
}}
}}{{#if:{{{newversion|}}}{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}{{{location2|}}}<!--Test for new version of work-->
| {{#if:{{{date2|}}}
|, {{{date2}}}
| {{#if:{{{year2|}}}
|, {{{year2}}}
|, {{maintenance line|please provide a date or year}}
}}
}}
}}{{#if:{{{bibcode2|}}}
|, <small>[https://ui.adsabs.harvard.edu/abs/{{urlencode:{{{bibcode2}}}}} →Bibcode]</small>
}}{{#if:{{{doi2|}}}
|, <small>{{#if:{{{doi_brokendate2|}}}
| {{#tag:nowiki|{{{doi2}}}}} (inactive [[{{{doi_brokendate2}}}]]){{#ifeq:{{NAMESPACE}}|{{ns:0}}|[[Category:Pages with DOIs broken since {{#time:Y|{{{doi_brokendate2}}}}}]]}}
| <span class="neverexpand">[https://doi.org/{{urlencode:{{{doi2}}}}} →DOI]</span>
}}</small>
}}{{#if:{{{isbn2|}}}
|, <small>{{ISBN|{{{isbn2}}}}}</small>
}}{{#if:{{{issn2|}}}
|, <small>{{ISSN|{{{issn2}}}}}</small>
}}{{#if:{{{jstor2|}}}
|, <small>[https://www.jstor.org/stable/{{urlencode:{{{jstor2}}}}} →JSTOR]</small>
}}{{#if:{{{lccn2|}}}
|, <small>[https://lccn.loc.gov/{{urlencode:{{{lccn2}}}}} →LCCN]</small>
}}{{#if:{{{oclc2|}}}
|, <small>[https://worldcat.org/oclc/{{urlencode:{{{oclc2}}}}} →OCLC]</small>
}}{{#if:{{{ol2|}}}
|, <small>[https://openlibrary.org/works/OL{{urlencode:{{{ol2}}}}}/ →OL]</small>
}}{{#if:{{{pmid2|}}}
|, <small>[https://www.ncbi.nlm.nih.gov/pubmed/{{urlencode:{{{pmid2}}}}} →PMID]</small>
}}{{#if:{{{ssrn2|}}}
|, <small>[https://ssrn.com/abstract={{urlencode:{{{ssrn2}}}}} →SSRN]</small>
}}{{#if:{{{id2|}}}
|, <small>{{{id2}}}</small>
}}{{#if:{{{archiveurl2|}}}
|, archived from [{{{url2}}} the original] on {{#if:{{{archivedate2|}}}
| {{#formatdate:{{{archivedate2}}}}}
| {{maintenance line|please provide the date}}
}}
}}{{#if:{{{accessdate2|}}}
|{{#if:{{{archivedate2|}}}
|<!--Do nothing-->
|, retrieved {{#formatdate:{{{accessdate2|}}}}}
}}
}}{{#if:{{{section2|}}}
| {{#if:{{{sectionurl2|}}}
|, [{{{sectionurl2}}} {{{section2}}}]
|, {{{section2}}}
}}
}}{{#if:{{{line2|}}}
|, line {{{line2}}}
| {{#if:{{{lines2|}}}
|, lines {{{lines2}}}
}}
}}{{#if:{{{pages2|}}}
| {{#if:{{{page2|}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} page {{{page2}}}]
| page {{{page2}}}
}} of {{{pages2}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} pages {{{pages2}}}]
| pages {{{pages2}}}
}}
}}
| {{#if:{{{page2|}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} page {{{page2}}}]
| page {{{page2}}}
}}
}}
}}{{#if:{{{column2|}}}{{{columns2|}}}
|, {{#if:{{{columnurl2|}}}
| [{{{columnurl2}}} {{#if:{{{columns2|}}}
| columns {{{columns2}}}
| column {{{column2}}}
}}]
| {{#if:{{{columns2|}}}
| columns {{{columns2}}}
| column {{{column2}}}
}}
}}
}}{{#if:{{{passage_block|}}}
| {{#ifeq:{{{passage_block|}}}|no
| {{#if:{{{passage|}}}
|: “{{{passage}}}{{#if:{{{translation|}}}
| [{{{translation}}}]
}}”{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}
}}
|:<dl><dd>{{{passage_block}}}{{#if:{{{translation|}}}
|<dl><dd>{{{translation}}}</dd></dl>
}}{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}</dd></dl>
}}
| {{#if:{{{passage|}}}
| {{#ifexpr:{{#invoke:string/templates|len_visible|{{{passage}}}}}>300
|:<dl><dd>{{{passage}}}{{#if:{{{translation|}}}
|<dl><dd>{{{translation}}}</dd></dl>
}}{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}</dd></dl>
|: “{{{passage}}}{{#if:{{{translation|}}}
| [{{{translation}}}]
}}”{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}
}}
}}
}}{{#if:{{{archiveurl|}}}
| {{#if:{{{archivedate|}}}
|<!--Do nothing-->
| {{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
|<!--Do nothing-->
| [[Category:Quotations using archiveurl without archivedate]]
}}
}}
}}{{#if:{{{usenodot|}}}|{{#if:{{{nodot|}}}||.}}}}</includeonly><noinclude>{{documentation}}</noinclude>
5855p6umj6nuixgo6ieebznll3kwlua
88763
88762
2026-08-03T20:56:41Z
Altronic
4137
Chaidh 1 mhùthadh ion-phortachadh o [[:en:Template:cite-meta]]
88762
wikitext
text/x-wiki
<includeonly>{{#if:{{{author|}}}{{{last|}}}
| {{#if:{{{authorlink|}}}
| [[w:{{{authorlink}}}|{{#if:{{{author|}}}
| {{{author}}}
| {{#if:{{{last|}}}
| {{{last}}}{{#if:{{{first|}}}|, {{{first}}}}}
}}
}}]]
| {{#if:{{{author|}}}
| {{{author}}}
| {{#if:{{{last|}}}
| {{{last}}}{{#if:{{{first|}}}|, {{{first}}}}}
}}
}}
}}{{#if:{{{author2|}}}{{{last2|}}}
| {{#if:{{{authorlink2|}}}
|;<!--semicolon--> [[w:{{{authorlink2}}}|{{#if:{{{author2|}}}
| {{{author2}}}
| {{#if:{{{last2|}}}
| {{{last2}}}{{#if:{{{first2|}}}|, {{{first2}}}}}
}}
}}]]
|; {{#if:{{{author2|}}}
| {{{author2}}}
| {{#if:{{{last2|}}}
| {{{last2}}}{{#if:{{{first2|}}}|, {{{first2}}}}}
}}
}}
}}
}}{{#if:{{{author3|}}}{{{last3|}}}
| {{#if:{{{authorlink3|}}}
|;<!--semicolon--> [[w:{{{authorlink3}}}|{{#if:{{{author3|}}}
| {{{author3}}}
| {{#if:{{{last3|}}}
| {{{last3}}}{{#if:{{{first3|}}}|, {{{first3}}}}}
}}
}}]]
|; {{#if:{{{author3|}}}
| {{{author3}}}
| {{#if:{{{last3|}}}
| {{{last3}}}{{#if:{{{first3|}}}|, {{{first3}}}}}
}}
}}
}}
}}{{#if:{{{author4|}}}{{{last4|}}}
| {{#if:{{{authorlink4|}}}
|;<!--semicolon--> [[w:{{{authorlink4}}}|{{#if:{{{author4|}}}
| {{{author4}}}
| {{#if:{{{last4|}}}
| {{{last4}}}{{#if:{{{first4|}}}|, {{{first4}}}}}
}}
}}]]
|; {{#if:{{{author4|}}}
| {{{author4}}}
| {{#if:{{{last4|}}}
| {{{last4}}}{{#if:{{{first4|}}}|, {{{first4}}}}}
}}
}}
}}
}}{{#if:{{{author5|}}}{{{last5|}}}
| {{#if:{{{authorlink5|}}}
|;<!--semicolon--> [[w:{{{authorlink5}}}|{{#if:{{{author5|}}}
| {{{author5}}}
| {{#if:{{{last5|}}}
| {{{last5}}}{{#if:{{{first5|}}}|, {{{first5}}}}}
}}
}}]]
|; {{#if:{{{author5|}}}
| {{{author5}}}
| {{#if:{{{last5|}}}
| {{{last5}}}{{#if:{{{first5|}}}|, {{{first5}}}}}
}}
}}
}}
}}{{#if:{{{coauthors|}}}
| ; {{{coauthors}}} 
|  
}}
| {{#if:{{{translator|}}}<!--If editor and/or translator stated without author, display them here.-->
| {{{translator|}}}, transl.{{#if:{{{editor|}}}{{{editors|}}}|; |,}}
}}{{#if:{{{mainauthor|}}}{{{mainauthors|}}}
| {{{mainauthor|{{{mainauthors|}}}}}}, 
}}{{#if:{{{editor|}}}
| {{{editor}}}, editor 
| {{#if:{{{editors|}}}
| {{{editors}}}, editors 
}}
}}
}}{{#if:{{{author|}}}{{{last|}}}{{{editor|}}}{{{editors|}}}{{{translator|}}}<!--Only display quotee and date here if these parameters present. Otherwise, display date after publisher's name.-->
| {{#if:{{{quotee|}}}
|, quoting {{{quotee|}}} 
}}{{#if:{{{nodate|}}}|<!--Do nothing-->|({{#if:{{{year|}}}
| {{#if:{{{month|}}}
| {{{month}}} {{{year}}}
| {{#switch:{{padleft:|2|{{{year}}}}}
| a. = ''[[Appendix:Glossary#a.|a.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| c. = ''[[Appendix:Glossary#c.|c.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| p. = ''[[Appendix:Glossary#p.|p.]]'' {{#invoke:string/templates|sub|{{{year}}}|4}}
| {{{year}}}
}}
}}
| {{#if:{{{date|}}}
| {{#formatdate:{{{date}}}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}
| {{#if:{{{archivedate|}}}
|<!--Do nothing-->
|{{#if:{{{archivedate|}}}
|<!--Do nothing-->
|accessed {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}<!--Use accessdate as a backstop if year or date not specified.-->
}}
}}
| <!-- using und is a hack but avoids the need to pass a lang to all cite-* templates -->{{rfdate|und<noinclude>|nocat=true</noinclude>}}
}}
}}
}})
}}}}{{#if:{{{author|}}}{{{last|}}}{{{editor|}}}{{{editors|}}}{{{translator|}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}{{{date|}}}{{{year|}}}
| {{#if:{{{chapter|}}}{{{entry|}}}
|, <!--Add a comma before chapter or entry if author or editor specified together with date or year. Otherwise, do nothing. (If chapter or entry, and date or year, are specified but author or editor not specified, date or year is relocated after the publisher's name.)-->
}}
}}
}}{{#if:{{{entry|}}}
| {{#invoke:italics|unitalicize_brackets|{{#if:{{{entryurl|}}}
| “[{{{entryurl}}} {{{entry}}}]
| {{#if:{{{url|}}}
| “[{{{url}}} {{{entry}}}]
| “{{{entry}}}
}}
}}}}{{#if:{{{trans-chapter|}}}
| [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter}}}}}]”
|”
}}{{#if:{{{notitle|}}}||, in }}
| {{#if:{{{chapter|}}}
| {{#if:{{num|{{{chapter}}}}}<!--Arabic chapter number?-->
| chapter {{#if:{{{chapterurl|}}}
| [{{{chapterurl}}} {{{chapter}}}]
| {{{chapter}}}
}}
| {{#if:{{R2A|{{{chapter}}}|no_error=1}}<!--Roman chapter number?-->
| chapter {{#if:{{{chapterurl|}}}
| [{{{chapterurl}}} {{uc:{{{chapter}}}}}]
| {{uc:{{{chapter}}}}}
}}
| “{{#invoke:italics|unitalicize_brackets|{{#if:{{{chapterurl|}}}<!--Must be a chapter name-->
| [{{{chapterurl}}} {{{chapter}}}]
| {{{chapter}}}
}}}}{{#if:{{{trans-chapter|}}}
| [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter}}}}}]
}}”
}}
}}{{#if:{{{notitle|}}}||, in }}
}}
}}{{#if:{{{author|}}}{{{last|}}}<!--Only display editor here if author also provided. If author not provided, do nothing – editor is displayed before date.-->
| {{#if:{{{translator|}}}
|, {{{translator|}}}, transl.{{#if:{{{editor|}}}{{{editors|}}}|;|,}} 
}}{{#if:{{{mainauthor|}}}{{{mainauthors|}}}
| {{{mainauthor|{{{mainauthors|}}}}}}, 
}}{{#if:{{{editor|}}}{{{editors|}}}
| {{#if:{{{chapter|}}}{{{entry|}}}{{{translator|}}}|<!--Do nothing.-->|, }}{{#if:{{{editor|}}}
| {{{editor}}}, editor, 
| {{#if:{{{editors|}}}
| {{{editors}}}, editors, 
}}
}}
}}
}}{{#if:{{{chapter|}}}{{{entry|}}}|<!--Do nothing.-->| <!--If these parameters are not used, add a space.-->}}{{#if:{{{title|}}}
|<cite>{{#invoke:italics|unitalicize_brackets|{{{title}}}}}</cite>
| {{#if:{{{notitle|}}}
|<!--Do nothing.-->
| {{maintenance line|please provide the title of the work}}
}}
}}{{#if:{{{trans-title|}}}
|  [<cite>{{#invoke:italics|unitalicize_brackets|{{{trans-title}}}}}</cite>]
}}{{#if:{{{type|}}}
|  ({{{type|}}})
}}{{#if:{{{series|}}}
|  ({{{series}}}{{#if:{{{seriesvolume|}}}|; {{{seriesvolume}}}}})
}}{{#if:{{{url|}}}{{{archiveurl|}}}
| {{#if:{{{entry|}}}
| {{#if:{{{entryurl|}}}<!--If {{{entryurl}} exists, then {{{url}} was not linked to {{{entry}}} and should be displayed here-->
| {{#if:{{{archiveurl}}}
| ‎<!--Left-to-right mark to manage right-to-left languages--><sup>[{{{archiveurl}}}]</sup>
| ‎<sup>[{{{url}}}]</sup>
}}
}}
| {{#if:{{{archiveurl|}}}<!--If {{{entry}}} doesn't exist but {{{url}}} is specified, display it-->
| ‎<!--Left-to-right mark to manage right-to-left languages--><sup>[{{{archiveurl}}}]</sup>
| ‎<sup>[{{{url}}}]</sup>
}}
}}
}}{{#if:{{{format|}}}{{{genre|}}}
| {{#if:{{{lang|}}}{{{worklang|}}}
|  ({{#if:{{{format|}}}
| {{{format}}}
| {{#if:{{{genre|}}}
| {{{genre}}}
}}
}}, in {{#invoke:languages/templates|getCanonicalName|{{{lang|{{{worklang|}}}}}}|return_if_invalid=1}})
|  ({{#if:{{{format|}}}
| {{{format}}}
| {{#if:{{{genre|}}}
| {{{genre}}}
}}
}})
}}
| {{#if:{{{lang|}}}{{{worklang|}}}
|  (in {{#invoke:languages/templates|getCanonicalName|{{{lang|{{{worklang|}}}}}}|return_if_invalid=1}})
}}
}}{{#if:{{{version|}}}
|, {{{version}}}
}}{{#if:{{{volume|}}}
|, volume {{{volume}}}
}}{{#if:{{{issue|}}}
|, issue {{{issue}}}
}}{{#if:{{{others|}}}
|, {{{others}}}
}}{{#if:{{{edition|}}}
|, {{{edition}}} edition
}}{{#if:{{{publisher|}}}
| {{#if:{{{location|}}}
|, {{{location}}}:<!--colon-->
|,
}} {{{publisher}}}
| {{#if:{{{location|}}}
|, {{{location}}}
}}
}}{{#if:{{{author|}}}{{{last|}}}
|<!--Do nothing if present.-->
| {{#if:{{{editor|}}}{{{editors|}}}{{{translator|}}}
|<!--Do nothing if present.-->
| {{#if:{{{nodate|}}}|<!--Do nothing-->|, {{#if:{{{year|}}}<!--If author, editor and translator all absent, display date here.-->
| {{#if:{{{month|}}}
| {{{month}}} {{{year}}}
| {{{year}}}
}}
| {{#if:{{{date|}}}
| {{#formatdate:{{{date}}}}}
| {{#if:{{{accessdate|{{{access-date|}}}}}}
| accessed {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}<!--Use accessdate as a backstop if year or date not specified.-->
| {{maintenance line|please provide a date or year}}
}}
}}
}}}}
}}
}}{{#if:{{{year_published|}}}
|, published {{{year_published}}}
}}{{#if:{{{bibcode|}}}
|, <small>[https://ui.adsabs.harvard.edu/abs/{{urlencode:{{{bibcode}}}}} →Bibcode]</small>
}}{{#if:{{{doi|}}}
|, <small>{{#if:{{{doi_brokendate|}}}
| {{#tag:nowiki|{{{doi}}}}} (inactive [[{{{doi_brokendate}}}]]){{#ifeq:{{NAMESPACE}}|{{ns:0}}|[[Category:Pages with DOIs broken since {{#time:Y|{{{doi_brokendate}}} }}]]}}
| <span class="neverexpand">[https://doi.org/{{urlencode:{{{doi}}}}} →DOI]</span>
}}</small>
}}{{#if:{{{isbn|}}}
|, <small>{{ISBN|{{{isbn}}}}}</small>
}}{{#if:{{{issn|}}}
|, <small>{{ISSN|{{{issn}}}}}</small>
}}{{#if:{{{jstor|}}}
|, <small>[https://www.jstor.org/stable/{{urlencode:{{{jstor}}}}} →JSTOR]</small>
}}{{#if:{{{lccn|}}}
|, <small>[https://lccn.loc.gov/{{urlencode:{{{lccn}}}}} →LCCN]</small>
}}{{#if:{{{oclc|}}}
|, <small>[https://search.worldcat.org/title/{{urlencode:{{{oclc}}}}} →OCLC]</small>
}}{{#if:{{{pmid|}}}
|, <small>[https://www.ncbi.nlm.nih.gov/pubmed/{{urlencode:{{{pmid}}}}} →PMID]</small>
}}{{#if:{{{ol|}}}
|, <small>[https://openlibrary.org/works/OL{{urlencode:{{{ol}}}}}/ →OL]</small>
}}{{#if:{{{ssrn|}}}
|, <small>[https://ssrn.com/abstract={{urlencode:{{{ssrn}}}}} →SSRN]</small>
}}{{#if:{{{hdl|}}}
|, <small>[https://hdl.handle.net/{{urlencode:{{{hdl}}}}} →HDL]</small>
}}{{#if:{{{id|}}}
|, <small>{{{id}}}</small>
}}{{#if:{{{archiveurl|}}}
|, archived from [{{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
| {{#invoke:string/templates|sub|{{{archiveurl}}}|44|}}
| {{{url}}}
}} the original] on {{#formatdate:{{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
| {{#invoke:string/templates|sub|{{{archiveurl}}}|29|32}}-{{#invoke:string/templates|sub|{{{archiveurl}}}|33|34}}-{{#invoke:string/templates|sub|{{{archiveurl}}}|35|36}}
| {{{archivedate}}}
}}}}
}}{{#if:{{{accessdate|{{{access-date|}}}}}}
| {{#if:{{{date|}}}{{{year|}}}<!--Only display accessdate if either date or year is specified, as accessdate is already used earlier in place of these parameters if they are missing.-->
|{{#if:{{{archivedate|}}}
|<!--Do nothing-->
|, retrieved {{#formatdate:{{{accessdate|{{{access-date}}}}}}}}
}}
}}
}}{{#if:{{{section|}}}
|, {{#if:{{{sectionurl|}}}
| [{{{sectionurl}}} {{{section}}}]
| {{{section}}}
}}
}}{{#if:{{{line|}}}
|, line {{{line}}}
| {{#if:{{{lines|}}}
|, lines {{{lines}}}
}}
}}{{#if:{{{pages|}}}
| {{#if:{{{page|}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} page {{{page}}}]
| page {{{page}}}
}} of {{{pages}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} pages {{{pages}}}]
| pages {{{pages}}}
}}
}}
| {{#if:{{{page|}}}
|, {{#if:{{{pageurl|}}}
| [{{{pageurl}}} page {{{page}}}]
| page {{{page}}}
}}
}}
}}{{#if:{{{column|}}}{{{columns|}}}
|, {{#if:{{{columnurl|}}}
| [{{{columnurl}}} {{#if:{{{columns|}}}
| columns {{{columns}}}
| column {{{column}}}
}}]
| {{#if:{{{columns|}}}
| columns {{{columns}}}
| column {{{column}}}
}}
}}
}}{{#if:{{{newversion|}}}{{{location2|}}}{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}<!--Test for new version of work.-->
|; {{#if:{{{newversion|}}}
| {{{newversion}}}
| {{#if:{{{edition2|}}}
|<!--Do nothing-->
| {{#if:{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}
| republished as
| republished
}}
}}
}} 
}}{{#if:{{{2ndauthor|}}}{{{2ndlast|}}}
| {{#if:{{{2ndauthorlink|}}}
|  [[w:{{{2ndauthorlink}}}|{{#if:{{{2ndauthor|}}}
| {{{2ndauthor}}}, 
| {{#if:{{{2ndlast|}}}
| {{{2ndlast}}}{{#if:{{{2ndfirst|}}}|, {{{2ndfirst}}}}}, 
}}
}}]]
| {{#if:{{{2ndauthor|}}}
|  {{{2ndauthor}}}, 
| {{#if:{{{2ndlast|}}}
|  {{{2ndlast}}}{{#if:{{{2ndfirst|}}}|, {{{2ndfirst}}}}}, 
}}
}}
}}
}}{{#if:{{{translator2|}}}
| ; {{{translator2|}}}, transl., 
}}{{#if:{{{chapter2|}}}{{{entry2|}}}
| {{#if:{{{entry2|}}}
| {{#invoke:italics|unitalicize_brackets|{{#if:{{{entryurl2|}}}
| “[{{{entryurl2}}} {{{entry2}}}]
| “{{{entry2}}}
}}}}{{#if:{{{trans-chapter2|}}}
|  [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter2}}}}}]”
| ”
}}{{#if:{{{notitle2|}}}||, in }}
| {{#if:{{{chapter2|}}}
| {{#if:{{num|{{{chapter2}}}}}<!--Arabic chapter number?-->
|  chapter {{#if:{{{chapterurl2|}}}
| [{{{chapterurl2}}} {{{chapter2}}}]
| {{{chapter2}}}
}}
| {{#if:{{R2A|{{{chapter2}}}|no_error=1}}<!--Roman chapter number?-->
|  chapter {{#if:{{{chapterurl2|}}}
| [{{{chapterurl2}}} {{uc:{{{chapter2}}}}}]
| {{uc:{{{chapter2}}}}}
}}
|  “{{#invoke:italics|unitalicize_brackets|{{#if:{{{chapterurl2|}}}<!--Must be a chapter name-->
| [{{{chapterurl2}}} {{{chapter2}}}]
| {{{chapter2}}}
}}}}{{#if:{{{trans-chapter2|}}}
|  [{{#invoke:italics|unitalicize_brackets|{{{trans-chapter2}}}}}]
}}”
}}
}}{{#if:{{{notitle2|}}}||, in }}
}}
}}
}}{{#if:{{{mainauthor2|}}}
| {{{mainauthor2}}}{{#if:{{{editor2|}}}{{{editors2|}}}|; |,}}
}}{{#if:{{{editor2|}}}{{{editors2|}}}
| {{#if:{{{editor2|}}}
| {{{editor2}}}, editor,
| {{#if:{{{editors2|}}}
| {{{editors2}}}, editors,
}}
}}
}}{{#if:{{{title2|}}}
|  <cite>{{#invoke:italics|unitalicize_brackets|{{{title2}}}}}</cite>
}}{{#if:{{{trans-title2|}}}
|  [<cite>{{#invoke:italics|unitalicize_brackets|{{{trans-title2}}}}}</cite>]
}}{{#if:{{{type2|}}}
|  ({{{type2}}})
}}{{#if:{{{series2|}}}
|  ({{{series2}}}{{#if:{{{seriesvolume2|}}}|; {{{seriesvolume2}}}}})
}}{{#if:{{{url2|}}}
| {{#if:{{{archiveurl2|}}}
| ‎<sup>[{{{archiveurl2}}}]</sup>
| ‎<sup>[{{{url2}}}]</sup>
}}
}}{{#if:{{{format2|}}}{{{genre2|}}}
| {{#if:{{{lang2|}}}{{{worklang2|}}}
|  ({{#if:{{{format2|}}}
| {{{format2}}}
| {{#if:{{{genre2|}}}
| {{{genre2}}}
}}
}}, in {{#invoke:languages/templates|getCanonicalName|{{{lang2|{{{worklang2|}}}}}}|return_if_invalid=1}})
|  ({{#if:{{{format2|}}}
| {{{format2}}}
| {{#if:{{{genre2|}}}
| {{{genre2}}}
}}
}})
}}
| {{#if:{{{lang2|}}}{{{worklang2|}}}
|  (in {{#invoke:languages/templates|getCanonicalName|{{{lang2|{{{worklang2|}}}}}}|return_if_invalid=1}})
}}
}}{{#if:{{{version2|}}}
|, {{{version2}}}
}}{{#if:{{{volume2|}}}
|, volume {{{volume2}}}
| {{#if:{{{volume_plain2|}}}
|, {{{volume_plain2}}}
}}
}}{{#if:{{{issue2|}}}
|, number {{{issue2}}}
}}{{#if:{{{edition2|}}}
| {{#if:{{{title2|}}}|, }}{{{edition2}}} edition
}}{{#if:{{{others2|}}}
|, {{{others2}}}
}}{{#if:{{{publisher2|}}}
| {{#if:{{{location2|}}}
| {{#if:{{{edition2|}}}{{{title2|}}}|, }}{{{location2}}}:
|,
}} {{{publisher2}}}
| {{#if:{{{location2|}}}
| {{#if:{{{edition2|}}}{{{title2|}}}|, }}{{{location2}}}
}}
}}{{#if:{{{newversion|}}}{{{2ndauthor|}}}{{{2ndlast|}}}{{{translator2|}}}{{{editor2|}}}{{{title2|}}}{{{location2|}}}<!--Test for new version of work-->
| {{#if:{{{date2|}}}
|, {{{date2}}}
| {{#if:{{{year2|}}}
|, {{{year2}}}
|, {{maintenance line|please provide a date or year}}
}}
}}
}}{{#if:{{{bibcode2|}}}
|, <small>[https://ui.adsabs.harvard.edu/abs/{{urlencode:{{{bibcode2}}}}} →Bibcode]</small>
}}{{#if:{{{doi2|}}}
|, <small>{{#if:{{{doi_brokendate2|}}}
| {{#tag:nowiki|{{{doi2}}}}} (inactive [[{{{doi_brokendate2}}}]]){{#ifeq:{{NAMESPACE}}|{{ns:0}}|[[Category:Pages with DOIs broken since {{#time:Y|{{{doi_brokendate2}}}}}]]}}
| <span class="neverexpand">[https://doi.org/{{urlencode:{{{doi2}}}}} →DOI]</span>
}}</small>
}}{{#if:{{{isbn2|}}}
|, <small>{{ISBN|{{{isbn2}}}}}</small>
}}{{#if:{{{issn2|}}}
|, <small>{{ISSN|{{{issn2}}}}}</small>
}}{{#if:{{{jstor2|}}}
|, <small>[https://www.jstor.org/stable/{{urlencode:{{{jstor2}}}}} →JSTOR]</small>
}}{{#if:{{{lccn2|}}}
|, <small>[https://lccn.loc.gov/{{urlencode:{{{lccn2}}}}} →LCCN]</small>
}}{{#if:{{{oclc2|}}}
|, <small>[https://worldcat.org/oclc/{{urlencode:{{{oclc2}}}}} →OCLC]</small>
}}{{#if:{{{ol2|}}}
|, <small>[https://openlibrary.org/works/OL{{urlencode:{{{ol2}}}}}/ →OL]</small>
}}{{#if:{{{pmid2|}}}
|, <small>[https://www.ncbi.nlm.nih.gov/pubmed/{{urlencode:{{{pmid2}}}}} →PMID]</small>
}}{{#if:{{{ssrn2|}}}
|, <small>[https://ssrn.com/abstract={{urlencode:{{{ssrn2}}}}} →SSRN]</small>
}}{{#if:{{{id2|}}}
|, <small>{{{id2}}}</small>
}}{{#if:{{{archiveurl2|}}}
|, archived from [{{{url2}}} the original] on {{#if:{{{archivedate2|}}}
| {{#formatdate:{{{archivedate2}}}}}
| {{maintenance line|please provide the date}}
}}
}}{{#if:{{{accessdate2|}}}
|{{#if:{{{archivedate2|}}}
|<!--Do nothing-->
|, retrieved {{#formatdate:{{{accessdate2|}}}}}
}}
}}{{#if:{{{section2|}}}
| {{#if:{{{sectionurl2|}}}
|, [{{{sectionurl2}}} {{{section2}}}]
|, {{{section2}}}
}}
}}{{#if:{{{line2|}}}
|, line {{{line2}}}
| {{#if:{{{lines2|}}}
|, lines {{{lines2}}}
}}
}}{{#if:{{{pages2|}}}
| {{#if:{{{page2|}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} page {{{page2}}}]
| page {{{page2}}}
}} of {{{pages2}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} pages {{{pages2}}}]
| pages {{{pages2}}}
}}
}}
| {{#if:{{{page2|}}}
|, {{#if:{{{pageurl2|}}}
| [{{{pageurl2}}} page {{{page2}}}]
| page {{{page2}}}
}}
}}
}}{{#if:{{{column2|}}}{{{columns2|}}}
|, {{#if:{{{columnurl2|}}}
| [{{{columnurl2}}} {{#if:{{{columns2|}}}
| columns {{{columns2}}}
| column {{{column2}}}
}}]
| {{#if:{{{columns2|}}}
| columns {{{columns2}}}
| column {{{column2}}}
}}
}}
}}{{#if:{{{passage_block|}}}
| {{#ifeq:{{{passage_block|}}}|no
| {{#if:{{{passage|}}}
|: “{{{passage}}}{{#if:{{{translation|}}}
| [{{{translation}}}]
}}”{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}
}}
|:<dl><dd>{{{passage_block}}}{{#if:{{{translation|}}}
|<dl><dd>{{{translation}}}</dd></dl>
}}{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}</dd></dl>
}}
| {{#if:{{{passage|}}}
| {{#ifexpr:{{#invoke:string/templates|len_visible|{{{passage}}}}}>300
|:<dl><dd>{{{passage}}}{{#if:{{{translation|}}}
|<dl><dd>{{{translation}}}</dd></dl>
}}{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}</dd></dl>
|: “{{{passage}}}{{#if:{{{translation|}}}
| [{{{translation}}}]
}}”{{#if:{{{footer|}}}
|<dl><dd>{{{footer}}}</dd></dl>
}}
}}
}}
}}{{#if:{{{archiveurl|}}}
| {{#if:{{{archivedate|}}}
|<!--Do nothing-->
| {{#ifeq:{{#invoke:string/templates|sub|{{{archiveurl}}}|9|23}}|web.archive.org
|<!--Do nothing-->
| [[Category:Quotations using archiveurl without archivedate]]
}}
}}
}}{{#if:{{{usenodot|}}}|{{#if:{{{nodot|}}}||.}}}}</includeonly><noinclude>{{documentation}}</noinclude>
5855p6umj6nuixgo6ieebznll3kwlua