モジュール:Asbox
[Wikipedia|▼Menu]
' or nil) or ''end--[[Makes an ombox warning;Takes table {ifNot = Boolean, text, {cat. sort key, cat. sort name}}Will return an empty string instead when ifNot evaluates to true ]]local function ombox(v) if v.ifNot then return end p.ombox = p.ombox or require('Module:Message box').ombox category{v[2]} return p.ombox{ type = 'content', text = v[1] }end--[[Unlike original template, module now takes unlimited cats! This function also performsmost stub category error checks except for the ombox for when main |category= is omitted (See p.template())]]local function catStub(page, pageDoc) stubCats = {missing = {}, v = {}} -- zwj and zwnj have semantical use in other other wikis, don't remove them local zwj = '\226\128\141' -- U+200D, E2 80 8D local zwnj = '\226\128\140' -- U+200C, E2 80 8C local disallowedUnicodeChars = '[^%w%p%s' .. zwj .. zwnj .. ']' -- for i18n we make this a separate string local code for k, _ in pairs(args) do --Find category parameters and store the number (main cat = '') table.insert(stubCats, string.match(k, '^category(%d*)$')) end table.sort(stubCats) for k, v in ipairs(stubCats) do --Get category names and, if called by p.templatepage, the optional sort key local tsort, cat = args['tempsort' .. v], mw.ustring.gsub(args['category' .. v], disallowedUnicodeChars, '')--remove all hidden unicode chars --Do not place template in main category if |tempsort = 'no'. However, DO place articles of that template in the main category. table.insert(stubCats.v, page and (--p.templatepage passes page; p.main does not, i.e. articles are categorized without sort keys. v=='' and tsort == 'no'--if true, inserts 'true' in table, which category() will reject or tsort and {cat, k = '', t = tsort} or {cat, k = '*', t = page.text}--note space in front of sort key ) or cat ) --Check category existance only if on the template page (i.e. stub documentation) if page then if not mw.title.new('Category:' .. cat).exists then code = code or mw.html.create'code':wikitext'|category' table.insert(stubCats.missing, tostring(mw.clone(code):wikitext(v))) end --[[ Checks non-demo stub template for documentation and flags if doc is present. All stub cats names are checked and flagged if it does not match 'Category: [] stub'. The main stub cat is exempt from the name check if the stub template has its own doc (presumably, this doc would have an explanation as to why the main stub cat is non-conforming). ]] table.insert(stubCats.v, v == '' and not p.demo and pageDoc.exists and 'docサブページが存在するスタブテンプレート' or not cat:match'スタブ$' and not cat:match'スタブ項目$' and not cat:match'スタブ記事$' and {k = 'S', t = page.text} ) end end --Add category names after loop is completed category(stubCats.v) return #stubCats.missing > 0 and ombox{ --Changed, original msg: --One or more of the stub categories defined in this template do not seem to exist! --Please double-check the parameters {{para|category}}, {{para|category1}} and {{para|category2}}. '引数'.. mw.text.listToText(stubCats.missing)..'で指定したスタブカテゴリは存在しません。
次ページ
記事の検索
おまかせリスト
▼オプションを表示
ブックマーク登録
mixiチェック!
Twitterに投稿
オプション/リンク一覧
話題のニュース
列車運行情報
暇つぶしWikipedia

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