Module:For: Difference between revisions
- Afrikaans
- Ænglisc
- Аԥсшәа
- العربية
- Asturianu
- Azərbaycanca
- تۆرکجه
- Basa Bali
- বাংলা
- Banjar
- 閩南語 / Bân-lâm-gí
- भोजपुरी
- Bikol Central
- Bosanski
- Català
- Cebuano
- Corsu
- الدارجة
- Español
- فارسی
- Gaeilge
- ગુજરાતી
- गोंयची कोंकणी / Gõychi Konknni
- 客家語 / Hak-kâ-ngî
- हिन्दी
- Ilokano
- Bahasa Indonesia
- Íslenska
- Jawa
- ಕನ್ನಡ
- Kernowek
- Kurdî
- Ladin
- Madhurâ
- Македонски
- മലയാളം
- Bahasa Melayu
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- नेपाली
- 日本語
- ଓଡ଼ିଆ
- Oʻzbekcha / ўзбекча
- ਪੰਜਾਬੀ
- پښتو
- Português
- Qaraqalpaqsha
- سرائیکی
- Scots
- සිංහල
- Simple English
- Slovenščina
- کوردی
- Srpskohrvatski / српскохрватски
- Tagalog
- တႆး
- తెలుగు
- ไทย
- ತುಳು
- Türkçe
- Türkmençe
- اردو
- Tiếng Việt
- 文言
- Yorùbá
- 粵語
- 中文
Appearance
From Wikipedia, the free encyclopedia
Fixed bad handling of nil in "unusual parameters" check
don't add talk pages and pages in the user namespace to Category:Hatnote templates with errors – this is similar to Module:Other uses of and Module:Hatnote
Line 25:
Line 25:
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
for k, v in two(ipairs(args)) do table.insert(pages, v) end
for k, v in two(ipairs(args)) do table.insert(pages, v) end
local title = mw.title.getCurrentTitle()
local skipCat = title.isTalkPage or title.namespace == 2 --don't categorise talk pages and userspace
⚫
(追記) local oddCat = skipCat and '' or (追記ここまで)'[[Category:Hatnote templates using unusual parameters]]'
local category = yesNo(args.category)
local category = yesNo(args.category)
return mHatnote._hatnote(
return mHatnote._hatnote(
Line 31:
Line 34:
) .. (
) .. (
(use == 'other uses') and ((category == true) or (category == nil)) and
(use == 'other uses') and ((category == true) or (category == nil)) and
oddCat or ''
⚫
(削除) (削除ここまで)'[[Category:Hatnote templates using unusual parameters]](削除) ' or ' (削除ここまで)'
)
)
end
end
Latest revision as of 22:29, 2 November 2020
Not to be confused with Module:For loop.
Warning This Lua module is used on approximately 204,000 pages .
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Page template-protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
This module depends on the following other modules:
Implements {{for }}.
The above documentation is transcluded from Module:For/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
localmArguments--initialize lazily localmHatlist=require('Module:Hatnote list') localmHatnote=require('Module:Hatnote') localyesNo=require('Module:Yesno') localp={} --Implements {{For}} from the frame --uses capitalized "For" to avoid collision with Lua reserved word "for" functionp.For(frame) mArguments=require('Module:Arguments') returnp._For(mArguments.getArgs(frame)) end --Implements {{For}} but takes a manual arguments table functionp._For(args) localuse=args[1] if(notuse)then returnmHatnote.makeWikitextError( 'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.', 'Template:For#Errors', args.category ) end localpages={} functiontwo(a,b)returna,b,1end--lets us run ipairs from 2 fork,vintwo(ipairs(args))dotable.insert(pages,v)end localtitle=mw.title.getCurrentTitle() localskipCat=title.isTalkPageortitle.namespace==2--don't categorise talk pages and userspace localoddCat=skipCatand''or'[[Category:Hatnote templates using unusual parameters]]' localcategory=yesNo(args.category) returnmHatnote._hatnote( mHatlist.forSeeTableToString({{use=use,pages=pages}}), {selfref=args.selfref} )..( (use=='other uses')and((category==true)or(category==nil))and oddCator'' ) end returnp