その他の操作
テンプレート>Shummg 日本語化 |
細 1版 をインポートしました |
(相違点なし)
| |
2025年1月11日 (土) 11:40時点における最新版
このモジュールについての説明文ページを モジュール:JS banner/doc に作成できます
スクリプトエラー: Lua エラー: 内部エラー: インタープリターは終了コード 2 で終了しました。
-- This module implements the {{Uses JavaScript}} template.
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local p = {}
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
function p._main(args)
local modules = mTableTools.compressSparseArray(args)
local box = p.renderBox(modules)
local trackingCategories = p.renderTrackingCategories(args, modules)
return box .. trackingCategories
end
function p.renderBox(modules)
local boxArgs = {}
if #modules < 1 then
boxArgs.text = '<strong class="error">エラー: スクリプト名が指定されていません</strong>'
else
local moduleLinks = {}
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local title = mw.title.getCurrentTitle()
if title.subpageText == "doc" then
title = title.basePageTitle
end
boxArgs.text = '以下の[[Wikipedia:JavaScript|JavaScript]]を使用しています:\n' .. moduleList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:JavaScript-logo.png|30px|alt=|link=]]'
return mMessageBox.main('mbox', boxArgs)
end
function p.renderTrackingCategories(args, modules, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #modules < 1 then
cats[#cats + 1] = 'テンプレート呼び出しエラーのあるページ'
end
cats[#cats + 1] = 'JavaScriptを利用するテンプレート'
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
return p