モジュール:Find_sources/autodoc
[Wikipedia|▼Menu]
□記事を途中から表示しています
[最初から表示]

-- Define constantslocal ROOT_PAGE = 'Module:Find sources'local TEMPLATE_LIST = ROOT_PAGE .. '/templates' -- template config module listlocal TEMPLATE_ROOT = TEMPLATE_LIST .. '/' -- template config module prefixlocal LINK_LIST = ROOT_PAGE .. '/links' -- link config module listlocal LINK_ROOT = LINK_LIST .. '/' -- link config module prefixlocal AUTODOC_SUFFIX = '/autodoc'-- Load necessary modules.local mFindSources = require('Module:Find sources')local cfg = mw.loadData('Module:Find sources/autodoc/config')local p = {}local function maybeLoadData(page) local success, data = pcall(mw.loadData, page) return success and dataendlocal function substituteParams(msg, ...) return mw.message.newRawMessage(msg, ...):plain()endlocal function sortKeys(t) local ret = {} for k in pairs(t) do ret[#ret + 1] = k end table.sort(ret) return retendlocal function isValidLinkCfg(linkCfg) if type(linkCfg) ~= 'table' then return false end for _, s in ipairs{'url', 'display'} do if type(linkCfg[s]) ~= 'string' then return false end end for _, s in ipairs{'separator'} do if linkCfg[s] ~= nil and type(linkCfg[s]) ~= 'string' then return false end end return trueendlocal function isValidLink(code) if type(code) ~= 'string' or code == '' then return false end local linkCfg = maybeLoadData(LINK_ROOT .. code) return isValidLinkCfg(linkCfg)endlocal function isValidTemplateCfg(templateCfg) if type(templateCfg) ~= 'table' then return false end for _, s in ipairs{'blurb'} do if type(templateCfg[s]) ~= 'string' then return false end end for _, s in ipairs{'separator', 'class', 'style'} do if templateCfg[s] ~= nil and type(templateCfg[s]) ~= 'string' then return false end end if templateCfg.isUsedInMainspace and templateCfg.isUsedInMainspace ~= true then return false end if type(templateCfg.links) ~= 'table' then return false end local function isValidLinkTable(t) if type(t) ~= 'table' then return false end if type(t.code) ~= 'string' then return false end if t.display and type(t.display) ~= 'string' then return false end return true end if templateCfg.introLink and not isValidLinkTable(templateCfg.introLink) then return false end for _, t in ipairs(templateCfg.links) do if not isValidLinkTable(t) then return false end end return trueendlocal function isValidTemplate(template) if type(template) ~= 'string' or template == '' then return false end local templateCfg = maybeLoadData(TEMPLATE_ROOT .. template) return isValidTemplateCfg(templateCfg)endlocal function isValidLinkAutdocCfg(t) if type(t) ~= 'table' then return false end for _, s in ipairs{'description', 'notes'} do if t[s] and type(t[s]) ~= 'string' then return false end end return trueendlocal function isValidTemplateAutdocCfg(t) if type(t) ~= 'table' then return false end for _, s in ipairs{'description', 'docIntro'} do if t[s] and type(t[s]) ~= 'string' then return false end end if t.shortcuts and type(t.shortcuts) ~= 'table' then return false elseif t.shortcuts then for _, s in ipairs(t.shortcuts) do if type(s) ~= 'string' then return false end end end return trueendlocal function makeWikitable(headers, rows) local ret = {} -- Table start ret[#ret + 1] = '{。
次ページ
記事の検索
おまかせリスト
▼オプションを表示
ブックマーク登録
mixiチェック!
Twitterに投稿
オプション/リンク一覧
話題のニュース
列車運行情報
暇つぶしWikipedia

Size:59 KB
出典: フリー百科事典『ウィキペディア(Wikipedia)
担当:undef