モジュール:Asbox
[Wikipedia|▼Menu]
.mw-parser-output .documentation,.mw-parser-output .documentation-metadata{border:1px solid #a2a9b1;background-color:#ecfcf4;clear:both}.mw-parser-output .documentation{margin:1em 0 0 0;padding:1em}.mw-parser-output .documentation-metadata{margin:0.2em 0;font-style:italic;padding:0.4em 1em}.mw-parser-output .documentation-startbox{padding-bottom:3px;border-bottom:1px solid #aaa;margin-bottom:1ex}.mw-parser-output .documentation-heading{font-weight:bold;font-size:125%}.mw-parser-output .documentation-clear{clear:both}.mw-parser-output .documentation-toolbar{font-style:normal;font-size:85%} モジュールの解説[表示] [編集] [履歴] [キャッシュを破棄].mw-parser-output .ombox{margin:4px 0;border-collapse:collapse;border:1px solid #a2a9b1;background-color:#f8f9fa;box-sizing:border-box}.mw-parser-output .ombox.mbox-small{font-size:88%;line-height:1.25em}.mw-parser-output .ombox-speedy{border:2px solid #b32424;background-color:#fee7e6}.mw-parser-output .ombox-delete{border:2px solid #b32424}.mw-parser-output .ombox-content{border:1px solid #f28500}.mw-parser-output .ombox-style{border:1px solid #fc3}.mw-parser-output .ombox-move{border:1px solid #9932cc}.mw-parser-output .ombox-protection{border:2px solid #a2a9b1}.mw-parser-output .ombox .mbox-text{border:none;padding:0.25em 0.9em;width:100%;font-size:90%}.mw-parser-output .ombox .mbox-image{border:none;padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .ombox .mbox-imageright{border:none;padding:2px 0.9em 2px 0;text-align:center}.mw-parser-output .ombox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ombox .mbox-invalid-type{text-align:center}@media(min-width:720px){.mw-parser-output .ombox{margin:4px 10%}.mw-parser-output .ombox.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;width:238px}}

このLuaモジュールは570,000以上のページで使われています。
余計な混乱やサーバーへの負荷を避けるために、どんな変更でも最初はモジュールのサンドボックス・サブページ、テストケース・サブページで試すべきです。そうすれば、試した変更を1度の編集でこのモジュールに加えることができます。しかし、最初にあなたの提案した変更を、この項目のノートで議論するようにお願いします。

Luaモジュールを使用しています:

モジュール:Asbox stubtree

モジュール:Arguments

モジュール:Buffer

モジュール:Documentation

モジュール:Message box

モジュール:Navbar

このモジュールはテンプレートスタイルを使用しています:

Template:Asbox/styles.css (サンドボックス)

このLuaモジュールは{{Asbox}}を実装しています。仕様についてはテンプレートの解説をご覧ください。この解説は、モジュール:Asbox/docから呼び出されています。 (編集 | 履歴)
編集者は、このモジュールをサンドボックス (編集 | 差分)とテストケース (作成)で試すことができます。(解説
このモジュールのサブページ一覧。

--[[This module was created by User:CodeHydro (Alexander Zhikun He).User:Jackmcbarn and User:Mr._Stradivarius provided a great deal of assistance in writting p.main()p.main() draw heavily from the following version of Template:Asbox of the English Wikipedia, authored primarily by User:Rich_Farmbroughhttps://en.wikipedia.org/w/index.php?title=Template:Asbox&oldid=619510287p.templatepage() is derived from the following revision of Template:Asbox/templatepage, authored primarily by User:MSGJhttps://en.wikipedia.org/w/index.php?title=Template:Asbox/templatepage&oldid=632914791Both templates had significant contributions from numerous others listed in the revision history tab of their respective pages.--]]local WRAPPER_TEMPLATE, args = 'Template:Asbox'local templatestyles = 'Asbox/styles.css'local p, Buffer, stubCats = { --Prevents dupli-cats... get it? Maybe not? cats = setmetatable({}, {__newindex = function(t, i, v) if not rawget(t, i) then rawset(t, i, v) table.insert(t, i) end end}), --initializes variables required by both p.main and p.templatepage init = function(self, frame, page) args, page = args or require('Module:Arguments').getArgs(frame, { wrappers = WRAPPER_TEMPLATE }), page or mw.title.getCurrentTitle() --Ensures demo parameter will never affect category() output for articles self.demo = self.demo or page.namespace ~= 0 and args.demo return args, page end}, require('Module:Buffer')--[[Formats category links. Stores them until called with cat.done=trueTakes multiple or single categories in the form of 'cat'or a table of strings and/or tables containing parts. (See below)]]local attention, catTag, catKey = Buffer'注意を要するスタブテンプレート', '[[Category:%s]]', '%s|%s%s'local function category(cat) for _, v in ipairs((tostring(cat) == cat or cat.t) and {cat} or cat) do --[[ If v is a table: [1] = full category name; defaults to local attention if blank k = Category sort key. Prefix before v.t t = page.text or args.tempsort#; appended after k (or in its place if omitted). Required if v is not a string Basically the same as v = (v[1] or attention) .. ' 。' .. (v.k or '') .. v.t ]] if v and v ~= true then--reject v = nil, false, or true p.cats[catTag:format(tostring(v) == v and v or (v[1] and Buffer(v[1]) or attention):_in(v.k):_(v.t):_str(2, nil, nil, '|') )] = true end end return cat.done and table.concat(p.cats, p.demo and ' 。' 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