ページ「モジュール:Uses TemplateStyles」と「メンバー」の間の差分

提供:林 康紀研究室
(ページ間の差分)
ナビゲーションに移動 検索に移動
yhlabj>えのきだたもつ
(「モジュール:Uses TemplateStyles」を保護しました: Wikipedia:保護依頼による: 影響が特に大きいテンプレート ([編集=拡張承認された利用者と管理者に許可] (無期限) [移動=拡張承認された利用者と管理者に許可] (無期限)))
 
 
1行目: 1行目:
-- This module implements the {{Uses TemplateStyles}} template.
__HIDDENCAT__
local yesno = require('Module:Yesno')
[[file:Photo 2018 April.jpeg| thumb |2018年 鴨川でのお花見]]
local mList = require('Module:List')
== 研究室主宰者==
local mTableTools = require('Module:TableTools')
<gallery widths=150px heights=200px>
local mMessageBox = require('Module:Message box')
Yasunori Hayashi.jpg|link=林 康紀|[[林 康紀]]
</gallery>


local p = {}
==教室スタッフ==
<gallery widths=150px heights=200px>
Takeo Saneyoshi.jpg|link=實吉 岳郎|[[實吉 岳郎]]
Misa Arizono.jpg|link=有薗 美沙|[[有薗 美沙]]
Kotaro Mizuta.jpg|link=水田 恒太郎|[[水田 恒太郎]]
Akihiro Goto.jpg|link=後藤 明弘|[https://researchmap.jp/7000017647?lang=ja 後藤 明弘]
Nozomi Asaoka.jpg|link=淺岡 希美|[[淺岡 希美]]
Taisei Hirouchi.jpg|link=廣内 大成|[[廣内 大成]]
</gallery>


function p.main(frame)
==大学院生==
local origArgs = frame:getParent().args
<gallery widths=150px heights=200px>
local args = {}
Yaolong Li.jpg|link=李 耀龍|[[李 耀龍]] (D3)
for k, v in pairs(origArgs) do
Leah Men Shin Kuo.jpg|link=郭 孟昕|[[郭 孟昕]] (D1)
v = v:match('^%s*(.-)%s*$')
Yung-chia Chang.jpg|link=張 永佳|[[張 永佳]] (M2)
if v ~= '' then
Tomohiro Mitsugi.jpeg|link=三木 智博|[[三木 智博]] (M2)
args[k] = v
Seiya Ogura.jpg|link=小椋 星哉|[[小椋 星哉]] (M2)
end
Xinzhi Jiang.jpg|link=蒋 欣知|[[蒋 欣知]] (M1)
end
</gallery>
return p._main(args)
end


function p._main(args)
==研究生==
local tStyles = mTableTools.compressSparseArray(args)
<gallery widths=150px heights=200px>
local box = p.renderBox(tStyles)
Bohan Peng.jpg|[[Bohan Peng]]
local trackingCategories = p.renderTrackingCategories(args, tStyles)
</gallery>
return box .. trackingCategories
end


function p.renderBox(tStyles)
==テクニカルスタッフ==
local boxArgs = {}
<gallery widths=150px heights=200px>
if #tStyles < 1 then
Junko Kurahashi.jpg|[[倉橋 順子]]
boxArgs.text = '<strong class="error">エラー: TemplateStylesが指定されていません</strong>'
</gallery>
else
[[en:Members]]
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local sandboxLink = nil
local tsTitle = mw.title.new(ts)
if tsTitle then
local tsSandboxTitle = mw.title.new(string.format('%s:%s/sandbox/%s', tsTitle.nsText, tsTitle.baseText, tsTitle.subpageText))
if tsSandboxTitle and tsSandboxTitle.exists then
sandboxLink = string.format(' ([[:%s|サンドボックス]])', tsSandboxTitle.prefixedText)
end
end
tStylesLinks[i] = string.format('[[:%s]]%s', ts, sandboxLink or '')
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = 'この' ..
(mw.title.getCurrentTitle():inNamespaces(828,829) and 'モジュール' or 'テンプレート') ..
'は[[mw:Help:TemplateStyles/ja|テンプレートスタイル]]を使用しています:\n' .. tStylesList
end
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Farm-Fresh css add.svg|32px|alt=CSS]]'
return mMessageBox.main('mbox', boxArgs)
end
 
function p.renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cats = {}
-- Error category
if #tStyles < 1 then
cats[#cats + 1] = 'テンプレート呼び出しエラーのあるページ/Template:Uses TemplateStyles'
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
local subpageBlacklist = {
doc = true,
sandbox = true,
sandbox2 = true,
testcases = true
}
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not subpageBlacklist[titleObj.subpageText]
then
local category = args.category
if not category then
category = category or 'テンプレートスタイルを利用するテンプレート'
end
cats[#cats + 1] = category
if not yesno(args.noprotcat) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for i, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if tsProt ~= currentProt and not addedLevelCat then
cats[#cats + 1] = "異なる保護レベルがあるテンプレートスタイル使用テンプレート"
end
if tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find("{{pp-") then
cats[#cats + 1] = "保護表示がないテンプレートスタイル使用テンプレート"
addedPadlockCat = true
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
 
return p

2023年7月7日 (金) 09:08時点における版

2018年 鴨川でのお花見

研究室主宰者

教室スタッフ

大学院生

研究生

テクニカルスタッフ