「モジュール:Instagram」の版間の差分

Motodai (トーク | 投稿記録)
デフォルトをページ名に
Motodai (トーク | 投稿記録)
エラー解消
 
(3人の利用者による、間の11版が非表示)
1行目: 1行目:
local p = {};
local p = {};


local function setProperty(t_name)
local function setProperty(dataStore)
-- メイン空間のみ
-- メイン空間のみ
11行目: 11行目:
         return true;
         return true;
     end
     end
   
    local dataStore = {}
    dataStore['Instagramアカウント'] = t_name


     local result = mw.smw.set( dataStore )
     local result = mw.smw.set( dataStore )
32行目: 29行目:
-- Instagram URL
-- Instagram URL
local formatterURL = "https://instagram.com/$1";
local formatterURL = "https://instagram.com/$1";
local url = mw.ustring.gsub(formatterURL, "\$1", i_name);
local url = mw.ustring.gsub(formatterURL, "$1", i_name);
-- Instagram 表示名
-- Instagram 表示名
local name = args[2] or args.name or '';
local name = args[2] or args.name or '';
-- SemanticMediaWiki
-- Instagram verify
if not args.nosmw then
local verify = args[3] or args.verify or '';
setProperty(i_name);
    local v_veryfy = '';
if verify == '' then
verify = 'false';
        v_veryfy = '';
else
verify ='true';
v_veryfy = '[[ファイル:認証バッジ.png|15px|link=]]';
end
end
 
 


-- Instagram 表示名デフォルト
-- Instagram 表示名デフォルト
if name == '' then
if name == '' then
name = mw.ustring.gsub(mw.title.getCurrentTitle().text,"%s+%b()$","");
name = mw.ustring.gsub(mw.title.getCurrentTitle().text,"%s+%b()$","");
end
-- SemanticMediaWiki
    local dataStore = {}
    dataStore['Instagram'] = '' .. i_name .. ';'..verify .. ';'..name
if not args.nosmw then
setProperty(dataStore);
end
end


53行目: 65行目:
end
end


return '[' ..url ..' ' ..name ..'] ' ..i_name2 ..' - [[Instagram]]';
return '[' ..url ..' ' ..name ..'] ' ..i_name2 ..v_veryfy..' - [[Instagram]]';
end
end


return p;
return p;