「モジュール:SHOWROOM」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local p = {}; local function setProperty(sr_name) -- メイン空間のみ if not mw.title.getCurrentTitle().namespace == 0 then return true; end if not mw.smw…」) |
(@ ~削除) |
||
48行目: | 48行目: | ||
end | end | ||
return '[' ..url ..' ' ..name ..'] - [[SHOWROOM]]'; | |||
return '[' ..url ..' ' ..name ..'] | |||
end | end | ||
return p; | return p; |
2020年3月21日 (土) 16:18時点における最新版
このモジュールについての説明文ページを モジュール:SHOWROOM/doc に作成できます
local p = {};
local function setProperty(sr_name)
-- メイン空間のみ
if not mw.title.getCurrentTitle().namespace == 0 then
return true;
end
if not mw.smw then
return true;
end
local dataStore = {}
dataStore['SHOWROOMルームキー'] = sr_name
local result = mw.smw.set( dataStore )
if result == true then
-- everything ok
else
-- error message to be found in result.error
end
end
function p.main( frame )
local args = require( 'Module:Arguments' ).getArgs( frame, { wrappers = 'Template:SHOWROOM', removeBlanks = false, parentFirst = true });
-- SHOWROOM ID
local sr_name = args[1] or args.id or '';
-- SHOWROOM URL
local formatterURL = "https://www.showroom-live.com/$1";
local url = mw.ustring.gsub(formatterURL, "\$1", sr_name);
-- SHOWROOM 表示名
local name = args[2] or args.name or '';
-- SemanticMediaWiki
if not args.nosmw then
setProperty(sr_name);
end
-- SHOWROOM 表示名デフォルト
if name == '' then
name = "SHOWROOMアカウント";
end
return '[' ..url ..' ' ..name ..'] - [[SHOWROOM]]';
end
return p;