「
モジュール:仮リンク/link
」を編集中
ナビゲーションに移動
検索に移動
警告:
ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。
ログイン
または
アカウントを作成
すれば、あなたの編集はその利用者名とともに表示されるほか、さまざまなメリットもあります。
スパム攻撃防止用のチェックです。 決して、ここには、値の入力は
しない
でください!
local p = {} function p.otherLangLinkList(args) local label = "" if args['label'] ~= "" and args['label'] ~= nil then label = "|" .. args['label'] end if args['view'] ~= "" and args['view'] ~= nil then local result = {} -- ツールチップ指定 result[1] = string.format( '<span title="%s">[[%s%s]]', args['title'], args[1], label ) if args[2] ~= "" and args[3] ~= "" then -- フォント指定 if args['viewInterwikiPageName'] ~= '1' then result[2] = '<span style="font-size: 0.77em; font-weight: normal;" class="noprint">' else result[2] = '' end -- 改行指定対応 if args['br'] == "" or args['br'] == nil then result[3] = "" else result[3] = '<br/>' end result[4] = '(' if args['viewInterwikiPageName'] == '1' then result[5] = p.otherLangLinkDispName(args[2], args[3], args['interwikilabel'], args['short'], args['links']) else local tmp = {} tmp[1] = p.otherLangLink(args[2], args[3]) tmp[2] = p.otherLangLink(args[4], args[5]) tmp[3] = p.otherLangLink(args[6], args[7]) tmp[4] = p.otherLangLink(args[8], args[9]) result[5] = table.concat(p._tableShorten(tmp), '、') end result[6] = ')' if args['viewInterwikiPageName'] ~= '1' then result[7] = '</span>' else result[7] = '' end end result[8] = '</span>' return table.concat(p._tableShorten(result)) else return string.format( '[[%s%s]]', args[1], label ) end end function p.otherLangLink(langCode, pageName) -- 引数が指定されていない場合は空文字を返す if langCode == "" or langCode == nil or pageName == "" or pageName == nil then return "" end local langDisp -- wikidataの場合は「wikidata」、それ以外の場合は言語名+「版」とする if langCode == 'wikidata' then langDisp = 'wikidata' else local mWikipediaLangName = require('モジュール:Wikipedia言語名') local newFrameArg = {} newFrameArg[1] = langCode local newFrame = { args = newFrameArg } langDisp = mWikipediaLangName.GetWikipediaPageName(newFrame) end if langDisp == nil then error('言語コードの指定に誤りがあります') elseif langCode ~= 'wikidata' then langDisp = langDisp .. '版' end return string.format( '[[:%s:%s|%s]]', langCode, pageName, langDisp ) end function p.otherLangLinkDispName(langCode, pageName, interwikilabel, short, links) -- 必須引数が指定されていない場合は空文字を返す if langCode == "" or langCode == nil or pageName == "" or pageName == nil then return "" end -- 他言語版リンクラベル名が指定されていない場合はページ名を指定 if interwikilabel == "" or interwikilabel == nil then interwikilabel = pageName end -- ページリンク部分取得 local pageLink = string.format( '<span lang="%s" xml:lang="%s">[[:%s:%s|%s]]</span>', langCode, langCode, langCode, pageName, interwikilabel ) -- 言語ページ取得 local mWikipediaLangName = require('モジュール:Wikipedia言語名') local newFrameArg = {} newFrameArg[1] = langCode local newFrame = { args = newFrameArg } local langPage = mWikipediaLangName.GetWikipediaPageName(newFrame) if langPage == nil then error('言語コードの指定に誤りがあります') end -- 言語表示名取得 local langDisp local localShort = short if short == 'on' then newFrameArg = {} newFrameArg[1] = langCode .. '-short' newFrame = { args = newFrameArg } langDisp = mWikipediaLangName.GetWikipediaPageName(newFrame) if langPage == langDisp then localShort = 'off' end end -- 言語表示部分取得 local langLink if links ~= 'no' and localShort ~= 'on' then -- デフォルト(リンクあり、言語名省略なし) langLink = string.format( '[[%s]]', langPage ) elseif links ~= 'no' and localShort == 'on' then -- リンクあり、言語名省略 langLink = string.format( '[[%s|%s]]', langPage, langDisp ) elseif links == 'no' and localShort ~= 'on' then -- リンクなし、言語名省略なし langLink = langPage else -- リンクなし、言語名省略 langLink = langDisp end return langLink .. ': ' .. pageLink end function p._tableShorten(t) local newTable = {} local i = 0 for j,m in ipairs(t) do if m ~= "" and m ~= nil then i = i + 1 newTable[i] = m end end return newTable end return p
編集内容の要約:
uwuzu 非公式Wikiへの投稿はすべて、クリエイティブ・コモンズ 表示-非営利-継承 (詳細は
UwuzuWiki:著作権
を参照)のもとで公開したと見なされることにご注意ください。 自分が書いたものが他の人に容赦なく編集され、自由に配布されるのを望まない場合は、ここに投稿しないでください。
また、投稿するのは、自分で書いたものか、パブリック ドメインまたはそれに類するフリーな資料からの複製であることを約束してください。
著作権保護されている作品は、許諾なしに投稿しないでください!
キャンセル
編集ヘルプ
(新しいウィンドウで開きます)
このページで参照読み込みされているページ:
モジュール:仮リンク/link/doc
(
編集
)
ナビゲーション メニュー
個人用ツール
ログインしていません
トーク
投稿記録
アカウント作成
ログイン
名前空間
モジュール
議論
English
表示
閲覧
ソースを編集
履歴表示
その他
検索
案内
メインページ
最近の更新
おまかせ表示
MediaWiki についてのヘルプ
特別ページ
このWIkiについて
ツール
リンク元
関連ページの更新状況
ページ情報
他のプロジェクト