function unesco.getUnescoImage( countryData )
は、国countryData
についての世界遺産が紹介されている記事・セクションへ飛ぶ世界遺産のアイコンを表示します。
使用状況
[編集]このモジュールを使用しているモジュールは以下の通りです:
この解説は、モジュール:VCard/Unesco/docから呼び出されています。 (編集 | 履歴) 編集者は、このモジュールをサンドボックス (作成 | 複製)とテストケース (作成)で試すことができます。(解説) このモジュールのサブページ一覧。 |
-- This module presenting a Unesco icon with a link to the related article -- has to be adapted to the needs of the local wiki. It depends on the -- existence of Unesco heritage articles. -- modul variable and administration local unesco = { moduleInterface = { suite = 'vCard', sub = 'Unesco', serial = '2023-02-18', item = 111232404 } } -- heritage articles by continent, taken from Module:Unesco/i18n local articles = { af = '世界遺産#アフリカ', -- africa am = '世界遺産#アメリカ合衆国', -- america as = '世界遺産#アジア', -- asia au = '世界遺産#オーストラリア', -- australia eu = '世界遺産#ヨーロッパ', -- europe na = '世界遺産#北アメリカ', -- north america oc = '世界遺産#オセアニア', -- oceania sa = '世界遺産#南アメリカ', -- south america default = '世界遺産', title = '%sの世界遺産' } -- image titles by continent, taken from Module:Unesco/i18n local titles = { af = 'アフリカの世界遺産', am = 'アメリカの世界遺産', as = 'アジアの世界遺産', au = 'オーストラリアの世界遺産', eu = 'ヨーロッパの世界遺産', na = '北アメリカの世界遺産', oc = 'オセアニアの世界遺産', sa = '南アメリカの世界遺産', default = '世界遺産' } local exceptions = { ['アルジェリア'] = 'アルジェリアの世界遺産', ['イギリス'] = 'イギリスの世界遺産', ['イタリア'] = 'イタリアの世界遺産', ['オーストラリア'] = 'オーストラリアの世界遺産', ['オーストリア'] = 'オーストリアの世界遺産', ['シンガポール'] = 'シンガポールの世界遺産', ['日本'] = '日本の世界遺産', ['フランス'] = 'フランスの世界遺産', ['ベトナム'] = 'ベトナムの世界遺産', ['ボツワナ'] = 'ボツワナの世界遺産', ['マダガスカル'] = 'マダガスカルの世界遺産', ['ルーマニア'] = 'ルーマニアの世界遺産' } -- create unesco image with link and title function unesco.getUnescoInfo( countryData ) local article = exceptions[ countryData.country ] or articles.title:format( countryData.country ) if article then -- try to get the country article local title = mw.title.new( article ) if title and title.exists then return article, article end -- try to get the continent article title = titles[ countryData.cont ] if title then article = articles[ countryData.cont ] .. '#' .. countryData.country return article, title end end return articles.default, titles.default end return unesco