642
回編集
template>K-iczn (en:Module:InfoboxImage 03:22, 19 November 2014(UTC)より) |
Triple-Zeta (トーク | 投稿記録) 細 (10版 をインポートしました) |
||
(5人の利用者による、間の5版が非表示) | |||
1行目: | 1行目: | ||
-- Inputs: | -- Inputs: | ||
-- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link | -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link | ||
-- page - page to display for multipage images (DjVu) | |||
-- size - size to display the image | -- size - size to display the image | ||
-- maxsize - maximum size for image | -- maxsize - maximum size for image | ||
87行目: | 88行目: | ||
"Project Trains no image.png", | "Project Trains no image.png", | ||
"Image-request.png", | "Image-request.png", | ||
"Noimage.gif", | |||
} | } | ||
163行目: | 165行目: | ||
if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then | if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then | ||
return image .. "[[Category:Infobox内でサムネイル画像を使用しているページ]]"; | return image .. "[[Category:Infobox内でサムネイル画像を使用しているページ]]"; | ||
elseif mw.title.getCurrentTitle().namespace == 0 then | |||
return image .. ""; | |||
else | else | ||
return image; | return image; | ||
171行目: | 175行目: | ||
return image; | return image; | ||
elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then | elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then | ||
-- Found strip marker at begining, so pass don't process at all | |||
return image; | |||
elseif mw.ustring.sub(image,4,9) == "`UNIQ-" then | |||
-- Found strip marker at begining, so pass don't process at all | -- Found strip marker at begining, so pass don't process at all | ||
return image; | return image; | ||
else | else | ||
local result = ""; | local result = ""; | ||
local page = frame.args["page"]; | |||
local size = frame.args["size"]; | local size = frame.args["size"]; | ||
local maxsize = frame.args["maxsize"]; | local maxsize = frame.args["maxsize"]; | ||
214行目: | 222行目: | ||
if (tonumber(size) or 0) > 0 then | if (tonumber(size) or 0) > 0 then | ||
size = size .. "px"; | size = size .. "px"; | ||
end | |||
-- add px to sizedefault if just a number | |||
if (tonumber(sizedefault) or 0) > 0 then | |||
sizedefault = sizedefault .. "px"; | |||
end | end | ||
result = "[[File:" .. image; | result = "[[File:" .. image; | ||
if page ~= "" and page ~= nil then | |||
result = result .. "|page=" .. page; | |||
end | |||
if size ~= "" and size ~= nil then | if size ~= "" and size ~= nil then | ||
result = result .. "|" .. size; | result = result .. "|" .. size; | ||
236行目: | 251行目: | ||
result = result .. "|border"; | result = result .. "|border"; | ||
end | end | ||
if upright ~= "" then | if upright == "yes" then | ||
result = result .. "|upright"; | |||
elseif upright ~= "" then | |||
result = result .. "|upright=" .. upright; | result = result .. "|upright=" .. upright; | ||
end | end |