Module:wikipedia
An plantilyang ini nagpapahiling nin mga tugang na proyekto na nakalink sa sarong pahina sa Wikipedya.
Dapat an plantilyang ini inilalaag sa seksyon na tinutukoy kaniu pagkatapos kan header. Bilang default, (nakasusog ini sa sarong artikulo sa Bikol Sentral Wikipedya) ikaag ini sa ibaba kan ==Bikol Sentral==
header. Kun igwa pa nin imahe o ibang plantilya, dapat ining maenot.
Pwede man gamiton an mga plantilya na: {{projectlink|pedia}}
(shortcut: {{pedia}}
).
Parametro
Gabos na parametro opsyonal.
lang=
- Hinahagad an koda kan lenggwahe (hilingon an Wiktionary:Wikimedia language codes) kan bersyon kan Wikipedya kun sain ini isususog.
1=
- Hinahagad an pahina kan Wikipedia kun sain ini konektado. Bilang default, ini pareho kan ngaran sa yaun na pahina sa Wiksyunaryo.
2=
- Pig-ooverride an pinapahiling na porma kan link
dab=
odisambiguation=
- Hinahagad an pagkakaribong kan pahina sa link
cat=
ocategory=
- Hinahagad an kategorya kan pahina sa link
portal=
- Hinahagad an portal kan pahina sa link
mul=
- Nagtatao nin panduwang artikulo kun sain isusugpon
mullabel=
- Pig-ooverride an pinapahiling na porma kan panduwang link
mulcat=
- Hinahagad an panduwang kategorya kan link
mulcatlabel=
Mga Ehemplo
Mga simpleng porma:
{{wikipedia}}
{{wikipedia|article}}
{{wikipedia|article|link title}}
{{wikipedia|lang=language code}}
{{wikipedia|article|lang=language code}}
{{wikipedia|article|link title|lang=language code}}
{{wikipedia|dab=disambiguation page}}
{{wikipedia|dab=disambiguation page|link title}}
{{wikipedia|article|link title|mul=second article}}
{{wikipedia|article|link title|mul=second article|mullabel=second link title}}
{{wikipedia|cat=category}}
{{wikipedia|cat=category|link title}}
{{wikipedia|cat=category|link title|mulcat=second category}}
{{wikipedia|cat=category|link title|mulcat=second category|mulcatlabel=second link title}}
{{wikipedia|portal=energy}}
{{wikipedia|Domingo}}
|
|
{{wikipedia|Trunk (botany)|trunk}}
|
|
{{wikipedia|Lunes|lang=it}}
|
|
{{wikipedia|category=mga kulay}}
|
|
{{wikipedia|category=mga kulay|mulcat=pambanasang kulay}}
|
|
{{wikipedia|lang=es|category=colores
|mga kulay|mulcat=pintura|mulcatlabel=mga pinta}}
|
|
{{wikipedia|portal=enerhiya}}
|
Related templates
{{slim-wikipedia}}
— slimmer version of this template{{w}}
— plain inline text link to Wikipedia{{projectlink}}
— for linking to other affiliated projects{{pedia}}
— for "External links", "See also" and "References" sections{{quote-wikipedia}}
- for "Citations" pages{{warn notwikipedia}}
TemplateData
Links Wikipedia in a box that floats to the right
Parameter | Description | Type | Status | |
---|---|---|---|---|
Article to link | 1 | Article to link to on the Wikipedia
| Line | suggested |
Link label | 2 | If provided, overrides the displayed form of the link
| Line | optional |
Disambiguation page to link | dab disambiguation | Disambiguation page to link on Wikipedia, instead of linking to an article
| Line | optional |
Category to link | cat category | Category to link on Wikipedia, instead of an article
| Line | optional |
Portal to link | portal | Portal to link on Wikipedia, instead of an article
| Line | optional |
Language code | lang | Wikipedia language code for the Wikipedia language to link
| Line | optional |
2nd article to link | mul | Provides a second article to link to
| Line | optional |
2nd article label | mullabel | Overrides the displayed form of the second link.
| Line | optional |
2nd category to link | mulcat | Second category to link on Wikipedia, replacing the second article link | Line | optional |
2nd category label | mulcatlabel | If provided, overrides the displayed form of the second category | Line | optional |
local export = {}
local function process_links(linkdata, prefix, name, wmlang, sc)
prefix = prefix .. ":" .. (wmlang:getCode() == "bcl" and "" or wmlang:getCode() .. ":")
local links = {}
local iplinks = {}
local m_links = require("Module:links")
local lang = wmlang:getWiktionaryLanguage()
local ipalt = name .. " " .. (wmlang:getCode() == "bcl" and "" or "" .. wmlang:getCode() .. "</sup>")
for i, link in ipairs(linkdata) do
link.lang = lang
link.sc = sc
link.term = prefix .. link.term
link.tr = "-"
table.insert(iplinks, "<span class=\"interProject\">[[" .. link.term .. "|" .. ipalt .. "]]</span>")
table.insert(links, m_links.full_link(link, "bold"))
end
return links, iplinks
end
function export.wikipedia_box(frame)
local params = {
[1] = {},
[2] = {},
["cat"] = {},
["category"] = {alias_of = "cat"},
["dab"] = {},
["disambiguation"] = {alias_of = "dab"},
["i"] = {type = "boolean"},
["lang"] = {default = "bcl"},
["mul"] = {},
["mullabel"] = {},
["mulcat"] = {},
["mulcatlabel"] = {},
["portal"] = {},
["sc"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local wmlang = require("Module:wikimedia languages").getByCodeWithFallback(args["lang"]) or error("The Wikimedia language code \"" .. args["lang"] .. "\" is not valid.")
local sc = args["sc"] and (require("Module:scripts").getByCode(args["sc"]) or error("The script code \"" .. sc .. "\" is not valid.")) or nil
local linkdata = {}
if args["cat"] then
table.insert(linkdata, {term = "Category:" .. args["cat"], alt = args[1] or args["cat"]})
elseif args["portal"] then
table.insert(linkdata, {term = "Portal:" .. args["portal"], alt = args[1] or args["portal"]})
else
table.insert(linkdata, {term = args["dab"] or args[1] or mw.title.getCurrentTitle().text, alt = args[2] or args[1] or args["dab"] or mw.title.getCurrentTitle().text})
end
if args["mul"] or args["mulcat"] then
if args["mulcat"] then
table.insert(linkdata, {term = "Category:" .. args["mulcat"], alt = args["mulcatlabel"] or args["mulcat"]})
else
table.insert(linkdata, {term = args["mul"], alt = args["mullabel"] or args["mul"]})
end
end
local links, iplinks = process_links(linkdata, "w", "", wmlang, sc)
if frame.args["slim"] then
return
"<div class=\"sister-wikipedia sister-project noprint floatright\" style=\"border: solid #aaa 1px; font-size: 90%; background: #f9f9f9; width: 250px; padding: 4px; text-align: left;\">" ..
"<div style=\"float: left;\">[[File:Wikipedia-logo-v2.svg|14px|none| ]]</div>" ..
"<div style=\"margin-left: 15px;\">" ..
" " ..
table.concat(links, " and ") ..
" on " ..
(wmlang:getCode() == "bcl" and "en" or wmlang:getCanonicalName() .. " ") ..
"Hilingon" ..
"</div>" ..
"</div>"
else
local linktype
if args["cat"] then
linktype = "kategorya"
elseif args["mul"] or args["dab"] then
linktype = "mga artikulo"
elseif args["mulcat"] then
linktype = "mga kategorya"
elseif args["portal"] then
linktype = "portal"
else
linktype = "artikulo"
end
return
"<div class=\"sister-wikipedia sister-project noprint floatright\" style=\"border: 1px solid #aaa; font-size: 90%; background: #f9f9f9; width: 250px; padding: 4px; text-align: left;\">" ..
"<div style=\"float: left;\">[[File:Wikipedia-logo-v2.svg|44px|none|link=|alt=]]</div>" ..
"<div style=\"margin-left: 60px;\">" ..
wmlang:getCanonicalName() .. " Wikipedya igwa nin " .. linktype .. " sa:" ..
"<div style=\"margin-left: 10px;\">" .. table.concat(links, " asin ") .. "</div>" ..
"</div>" ..
table.concat(iplinks) .. ((args[1] == mw.title.getCurrentTitle().text and not (args[2] or args["dab"])) and "[[Category:wikipedia with redundant first parameter]]" or "") ..
"</div>"
end
end
function export.projectlink(frame)
local params = {
[1] = {},
[2] = {},
["dab"] = {},
["i"] = {type = "boolean"},
["lang"] = {default = "bcl"},
["nodot"] = {},
["sc"] = {},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local wmlang = require("Module:wikimedia languages").getByCodeWithFallback(args["lang"]) or error("The Wikimedia language code \"" .. args["lang"] .. "\" is not valid.")
local sc = args["sc"] and (require("Module:scripts").getByCode(args["sc"]) or error("The script code \"" .. sc .. "\" is not valid.")) or nil
local linkdata = {term = args[1] or args["dab"] or mw.title.getCurrentTitle().text, alt = args[2] or args[1] or args["dab"] or mw.title.getCurrentTitle().text}
if args["i"] then
linkdata.alt = "''" .. linkdata.alt .. "''"
end
local links, iplinks = process_links({linkdata}, frame.args["prefix"], frame.args["name"], wmlang, sc)
return
"[[Image:" .. frame.args["image"] .. "|15px|link=" .. linkdata.term .. "]] " ..
table.concat(links, " and ") ..
" on " ..
(wmlang:getCode() == "" and "" or "the " .. wmlang:getCanonicalName() .. " ") ..
" " .. frame.args["name"] .. (args["nodot"] and "" or ".") ..
table.concat(iplinks)
end
return export