Modul:Homokozó/Pepo41/ExternalLinks
Homokozó/Pepo41/ExternalLinks[mi ez?] • [dokumentáció: mutat, ] • [tesztek: létrehozás]
local z = {}
function IMDB(frame, path, text)
return"[http://hungarian.imdb.com/" .. path .. " " .. text .. "] az [[Internet Movie Database]]-ben"
end
-- Az {{IMDb név}} sablon használja.
function z.IMDBname(frame)
local pframe = frame:getParent()
local args = pframe.args -- azok a paraméterek, amelyeket a lapon, a sablonban megadott a felhasználó
local config = frame.args -- az #invoke utasítással átadott paraméterek, pl itt pagename
local ID = args.id or args.ID or args[1] or ""
local Name = args["név"] or args[2] or config.pagename -- Should have "or mw.page.title.name" instead, but that isn't available yet.
return IMDB(frame, "name/nm" .. ID, Name .. "(angolul)")
end
-- Az {{IMDB díj}} sablon használja.
function z.IMDBaward(frame)
local pframe = frame:getParent()
local args = pframe.args -- azok a paraméterek, amelyeket a lapon, a sablonban megadott a felhasználó
local config = frame.args -- az #invoke utasítással átadott paraméterek, pl itt pagename
local ID = args.id or args.ID or args[1] or ""
local Name = args["név"] or config.pagename
local Title = args["cím"] or config.pagename
if args["név"] then
return IMDB(frame, "name/nm" .. ID .."/awards", Name .." díjai (angolul)")
elseif args["cím"] then
return IMDB(frame, "title/tt" .. ID.."/awards", Title .." díjai (angolul)")
else
error("A nevet, vagy címet meg kell adnod");
end
end
-- Az {{IMDb cím}} sablon használja.
--Paraméterek:
-- @id – a film azonosítószáma az IMDb-n (az oldal URL-jéből olvasható ki,
-- pl. http://imdb.com/title/tt0110912/ esetén az id 0110912)
-- @cím – a film címe, alapértelmezésben azonos a szócikk nevével
--@leírás (opcionális) – a cím után jelenik meg, pl. itt adható meg az évszám,
-- ha több azonos nevű film is van
-- A paraméterek ebben a sorrendben névtelenül is megadhatóak.
function z.IMDBtitle(frame)
local pframe = frame:getParent()
local args = pframe.args -- azok a paraméterek, amelyeket a lapon, a sablonban megadott a felhasználó
local config = frame.args-- az #invoke utasítással átadott paraméterek, pl itt pagename
local ID = args.id or args.ID or args[1]
--local section = args.section
local Title = args["cím"] or args[2] or config.pagename -- Should have "or mw.page.title.name" instead, but that isn't available yet.
local Description = args["leírás"]
if Description then Description = " " .. Description else Description = "" end
local Name = "''" .. Title .. "''" .. Description
if ID then
return IMDB(frame, "title/tt" .. ID, Name.."(angolul)")
else
return IMDB(frame, "Title?" .. mw.url.encode(Title), Name.."(angolul)")
end
end
-- This is used by the {{Allmusic}} template.
function z.Allmusic(frame)
local pframe = frame:getParent()
local args = pframe.args -- azok a paraméterek, amelyeket a lapon, a sablonban megadott a felhasználó
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local Class = args.class or args[1] or "artist"
local ID = args.id or args[2] or ""
local Tab = args.tab
if ( Tab ~= nil ) then Tab = "/" .. Tab else Tab = "" end
local URL = "http://www.allmusic.com/" .. Class .. "/" .. ID .. Tab
if ( args.pure_url ~= nil ) then return URL end
local Surname = args.last or args.author
local Retrieved = args.accessdate
local Title = args.title or args.label or config.pagename -- Should have "or mw.page.title.name" instead, but that isn't available yet.
if ( Surname ~= nil ) then
local Given = args.first
if ( Given ~= nil ) then Given = ", " .. Given else Given = "" end
Surname = Surname .. Given .. ". "
else
Surname = ""
end
if ( Title ~= nil ) then Title = " " .. Title else Title = "" end
if ( Retrieved ~= nil ) then Retrieved = ". Retrieved " .. Retrieved .. "." else Retrieved = "" end
return Surname .. "[" .. URL .. Title .. "] at [[Allmusic]]" .. Retrieved
end
-- This is used by the {{dmoz}} template.
function z.dmoz(frame)
local pframe = frame:getParent()
local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local P1 = args[1] or ""
local P2 = args[2] or config.pagename
local P3 = args[3]
if ( nil ~= P3 or "user" ~= P3 ) then
P1 = P1 or config.pagename
else
P1 = "public/profile?editor=" .. (P1 or "")
end
return "[http://www.dmoz.org/" .. P1 .. " " .. P2 .. "] at the [[Open Directory Project]]"
end
-- This is used by the {{citeseerx}} template.
function z.citeseerx(frame)
local pframe = frame:getParent()
local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local ID = args.id or args.doi or args[1] or ""
local encodedID = mw.url.encode(ID)
return "[[CiteSeer#CiteSeerX|CiteSeerX]]: [//citeseerx.ist.psu.edu/viewdoc/summary?doi=" .. encodedID .. " " .. ID .. "]"
end
-- This is used by the {{official website}} template.
function z.officialwebsite(frame)
local pframe = frame:getParent()
local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local URL = args.URL or args[1] or "//localhost/"
local name = args.name or args[2] or "Official website"
local format = args.format
local mobileURL = args.mobile
local text = {}
if URL:sub(1,5) ~= "http:" and URL:sub(1,6) ~= "https:" then
URL = "http:" .. URL
end
table.insert(text, mw.text.tag({name="span",contents="[" .. URL .. " " .. name .. "]",params={class="official website"}}))
if format == "flash" then
table.insert(text, mw.text.tag({name="span",contents=" Requires Adobe Flash Player",params={style="font-size:smaller;"}}))
end
if mobileURL then
if mobileURL:sub(1,5) ~= "http:" and mobileURL:sub(1,6) ~= "https:" then
mobileURL = "http:" .. mobileURL
end
table.insert(text, mw.text.tag({name="span",contents=mobileURL .. " Mobile",params={class="official website"}}))
end
return table.concat(text)
end
-- This is used by the {{tv.com}} template.
function z.tvcom(frame)
local pframe = frame:getParent()
local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local ID = args.id or args[1] or ""
local URL = "http://www.tv.com/show/" .. ID .. "/summary.html"
if ( args.pure_url ~= nil ) then return URL end
local Title = args.name or args.title or args[2] or config.pagename -- Should have "or mw.page.title.name" instead, but that isn't available yet.
if "episode" == args.type then
Title = " \"" .. Title .. "\""
else
Title = " ''" .. Title .. "''"
end
return "[" .. URL .. Title .. "] at [[TV.com]]"
end
return z