https://hokudaiwiki.net/hokudaiwiki_main/api.php?action=feedcontributions&user=MasterWiki&feedformat=atom
北大Wiki - 利用者の投稿記録 [ja]
2024-03-29T15:03:00Z
利用者の投稿記録
MediaWiki 1.35.1
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%98%E3%83%AB%E3%83%97:%E6%9B%B8%E3%81%8D%E6%96%B9&diff=4341
ヘルプ:書き方
2023-08-02T16:02:59Z
<p>MasterWiki: ページの移動について説明追加</p>
<hr />
<div>ここでは北大Wikiの編集方法について解説します。<br />
<br />
== 記事の作り方 ==<br />
デフォルトでは「<font color="red">赤色</font>」で表示されている「<font color="red">赤リンク</font>」へアクセスすることで新しい記事が作成できます。<br />
書きたい記事がない場合はタイトルを<nowiki>[[〇〇〇]]</nowiki>と一度投稿してから、その赤リンクをクリックして作成しましょう。<br />
このリンクが'''新しい記事の名前'''になるので、よく考えて作ってください。「正式名称」と「一般的な呼称/略称」など様々な場合があると思います(「[[北食]]」「[[北部食堂]]」「生協食堂北部店」など)。<br />
<br />
「[[特別:存在しないページへのリンク]]」には、まだ記事が作られていない「<font color="red">赤リンク</font>」が並んでいます。<br />
<br />
== 記事の書き方 ==<br />
<br />
=== 記事の構成 ===<br />
[https://ja.wikipedia.org Wikipedia]でも見られるようなよくある記事の構成は以下のようなものです。<br />
<br />
* 簡単な説明<br />
* 概要<br />
* トピックA<br />
** トピックA.1<br />
** トピックA.2<br />
* トピックB<br />
...<br />
* 関連項目<br />
* (カテゴリの指定)<br />
<br />
=== 簡単な説明 ===<br />
記事の一番最初、「見出し」を入れる前には短い説明を入れた方がよいでしょう。<br />
よくある書き方として<br />
<br />
'''書き方説明''' (かきかたせつめい、英語: Editor's Guide) は北大Wikiの記述方法について説明したページ。<br />
<br />
のように記事タイトルの正式名称(場合によっては読み方、外国語名も)を載せて一言説明を載せるといいでしょう。<br />
<br />
=== 見出し ===<br />
見出しは "<nowiki>== 概要 ==</nowiki>" のように半角 "==" で囲んでください。<br />
また "=" の数を増やすことで、より深いレベルの見出しが使えます。<br />
この記述がある見出しは「レベル3」の見出しです。<br />
<br />
見出しの中身と "=" の間には半角スペースがあると編集時にキレイだと思います。<br />
<br />
==== 見出しのレベルについて ====<br />
通常、記事の見出しは "==" を用いたレベル2以上の見出しが使われます。"=" によるレベル1の見出しは記事タイトルと同じレベルのため、あまり美しくありません。<br />
<br />
=== ウィキリンク(内部リンク)と外部リンク ===<br />
==== 内部リンク ====<br />
文章中の単語等で他のページへリンクしたい文字列があれば "<nowiki>[[メインページ]]</nowiki>" のように半角大括弧2つ "[[]]" で囲むとリンクすることができます。<br />
<br />
リンクしたい先と記事の名前が食い違う場合は "<nowiki>[[本当にリンクしたい記事名|本文表示]]</nowiki>" とすると、本文の表示をそのままに適切な記事へリンクを貼ることができます。<br />
<br />
==== 外部リンク ====<br />
外部にあるページへリンクしたい文字列があれば "<nowiki>[https://hokudaiwiki.net 北大Wiki]</nowiki>" のように半角大括弧1つ "[]" でリンクしたいURLと文字列を囲むとリンクすることができます。<br />
<br />
"[]" で囲んだURLと文字列の間には半角スペースが必要です。<br />
<br />
=== 改行 ===<br />
改行は1行の空行を入れるのがオススメです。<nowiki><br/></nowiki>で改行することもできますが、スマホやパソコンによって表示が崩れるのでオススメしません。<br />
<br />
=== DEFAULTSORTの指定 ===<br />
記事を一覧にしたときの順番を指定するために必要です。記事の最後の方に以下のようにして、その記事のタイトルを'''全てひらがなで'''入れてください。<br />
<br />
記事タイトル「[[文学部・文学研究科]]」の場合の例<br />
<nowiki>{{DEFAULTSORT:ふんかくふふんかくけんきゆうか}}</nowiki><br />
<br />
濁音・半濁音は全て'''清音'''(が→か、ぷ→ふ、等)にし、拗音も清音(ゅ→ゆ)としてください。<br />
<nowiki>{{DEFAULTSORT:〇〇〇}}</nowiki>はテンプレートなので、正しく編集されていれば、ページには表示されません。<br />
[[特別:カテゴリ|カテゴリページ]]などで並べられる際に、この内容に応じて並べられます。<br />
<br />
=== カテゴリの指定 ===<br />
記事の末尾に <nowiki>[[Category:○○○○]]</nowiki> と入れることで、その記事を「カテゴリ」に入れることができます。カテゴリ化すると、記事が一覧しやすくなるので便利です。<br />
* [[特別:カテゴリ|カテゴリ一覧]]<br />
<br />
カテゴリは誰でも作れるので、必要だと思ったらカテゴリを作ることも検討してください。1つの記事に複数のカテゴリを設定することもできます。<br />
<br />
== ログインの有無 ==<br />
北大Wikiではアカウントを作成し、「[[特別:ログイン|ログイン]]」して編集することができます。<br />
<br />
ログインすると<br />
* 投稿記録のページから自分の編集を振り返ることができる<br />
* 編集時の質問に答えなくてよい<br />
* 編集時のIPアドレスを公開されない(アクセスログには残っています)<br />
というメリットがあります。<br />
<br />
=== ログインせずに編集するときのヒント ===<br />
ログインせずに編集した場合、質問に回答しないと投稿できません。<br />
しかも投稿に限らず、「プレビュー」を見るときにも質問への回答が求められます。<br />
<br />
実は「プレビュー」の時には必ずしも正しい回答を入れる必要がありません。<br />
極端に言えば「あ」とか「a」とかスペースでもなんでもよいので、何か入力されていればプレビューを見ることはできます。<br />
(変更を保存する際には正しい答えが必要です)<br />
<br />
== 画像の挿入 ==<br />
PC版でログインすると画像がアップロードできるようになります。左側のメニューにある「[[特別:アップロード|ファイルをアップロード]]」からアップロードしてください。<br />
<br />
アップロード時、「登録するファイル名」欄に登録された名前が北大Wiki内で使われるファイル名となり、記事挿入時に使用されます。<br />
「概要」欄には簡単に説明を書いてください。<br />
またライセンスは「クリエイティブ・コモンズ 表示-継承 4.0」を選ぶことが推奨されます。<br />
<br />
アップロードしたファイルは '''<nowiki>[[ファイル:Hokudaiwiki logo135.png|300px|thumb|北大Wikiロゴ]]</nowiki>''' のように挿入することで記事の中に表示できます。<br />
<br />
[[ファイル:Hokudaiwiki logo135.png|300px|thumb|北大Wikiロゴ]]<br />
<br />
== 地図の載せ方 ==<br />
北大Wikiでは地図を載せることができます。<br />
<br />
書き方例を以下に示しますが、どの場合でも緯度経度を使います。緯度経度は '''[https://www.google.co.jp/maps Google Maps]上で右クリック'''して取得するのが便利です。<br />
<br />
[https://maps.extension.wiki/wiki/Displaying_Leaflet_maps Displaying Leaflet maps - Maps for MediaWiki]のウェブページにはより詳しい情報が載っています。<br />
<br />
=== マーカー ===<br />
[[大将]]のページを例にします。任意の地点にマーカーが置けます。<br />
<br />
最低限必要なのは以下の書式です。<br />
<nowiki><br />
{{#display_map:<br />
緯度, 経度~タイトル~詳細;<br />
|zoom=14 |height=300<br />
}}<br />
</nowiki><br />
一つのマーカーは "~" (チルダ)をつかって区切った3つの情報で構成され、それぞれ最後は ";" (セミコロン)を挿入します。<br />
<br />
"zoom" は地図の拡大率で数値が大きいほど拡大します(0 - 19の範囲)。<br />
<br />
"height" は地図の表示高さです。ピクセル数で指定します。300がちょうどよいと思います。<br />
<br />
==== 書き方例 ====<br />
<nowiki><br />
{{#display_map:<br />
43.08224117812974, 141.34473466793898~[[大将]]北18条店~北大に一番近い大将;<br />
43.08836299465925, 141.3431226568469~[[大将]]北22条店~出前をしてくれる大将その1;<br />
43.091487436511265, 141.34127693486883~[[大将]]北25条店~出前をしてくれる大将その2;<br />
|zoom=14 |height=300<br />
}}<br />
</nowiki><br />
<br />
==== 表示例 ====<br />
{{#display_map:<br />
43.08224117812974, 141.34473466793898~[[大将]]北18条店~北大に一番近い大将;<br />
43.08836299465925, 141.3431226568469~[[大将]]北22条店~出前をしてくれる大将その1;<br />
43.091487436511265, 141.34127693486883~[[大将]]北25条店~出前をしてくれる大将その2;<br />
|zoom=14 |height=300<br />
}}<br />
<br />
=== ライン ===<br />
[[サクシュコトニ川]]のページを例にします。<br />
<br />
最低限必要なのは以下の書式です。<br />
<nowiki><br />
{{#display_map:lines=<br />
緯度A, 経度A:<br />
緯度B, 経度B:~タイトル~詳細~色~透明度~線太さ;<br />
|zoom=16 |height=300<br />
}}<br />
</nowiki><br />
一本のラインは、":" (コロン)で区切った緯度経度のリストと "~" (チルダ)をつかって区切った情報で構成され、最後に ";" (セミコロン)を挿入します。<br />
<br />
'''色'''は "red", "blue", "green" などが指定できます。<br />
<br />
'''透明度'''は "1" でまったく透過せず、"0" ですべて透過され、見えなくなります。小数で入力してください。<br />
<br />
'''線太さ'''は適当な数値を入力してください。<br />
<br />
zoom, height は'''マーカー'''と同じです。<br />
<br />
==== 書き方例 ====<br />
長いので一部のみ抜き出しています。<br />
<nowiki><br />
{{#display_map:lines=<br />
43.07035254327729, 141.3441669932933:<br />
43.070561350196904, 141.3440329241507:<br />
43.0708469338241, 141.34416020894184:<br />
43.070910025031516, 141.34455569445424:<br />
43.07109930715668, 141.34461479344657:<br />
43.07112919024469, 141.3449466391445:~[[サクシュコトニ川]]~川の経路~red~0.5~6;<br />
|zoom=16 |height=300<br />
}}<br />
</nowiki><br />
<br />
==== 表示例 ====<br />
{{#display_map:lines=<br />
43.07035254327729, 141.3441669932933:<br />
43.070561350196904, 141.3440329241507:<br />
43.0708469338241, 141.34416020894184:<br />
43.070910025031516, 141.34455569445424:<br />
43.07109930715668, 141.34461479344657:<br />
43.07112919024469, 141.3449466391445:~[[サクシュコトニ川]]~川の経路~red~0.5~6;<br />
|zoom=16 |height=300<br />
}}<br />
<br />
=== 多角形 ===<br />
[[札幌キャンパス]]のページを例にします。<br />
<br />
最低限必要なのは以下の書式です。<br />
<nowiki><br />
{{#display_map:polygons=<br />
緯度A, 経度A:<br />
緯度B, 経度B:<!-- コメント(ここは地点B など) --><br />
緯度C, 経度C:<br />
...<br />
緯度XXX, 経度XXX:<br />
~タイトル~詳細~線色~線透明度~線太さ~塗りつぶし色~塗りつぶし透明度;<br />
|zoom=14 |height=300<br />
}}<br />
</nowiki><br />
<br />
一本のラインは、":" (コロン)で区切った緯度経度のリストと "~" (チルダ)をつかって区切った情報で構成され、最後に ";" (セミコロン)を挿入します。<br />
<br />
'''線色'''、'''塗りつぶし色'''は "red", "blue", "green" などが指定できます。<br />
<br />
'''線透明度'''、'''塗りつぶし透明度'''は "1" でまったく透過せず、"0" ですべて透過され、見えなくなります。小数で入力してください。<br />
<br />
'''線太さ'''は適当な数値を入力してください。<br />
<br />
zoom, height は'''マーカー'''と同じです。<br />
<br />
また "<!-- -->" と書くことで途中にコメントを挿入できます(ラインの書式でもできます)。コメントを入れておくと、どの緯度経度なのかわかりやすくなるので、必要に応じて入れてください。<br />
<br />
==== 書き方例 ====<br />
長いので一部中略しています。<br />
<nowiki><br />
{{#display_map:polygons=<br />
43.07109665565198, 141.34768047153275:<!-- 正門 --><br />
43.07842978850005, 141.34583328400478:<br />
43.078347643263896, 141.34479727974022:<br />
43.07886788643309, 141.34464391640776:<br />
43.08889549040469, 141.33402714994074:<!-- 北東端 --><br />
43.08820112661574, 141.3289561907415:<br />
43.087847714919995, 141.3290516165828:<br />
(中略)<br />
43.07048393841669, 141.3443893584731:<br />
43.07078515329996, 141.34508992297427:<br />
~[[札幌キャンパス]]~およそ外周~green~0.4~5~blue~0.1;<br />
|zoom=14 |height=300<br />
}}<br />
</nowiki><br />
<br />
==== 表示例 ====<br />
{{#display_map:polygons=<br />
43.07109665565198, 141.34768047153275:<!-- 正門 --><br />
43.07842978850005, 141.34583328400478:<br />
43.078347643263896, 141.34479727974022:<br />
43.07886788643309, 141.34464391640776:<br />
43.08889549040469, 141.33402714994074:<!-- 北東端 --><br />
43.08820112661574, 141.3289561907415:<br />
43.087847714919995, 141.3290516165828:<br />
43.08685716111757, 141.331106581958:<br />
43.0838356161124, 141.33106909499017:<br />
43.084271183110715, 141.3348143832112:<br />
43.08100723241081, 141.33559969796727:<br />
43.08125889357888, 141.32999547903995:<!-- エルムトンネル西出口 --><br />
43.07614799582551, 141.33203380045038:<br />
43.07567944876132, 141.33237498496536:<br />
43.07137099222332, 141.33665495962603:<br />
43.069264668925356, 141.33563575665266:<br />
43.0679186882664, 141.33896923557157:<!-- 南端 --><br />
43.06872628221139, 141.33892487907852:<br />
43.06886586565671, 141.33924219240603:<br />
43.068629070036536, 141.33981198956144:<br />
43.068733754944546, 141.3420536503313:<br />
43.06924473038445, 141.34409741103664:<br />
43.069621104335255, 141.34476274315858:<br />
43.069834324816426, 141.34447310223587:<br />
43.07048393841669, 141.3443893584731:<br />
43.07078515329996, 141.34508992297427:<br />
~[[札幌キャンパス]]~およそ外周~green~0.4~5~blue~0.1;<br />
|zoom=14 |height=300<br />
}}<br />
<br />
== ツイートの埋め込み ==<br />
次のようにツイートを埋め込むことができます。<br />
<br />
{{#Widget:Tweet|id=1356148229419589633}}<br />
<br />
ツイートを埋め込むには次のような記法を利用します。<br />
<br />
<nowiki>{{#Widget:Tweet|id=1356148229419589633}}</nowiki><br />
<br />
<code>id=</code>の後ろにはツイートIDを入力します。ツイートIDはツイートのURL<code><nowiki>https://twitter.com/hokudai_wiki/status/</nowiki>'''1356148229419589633'''</code>の<code>status/</code>に続く数字列のことで、この例では<code>1356148229419589633</code>になります。<br />
<br />
== 動画の埋め込み ==<br />
YouTubeやニコニコ動画の動画を埋め込むことができます。<br />
<br />
=== YouTube ===<br />
<youtube width="360" height="200">ZmLKYE_bFaA</youtube><br />
<br />
YouTubeの動画を埋め込むには次のような記法を利用します。<br />
<br />
<nowiki><youtube width="表示幅(px)" height="表示高さ(px)">動画のID</youtube></nowiki><br />
<br />
動画のIDはYouTubeの動画のURL<code><nowiki>https://www.youtube.com/watch?v=</nowiki>'''ZmLKYE_bFaA'''</code>の<code>?v=</code>からURL末尾または次の<code>&</code>まで続く文字列のことです。例として、上記の動画は次の記述により埋め込まれています。<br />
<br />
<nowiki><youtube width="360" height="200">ZmLKYE_bFaA</youtube></nowiki><br />
<br />
[[:Category:YouTube動画を含む記事|カテゴリ:YouTube動画を含む記事]]からYouTube動画の埋め込まれたページを見ることができます。<br />
<br />
=== ニコニコ動画 ===<br />
<nicovideo width="400" height="240">sm31349610</nicovideo><br />
<br />
ニコニコ動画の動画を埋め込むには次のような記法を利用します。<br />
<br />
<nowiki><nicovideo width="表示幅(px)" height="表示高さ(px)">動画のID</nicovideo></nowiki><br />
<br />
動画のIDはニコニコ動画のURL<code><nowiki>https://www.nicovideo.jp/watch/</nowiki>'''sm31349610'''</code>の<code>watch/</code>に続く文字列のことです。例として、上記の動画は次の記述によりで埋め込まれています。<br />
<br />
<nowiki><nicovideo width="400" height="240">sm31349610</nicovideo></nowiki><br />
<br />
=== 動画のサイズについて ===<br />
表示幅は'''width="360"'''で設定するのがオススメです。スマートフォンで表示されたときにちょうどよい幅のためです。<br />
<br />
== 記事名の変更 ==<br />
各記事には編集履歴が残っています。記事名を変更するときには新しく記事を作って内容をコピペするのではなく、'''ページの移動'''機能を使ってください。<br />
<br />
移動機能を使うことで、編集履歴を残したまま記事名を変更することができ、自動的にリダイレクトページも作成されます。<br />
<br />
PCブラウザの場合、'''編集'''ボタンの横にある'''その他'''から'''移動'''することができます。<br />
<br />
== 関連項目 ==<br />
* [[北大Wiki:北大Wikiについて]]<br />
<br />
[[Category:ヘルプページ]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E3%82%A2%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88&diff=4340
公式Xアカウント
2023-08-02T15:57:21Z
<p>MasterWiki: Twitterの名称変更に伴う名称変更</p>
<hr />
<div>'''公式Xアカウント'''(こうしきエックスアカウント)は大学当局が開設した北大の公式X(Twitter)アカウント。日本語版アカウントと英語版アカウントがある。<br />
<br />
== 英語版 ==<br />
先に開設されたのは英語版アカウントである。内容は部局のニュース、イベント情報、留学生向け情報、北大で学びたい外国人向け情報などである。また、他の部局の公式アカウントに投稿された注目記事や[[体育会]]系部活の活躍をリツイートする場合も多い。<br />
<br />
フォロワー数は、2018年12月の時点で2600名だったが、2019年9月に5000フォロワーを達成した。<br />
特別学生の[[onちゃん]]の11万フォロワーという極端なケースはあるが、フォロワー5000人は北大関係のXアカウントとしてはフォロワー数が多い部類に入る。<br />
2021年1月現在では7500フォロワーに達している。<br />
<br />
=== Tuesday Trivia ===<br />
かつて毎週火曜日に「Tuesday Trivia」が投稿され、名物であった。これは北大に関わる豆知識を4択クイズ形式、または○×クイズ形式で出題するものである。戦前~昭和時代までの歴史に関するクイズ、北大の国際性に関するクイズが多い。<br />
[[北大構内で会える生物]]の多様性から、北大の[[牛]]に関するクイズもみられる。2019年の[[北大祭]]の直前には、[[ふっとう君]]に関するクイズが出題された。北大生の中には、今週の「Tuesday Trivia」でどのジャンルのクイズが出題されるかを予想する人もいる。<br />
<br />
翌水曜日に正解が発表される。しかし、公式Instagramアカウント開設以降、火曜日のうちに公式Instagramアカウントでネタバレをするようになった。<br />
<br />
最も正解率が低かったのは、2020年8月25日出題のものである。「Hokkaido University Botanic Garden has a museum. True or false?」という2択問題にTrueが85.4%の回答を集めたが、答えはFalseであった。[[植物園]]内に博物館は3館あり1館ではないからという理由である。<br />
{{#widget:Tweet|id=1298078387387285505}}<br />
<br />
== 日本語版 ==<br />
英語版アカウントだけ開設されていた当時は、英語版アカウントの存在を知らずに北大の「日本語の」公式Twitterアカウント開設の要望も見られた。<br />
<br />
令和元年10月1日、ついに北大の日本語版公式アカウントが開設された。<br />
<br />
内容は、現状は公式ホームページの新着情報の紹介やリンク掲載にとどまっており、さらなる内容の充実が期待される。<br />
<br />
2022年12月現在は10800フォロワー程度いる。同月での大学公式アカウントのTwitterフォロワー数ランキングは、国立大学編で12位であった。<br />
<br />
令和4年度[[前期入試]]の合格発表の当日の告知ツイートで「春から北大」ハッシュタグを使用した。<br />
<br />
== アカウント ==<br />
* https://twitter.com/HokkaidoUni : (英語版)<br />
* https://twitter.com/HokkaidoUnivPR : (日本語版)<br />
<br />
== 関連項目 ==<br />
* [[理学部]] : 理学部としての公式アカウントを運営しており、たまにバズっている。<br />
<br />
{{DEFAULTSORT:こうしきえつくすあかうんと}}<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E4%B8%80%E8%A6%A7&diff=4339
公式X一覧
2023-08-02T15:55:01Z
<p>MasterWiki: Twitterの名称変更に伴う記事名変更</p>
<hr />
<div>この項目では公式運営のX(Twitter)アカウントを一覧にする。<br />
<br />
== 全学 ==<br />
* 北海道大学 : [https://twitter.com/HokkaidoUnivPR @HokkaidoUnivPR]<br />
* Hokkaido University : [https://twitter.com/HokkaidoUni @HokkaidoUni]<br />
<br />
== 学部 ==<br />
* 北海道大学[[文学部|文学研究院・文学院・文学部]] : [https://twitter.com/HU_Bungaku @HU_Bungaku]<br />
* 北大日本古典文化論研究室(公式) : [https://twitter.com/hokudainichibun @hokudainichibun]<br />
* 北海道大学[[公共政策大学院・公共政策学教育部・公共政策学連携研究部|公共政策大学院]] : [https://twitter.com/HokudaiHOPS @HokudaiHOPS]<br />
* 北海道大学[[国際広報メディア・観光学院 メディア・コミュニケーション研究院|国際広報メディア・観光学院]] : [https://twitter.com/IMSCTS_HU @IMSCTS_HU]<br />
* 北海道大学[[理学部]] : [https://twitter.com/Science_HU/ @Science_HU]<br />
* 北海道大学理学部[[物理学科]] : [https://twitter.com/phys_scihokudai @phys_scihokudai]<br />
* 北大理学部[[化学科]] : [https://twitter.com/Chem_HokkaidoU @Chem_HokkaidoU]<br />
* 【公式】北海道大学[[工学部]]広報室 : [https://twitter.com/hu_eng @hu_eng]<br />
* 北海道大学 [[応用化学コース]] : [https://twitter.com/apchem_hokudai @apchem_hokudai]<br />
* 北海道大学大学院[[環境科学院・地球環境科学研究院|環境科学院]]地球圏科学専攻 : [https://twitter.com/ess_ees_hu @ess_ees_hu]<br />
* [[おしょろ丸|Oshoro-maru]] Hokudai : [https://twitter.com/oshorohokudai @oshorohokudai]<br />
<br />
== 同窓会 ==<br />
* 北海道大学 [[校友会エルム]] : [https://twitter.com/alumni_hokudai @alumni_hokudai]<br />
* [[北水同窓会]] : [https://twitter.com/HokusuiD @HokusuiD]<br />
* 北大東京同窓会 : [https://twitter.com/tokyoelm @tokyoelm]<br />
<br />
== 生協 ==<br />
* 北海道大学[[生活協同組合]](北大生協) : [https://twitter.com/HU_COOP_KK @HU_COOP_KK]<br />
* 北大生協 北部店 : [https://twitter.com/hokubucoop @hokubucoop]<br />
* 北大生協 中央購買 : [https://twitter.com/chuohcoop @chuohcoop]<br />
* 北大生協水産学部店 : [https://twitter.com/suisancoop @suisancoop]<br />
* 北大生協学生委員会 : [https://twitter.com/HU_COOP_GI_CS @HU_COOP_GI_CS]<br />
* 北大生協院生委員会 : [https://twitter.com/Hokudainsei_coo @Hokudainsei_coo]<br />
<br />
== 学生支援 ==<br />
* 北海道大学ラーニングサポート室 : [https://twitter.com/LSO_Hokudai @LSO_Hokudai]<br />
* 北海道大学 学生相談室 : [https://twitter.com/Hoku_Gakusou @Hoku_Gakusou]<br />
* 北海道大学学生相談ピアサポート : [https://twitter.com/peersupport_HU @peersupport_HU]<br />
* 北海道大学キャリアセンター : [https://twitter.com/hokudai_career @hokudai_career]<br />
* 北海道大学キャリアセンター公務員担当 : [https://twitter.com/hokudai_KOUMUIN @hokudai_KOUMUIN]<br />
* 北海道大学S-cubic 博士のキャリア支援 : [https://twitter.com/HokudaiDCcareer @HokudaiDCcareer]<br />
* 北海道大学[[保健センター]] : [https://twitter.com/tniSh5zqlQDmcXA @tniSh5zqlQDmcXA]<br />
<br />
== 研究機関 ==<br />
* [[CoSTEP]] : [https://twitter.com/costep_pr @costep_pr]<br />
* 北海道大学オープンエデュケーションセンター : [https://twitter.com/OEC_Hokudai @OEC_Hokudai]<br />
* 北海道大学[[URAステーション]] : [https://twitter.com/hokudai_ura @hokudai_ura]<br />
* 北方研究教育センター : [https://twitter.com/cnh_hokudai @cnh_hokudai]<br />
* 教養深化プログラム【北海道大学】 : [https://twitter.com/cuenp_hokudai @cuenp_hokudai]<br />
* Hokkaido University ICReDD : [https://twitter.com/ICReDDconnect @ICReDDconnect]<br />
* [[Modern Japanese Studies Program|MJSP]], Hokkaido University : [https://twitter.com/MJSP_Hokkaido @MJSP_Hokkaido]<br />
* [[Hokkaido Summer Institute]] : [https://twitter.com/Hokkaido_SI @Hokkaido_SI]<br />
* ARC-HU(北大北極域研究センター) : [https://twitter.com/ARC_HokkaidoU @ARC_HokkaidoU]<br />
* SRC-Hokudai : [https://twitter.com/SRC_Hokudai @SRC_Hokudai]<br />
* Institute for Catalysis (ICAT) / 北海道大学[[触媒科学研究所]] : [https://twitter.com/ICAT_Hokudai @ICAT_Hokudai]<br />
* 北海道大学 人間知・脳・AI研究教育センター / CHAIN, Hokkaido Univ : [https://twitter.com/ChainHokudai @ChainHokudai]<br />
* 北海道大学DEI推進本部 ダイバーシティ・インクルージョン : [https://twitter.com/HokudaiDEI @HokudaiDEI]<br />
* 北大大学院教育改革推進室@大学院生×社会を生み出す : [https://twitter.com/grad_hokudai @grad_hokudai]<br />
* hokudai.coi.next : [https://twitter.com/hokudai_coinext @hokudai_coinext]<br />
<br />
== 図書館 ==<br />
* 北海道大学[[附属図書館]](Hokkaido University Library) : [https://twitter.com/Hokudai_Library @Hokudai_Library]<br />
* 北水図書館(函館) : [https://twitter.com/Hokusui_T @Hokusui_T]<br />
* 新書交流プログラム : [https://twitter.com/with_new_books @with_new_books]<br />
<br />
== 博物館 ==<br />
* 北大[[総合博物館|博物館]] 地球展示室 : [https://twitter.com/hokudai_museum @hokudai_museum]<br />
* 北海道大学総合博物館陸上植物標本庫(SAPS) : [https://twitter.com/Herb_SAPS @Herb_SAPS]<br />
* 北大[[獣医学部|獣医]] 標本展示室 : [https://twitter.com/vetspecimen @vetspecimen]<br />
* 北海道大学[[植物園]]【公式】 : [https://twitter.com/HokkaidoUniv_bg @HokkaidoUniv_bg]<br />
* (ハコダテ)北大総合博 水産科学館 : [https://twitter.com/FSC_HOUM @FSC_HOUM]<br />
<br />
== 病院 ==<br />
* 北海道大学小児科【公式】 : [https://twitter.com/Hokudai_Ped @Hokudai_Ped]<br />
* [[北大病院|北海道大学病院]] 救急科 : [https://twitter.com/hokudai_qq @hokudai_qq]<br />
* 北大栄養 : [https://twitter.com/nmchuhp @nmchuhp]<br />
* 北海道大学呼吸器外科 : [https://twitter.com/Hokudai_TS @Hokudai_TS]<br />
* 北海道大学整形外科学教室 : [https://twitter.com/hokudai_seikei @hokudai_seikei]<br />
* 北大 消化器内科 : [https://twitter.com/QyLtZz66unEDFF6 @QyLtZz66unEDFF6]<br />
* 北海道大学大学院医学研究院眼科学教室 : [https://twitter.com/eye_med_hokudai @eye_med_hokudai]<br />
<br />
== その他 ==<br />
* [[いいね!Hokudai]] : [https://twitter.com/like_hokudai @like_hokudai]<br />
* [[北海道大学出版会]] : [https://twitter.com/Hokkaido_UP @Hokkaido_UP]<br />
* [[北大マルシェ]] Café&Labo : [https://twitter.com/marchecafe @marchecafe]<br />
* [[北大祭]]事務局 : [https://twitter.com/HOKUDAISAI @HOKUDAISAI]<br />
* 北海道大学[[体育会]] : [https://twitter.com/H_U_A_U @H_U_A_U]<br />
* 北大[[恵迪寮]] : [https://twitter.com/Keiteki_ryo @Keiteki_ryo]<br />
* 北大[[金葉祭]] : [https://twitter.com/konyousai @konyousai]<br />
* [[札幌市時計台|時計台]]サロン~[[農学部]]に聞いてみよう~ : [https://twitter.com/clocktowersalon @clocktowersalon]<br />
<br />
== 関連項目 ==<br />
* [[公式Xアカウント]]<br />
* [[北大ツイッター界隈]]<br />
* [[公式Threads一覧]]<br />
<br />
{{DEFAULTSORT:こうしきえつくすいちらん}}<br />
[[Category:お役立ち情報]]<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FTwitter%E4%B8%80%E8%A6%A7&diff=4338
公式Twitter一覧
2023-08-02T15:52:20Z
<p>MasterWiki: MasterWiki がページ「公式Twitter一覧」を「公式X一覧」に移動しました: Twitterの名称変更に伴う記事名変更</p>
<hr />
<div>#転送 [[公式X一覧]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E4%B8%80%E8%A6%A7&diff=4337
公式X一覧
2023-08-02T15:52:20Z
<p>MasterWiki: MasterWiki がページ「公式Twitter一覧」を「公式X一覧」に移動しました: Twitterの名称変更に伴う記事名変更</p>
<hr />
<div>この項目では公式運営のTwitterアカウントを一覧にする。<br />
<br />
== 全学 ==<br />
* 北海道大学 : [https://twitter.com/HokkaidoUnivPR @HokkaidoUnivPR]<br />
* Hokkaido University : [https://twitter.com/HokkaidoUni @HokkaidoUni]<br />
<br />
== 学部 ==<br />
* 北海道大学[[文学部|文学研究院・文学院・文学部]] : [https://twitter.com/HU_Bungaku @HU_Bungaku]<br />
* 北大日本古典文化論研究室(公式) : [https://twitter.com/hokudainichibun @hokudainichibun]<br />
* 北海道大学[[公共政策大学院・公共政策学教育部・公共政策学連携研究部|公共政策大学院]] : [https://twitter.com/HokudaiHOPS @HokudaiHOPS]<br />
* 北海道大学[[国際広報メディア・観光学院 メディア・コミュニケーション研究院|国際広報メディア・観光学院]] : [https://twitter.com/IMSCTS_HU @IMSCTS_HU]<br />
* 北海道大学[[理学部]] : [https://twitter.com/Science_HU/ @Science_HU]<br />
* 北海道大学理学部[[物理学科]] : [https://twitter.com/phys_scihokudai @phys_scihokudai]<br />
* 北大理学部[[化学科]] : [https://twitter.com/Chem_HokkaidoU @Chem_HokkaidoU]<br />
* 【公式】北海道大学[[工学部]]広報室 : [https://twitter.com/hu_eng @hu_eng]<br />
* 北海道大学 [[応用化学コース]] : [https://twitter.com/apchem_hokudai @apchem_hokudai]<br />
* 北海道大学大学院[[環境科学院・地球環境科学研究院|環境科学院]]地球圏科学専攻 : [https://twitter.com/ess_ees_hu @ess_ees_hu]<br />
* [[おしょろ丸|Oshoro-maru]] Hokudai : [https://twitter.com/oshorohokudai @oshorohokudai]<br />
<br />
== 同窓会 ==<br />
* 北海道大学 [[校友会エルム]] : [https://twitter.com/alumni_hokudai @alumni_hokudai]<br />
* [[北水同窓会]] : [https://twitter.com/HokusuiD @HokusuiD]<br />
* 北大東京同窓会 : [https://twitter.com/tokyoelm @tokyoelm]<br />
<br />
== 生協 ==<br />
* 北海道大学[[生活協同組合]](北大生協) : [https://twitter.com/HU_COOP_KK @HU_COOP_KK]<br />
* 北大生協 北部店 : [https://twitter.com/hokubucoop @hokubucoop]<br />
* 北大生協 中央購買 : [https://twitter.com/chuohcoop @chuohcoop]<br />
* 北大生協水産学部店 : [https://twitter.com/suisancoop @suisancoop]<br />
* 北大生協学生委員会 : [https://twitter.com/HU_COOP_GI_CS @HU_COOP_GI_CS]<br />
* 北大生協院生委員会 : [https://twitter.com/Hokudainsei_coo @Hokudainsei_coo]<br />
<br />
== 学生支援 ==<br />
* 北海道大学ラーニングサポート室 : [https://twitter.com/LSO_Hokudai @LSO_Hokudai]<br />
* 北海道大学 学生相談室 : [https://twitter.com/Hoku_Gakusou @Hoku_Gakusou]<br />
* 北海道大学学生相談ピアサポート : [https://twitter.com/peersupport_HU @peersupport_HU]<br />
* 北海道大学キャリアセンター : [https://twitter.com/hokudai_career @hokudai_career]<br />
* 北海道大学キャリアセンター公務員担当 : [https://twitter.com/hokudai_KOUMUIN @hokudai_KOUMUIN]<br />
* 北海道大学S-cubic 博士のキャリア支援 : [https://twitter.com/HokudaiDCcareer @HokudaiDCcareer]<br />
* 北海道大学[[保健センター]] : [https://twitter.com/tniSh5zqlQDmcXA @tniSh5zqlQDmcXA]<br />
<br />
== 研究機関 ==<br />
* [[CoSTEP]] : [https://twitter.com/costep_pr @costep_pr]<br />
* 北海道大学オープンエデュケーションセンター : [https://twitter.com/OEC_Hokudai @OEC_Hokudai]<br />
* 北海道大学[[URAステーション]] : [https://twitter.com/hokudai_ura @hokudai_ura]<br />
* 北方研究教育センター : [https://twitter.com/cnh_hokudai @cnh_hokudai]<br />
* 教養深化プログラム【北海道大学】 : [https://twitter.com/cuenp_hokudai @cuenp_hokudai]<br />
* Hokkaido University ICReDD : [https://twitter.com/ICReDDconnect @ICReDDconnect]<br />
* [[Modern Japanese Studies Program|MJSP]], Hokkaido University : [https://twitter.com/MJSP_Hokkaido @MJSP_Hokkaido]<br />
* [[Hokkaido Summer Institute]] : [https://twitter.com/Hokkaido_SI @Hokkaido_SI]<br />
* ARC-HU(北大北極域研究センター) : [https://twitter.com/ARC_HokkaidoU @ARC_HokkaidoU]<br />
* SRC-Hokudai : [https://twitter.com/SRC_Hokudai @SRC_Hokudai]<br />
* Institute for Catalysis (ICAT) / 北海道大学[[触媒科学研究所]] : [https://twitter.com/ICAT_Hokudai @ICAT_Hokudai]<br />
* 北海道大学 人間知・脳・AI研究教育センター / CHAIN, Hokkaido Univ : [https://twitter.com/ChainHokudai @ChainHokudai]<br />
* 北海道大学DEI推進本部 ダイバーシティ・インクルージョン : [https://twitter.com/HokudaiDEI @HokudaiDEI]<br />
* 北大大学院教育改革推進室@大学院生×社会を生み出す : [https://twitter.com/grad_hokudai @grad_hokudai]<br />
* hokudai.coi.next : [https://twitter.com/hokudai_coinext @hokudai_coinext]<br />
<br />
== 図書館 ==<br />
* 北海道大学[[附属図書館]](Hokkaido University Library) : [https://twitter.com/Hokudai_Library @Hokudai_Library]<br />
* 北水図書館(函館) : [https://twitter.com/Hokusui_T @Hokusui_T]<br />
* 新書交流プログラム : [https://twitter.com/with_new_books @with_new_books]<br />
<br />
== 博物館 ==<br />
* 北大[[総合博物館|博物館]] 地球展示室 : [https://twitter.com/hokudai_museum @hokudai_museum]<br />
* 北海道大学総合博物館陸上植物標本庫(SAPS) : [https://twitter.com/Herb_SAPS @Herb_SAPS]<br />
* 北大[[獣医学部|獣医]] 標本展示室 : [https://twitter.com/vetspecimen @vetspecimen]<br />
* 北海道大学[[植物園]]【公式】 : [https://twitter.com/HokkaidoUniv_bg @HokkaidoUniv_bg]<br />
* (ハコダテ)北大総合博 水産科学館 : [https://twitter.com/FSC_HOUM @FSC_HOUM]<br />
<br />
== 病院 ==<br />
* 北海道大学小児科【公式】 : [https://twitter.com/Hokudai_Ped @Hokudai_Ped]<br />
* [[北大病院|北海道大学病院]] 救急科 : [https://twitter.com/hokudai_qq @hokudai_qq]<br />
* 北大栄養 : [https://twitter.com/nmchuhp @nmchuhp]<br />
* 北海道大学呼吸器外科 : [https://twitter.com/Hokudai_TS @Hokudai_TS]<br />
* 北海道大学整形外科学教室 : [https://twitter.com/hokudai_seikei @hokudai_seikei]<br />
* 北大 消化器内科 : [https://twitter.com/QyLtZz66unEDFF6 @QyLtZz66unEDFF6]<br />
* 北海道大学大学院医学研究院眼科学教室 : [https://twitter.com/eye_med_hokudai @eye_med_hokudai]<br />
<br />
== その他 ==<br />
* [[いいね!Hokudai]] : [https://twitter.com/like_hokudai @like_hokudai]<br />
* [[北海道大学出版会]] : [https://twitter.com/Hokkaido_UP @Hokkaido_UP]<br />
* [[北大マルシェ]] Café&Labo : [https://twitter.com/marchecafe @marchecafe]<br />
* [[北大祭]]事務局 : [https://twitter.com/HOKUDAISAI @HOKUDAISAI]<br />
* 北海道大学[[体育会]] : [https://twitter.com/H_U_A_U @H_U_A_U]<br />
* 北大[[恵迪寮]] : [https://twitter.com/Keiteki_ryo @Keiteki_ryo]<br />
* 北大[[金葉祭]] : [https://twitter.com/konyousai @konyousai]<br />
* [[札幌市時計台|時計台]]サロン~[[農学部]]に聞いてみよう~ : [https://twitter.com/clocktowersalon @clocktowersalon]<br />
<br />
== 関連項目 ==<br />
* [[公式Twitterアカウント]]<br />
* [[北大ツイッター界隈]]<br />
* [[公式Threads一覧]]<br />
<br />
{{DEFAULTSORT:こうしきついつたあいちらん}}<br />
[[Category:お役立ち情報]]<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E4%B8%80%E8%A6%A7&diff=4336
公式X一覧
2023-08-02T15:51:38Z
<p>MasterWiki: 153.211.184.131 (トーク) による編集を 153.174.182.177 による直前の版へ差し戻しました</p>
<hr />
<div>この項目では公式運営のTwitterアカウントを一覧にする。<br />
<br />
== 全学 ==<br />
* 北海道大学 : [https://twitter.com/HokkaidoUnivPR @HokkaidoUnivPR]<br />
* Hokkaido University : [https://twitter.com/HokkaidoUni @HokkaidoUni]<br />
<br />
== 学部 ==<br />
* 北海道大学[[文学部|文学研究院・文学院・文学部]] : [https://twitter.com/HU_Bungaku @HU_Bungaku]<br />
* 北大日本古典文化論研究室(公式) : [https://twitter.com/hokudainichibun @hokudainichibun]<br />
* 北海道大学[[公共政策大学院・公共政策学教育部・公共政策学連携研究部|公共政策大学院]] : [https://twitter.com/HokudaiHOPS @HokudaiHOPS]<br />
* 北海道大学[[国際広報メディア・観光学院 メディア・コミュニケーション研究院|国際広報メディア・観光学院]] : [https://twitter.com/IMSCTS_HU @IMSCTS_HU]<br />
* 北海道大学[[理学部]] : [https://twitter.com/Science_HU/ @Science_HU]<br />
* 北海道大学理学部[[物理学科]] : [https://twitter.com/phys_scihokudai @phys_scihokudai]<br />
* 北大理学部[[化学科]] : [https://twitter.com/Chem_HokkaidoU @Chem_HokkaidoU]<br />
* 【公式】北海道大学[[工学部]]広報室 : [https://twitter.com/hu_eng @hu_eng]<br />
* 北海道大学 [[応用化学コース]] : [https://twitter.com/apchem_hokudai @apchem_hokudai]<br />
* 北海道大学大学院[[環境科学院・地球環境科学研究院|環境科学院]]地球圏科学専攻 : [https://twitter.com/ess_ees_hu @ess_ees_hu]<br />
* [[おしょろ丸|Oshoro-maru]] Hokudai : [https://twitter.com/oshorohokudai @oshorohokudai]<br />
<br />
== 同窓会 ==<br />
* 北海道大学 [[校友会エルム]] : [https://twitter.com/alumni_hokudai @alumni_hokudai]<br />
* [[北水同窓会]] : [https://twitter.com/HokusuiD @HokusuiD]<br />
* 北大東京同窓会 : [https://twitter.com/tokyoelm @tokyoelm]<br />
<br />
== 生協 ==<br />
* 北海道大学[[生活協同組合]](北大生協) : [https://twitter.com/HU_COOP_KK @HU_COOP_KK]<br />
* 北大生協 北部店 : [https://twitter.com/hokubucoop @hokubucoop]<br />
* 北大生協 中央購買 : [https://twitter.com/chuohcoop @chuohcoop]<br />
* 北大生協水産学部店 : [https://twitter.com/suisancoop @suisancoop]<br />
* 北大生協学生委員会 : [https://twitter.com/HU_COOP_GI_CS @HU_COOP_GI_CS]<br />
* 北大生協院生委員会 : [https://twitter.com/Hokudainsei_coo @Hokudainsei_coo]<br />
<br />
== 学生支援 ==<br />
* 北海道大学ラーニングサポート室 : [https://twitter.com/LSO_Hokudai @LSO_Hokudai]<br />
* 北海道大学 学生相談室 : [https://twitter.com/Hoku_Gakusou @Hoku_Gakusou]<br />
* 北海道大学学生相談ピアサポート : [https://twitter.com/peersupport_HU @peersupport_HU]<br />
* 北海道大学キャリアセンター : [https://twitter.com/hokudai_career @hokudai_career]<br />
* 北海道大学キャリアセンター公務員担当 : [https://twitter.com/hokudai_KOUMUIN @hokudai_KOUMUIN]<br />
* 北海道大学S-cubic 博士のキャリア支援 : [https://twitter.com/HokudaiDCcareer @HokudaiDCcareer]<br />
* 北海道大学[[保健センター]] : [https://twitter.com/tniSh5zqlQDmcXA @tniSh5zqlQDmcXA]<br />
<br />
== 研究機関 ==<br />
* [[CoSTEP]] : [https://twitter.com/costep_pr @costep_pr]<br />
* 北海道大学オープンエデュケーションセンター : [https://twitter.com/OEC_Hokudai @OEC_Hokudai]<br />
* 北海道大学[[URAステーション]] : [https://twitter.com/hokudai_ura @hokudai_ura]<br />
* 北方研究教育センター : [https://twitter.com/cnh_hokudai @cnh_hokudai]<br />
* 教養深化プログラム【北海道大学】 : [https://twitter.com/cuenp_hokudai @cuenp_hokudai]<br />
* Hokkaido University ICReDD : [https://twitter.com/ICReDDconnect @ICReDDconnect]<br />
* [[Modern Japanese Studies Program|MJSP]], Hokkaido University : [https://twitter.com/MJSP_Hokkaido @MJSP_Hokkaido]<br />
* [[Hokkaido Summer Institute]] : [https://twitter.com/Hokkaido_SI @Hokkaido_SI]<br />
* ARC-HU(北大北極域研究センター) : [https://twitter.com/ARC_HokkaidoU @ARC_HokkaidoU]<br />
* SRC-Hokudai : [https://twitter.com/SRC_Hokudai @SRC_Hokudai]<br />
* Institute for Catalysis (ICAT) / 北海道大学[[触媒科学研究所]] : [https://twitter.com/ICAT_Hokudai @ICAT_Hokudai]<br />
* 北海道大学 人間知・脳・AI研究教育センター / CHAIN, Hokkaido Univ : [https://twitter.com/ChainHokudai @ChainHokudai]<br />
* 北海道大学DEI推進本部 ダイバーシティ・インクルージョン : [https://twitter.com/HokudaiDEI @HokudaiDEI]<br />
* 北大大学院教育改革推進室@大学院生×社会を生み出す : [https://twitter.com/grad_hokudai @grad_hokudai]<br />
* hokudai.coi.next : [https://twitter.com/hokudai_coinext @hokudai_coinext]<br />
<br />
== 図書館 ==<br />
* 北海道大学[[附属図書館]](Hokkaido University Library) : [https://twitter.com/Hokudai_Library @Hokudai_Library]<br />
* 北水図書館(函館) : [https://twitter.com/Hokusui_T @Hokusui_T]<br />
* 新書交流プログラム : [https://twitter.com/with_new_books @with_new_books]<br />
<br />
== 博物館 ==<br />
* 北大[[総合博物館|博物館]] 地球展示室 : [https://twitter.com/hokudai_museum @hokudai_museum]<br />
* 北海道大学総合博物館陸上植物標本庫(SAPS) : [https://twitter.com/Herb_SAPS @Herb_SAPS]<br />
* 北大[[獣医学部|獣医]] 標本展示室 : [https://twitter.com/vetspecimen @vetspecimen]<br />
* 北海道大学[[植物園]]【公式】 : [https://twitter.com/HokkaidoUniv_bg @HokkaidoUniv_bg]<br />
* (ハコダテ)北大総合博 水産科学館 : [https://twitter.com/FSC_HOUM @FSC_HOUM]<br />
<br />
== 病院 ==<br />
* 北海道大学小児科【公式】 : [https://twitter.com/Hokudai_Ped @Hokudai_Ped]<br />
* [[北大病院|北海道大学病院]] 救急科 : [https://twitter.com/hokudai_qq @hokudai_qq]<br />
* 北大栄養 : [https://twitter.com/nmchuhp @nmchuhp]<br />
* 北海道大学呼吸器外科 : [https://twitter.com/Hokudai_TS @Hokudai_TS]<br />
* 北海道大学整形外科学教室 : [https://twitter.com/hokudai_seikei @hokudai_seikei]<br />
* 北大 消化器内科 : [https://twitter.com/QyLtZz66unEDFF6 @QyLtZz66unEDFF6]<br />
* 北海道大学大学院医学研究院眼科学教室 : [https://twitter.com/eye_med_hokudai @eye_med_hokudai]<br />
<br />
== その他 ==<br />
* [[いいね!Hokudai]] : [https://twitter.com/like_hokudai @like_hokudai]<br />
* [[北海道大学出版会]] : [https://twitter.com/Hokkaido_UP @Hokkaido_UP]<br />
* [[北大マルシェ]] Café&Labo : [https://twitter.com/marchecafe @marchecafe]<br />
* [[北大祭]]事務局 : [https://twitter.com/HOKUDAISAI @HOKUDAISAI]<br />
* 北海道大学[[体育会]] : [https://twitter.com/H_U_A_U @H_U_A_U]<br />
* 北大[[恵迪寮]] : [https://twitter.com/Keiteki_ryo @Keiteki_ryo]<br />
* 北大[[金葉祭]] : [https://twitter.com/konyousai @konyousai]<br />
* [[札幌市時計台|時計台]]サロン~[[農学部]]に聞いてみよう~ : [https://twitter.com/clocktowersalon @clocktowersalon]<br />
<br />
== 関連項目 ==<br />
* [[公式Twitterアカウント]]<br />
* [[北大ツイッター界隈]]<br />
* [[公式Threads一覧]]<br />
<br />
{{DEFAULTSORT:こうしきついつたあいちらん}}<br />
[[Category:お役立ち情報]]<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E4%B8%80%E8%A6%A7(%E5%B1%A5%E6%AD%B4%E4%B8%8D%E7%B6%99%E6%89%BF%E3%81%AB%E4%BC%B4%E3%81%86%E5%89%8A%E9%99%A4%E4%BA%88%E5%AE%9A)&diff=4335
公式X一覧(履歴不継承に伴う削除予定)
2023-08-02T15:51:20Z
<p>MasterWiki: MasterWiki がページ「公式X一覧」を「公式X一覧(履歴不継承に伴う削除予定)」に、リダイレクトを残さずに移動しました</p>
<hr />
<div>この項目では公式運営のX(Twitter)アカウントを一覧にする。<br />
<br />
== 全学 ==<br />
* 北海道大学 : [https://twitter.com/HokkaidoUnivPR @HokkaidoUnivPR]<br />
* Hokkaido University : [https://twitter.com/HokkaidoUni @HokkaidoUni]<br />
<br />
== 学部 ==<br />
* 北海道大学[[文学部|文学研究院・文学院・文学部]] : [https://twitter.com/HU_Bungaku @HU_Bungaku]<br />
* 北大日本古典文化論研究室(公式) : [https://twitter.com/hokudainichibun @hokudainichibun]<br />
* 北海道大学[[公共政策大学院・公共政策学教育部・公共政策学連携研究部|公共政策大学院]] : [https://twitter.com/HokudaiHOPS @HokudaiHOPS]<br />
* 北海道大学[[国際広報メディア・観光学院 メディア・コミュニケーション研究院|国際広報メディア・観光学院]] : [https://twitter.com/IMSCTS_HU @IMSCTS_HU]<br />
* 北海道大学[[理学部]] : [https://twitter.com/Science_HU/ @Science_HU]<br />
* 北海道大学理学部[[物理学科]] : [https://twitter.com/phys_scihokudai @phys_scihokudai]<br />
* 北大理学部[[化学科]] : [https://twitter.com/Chem_HokkaidoU @Chem_HokkaidoU]<br />
* 【公式】北海道大学[[工学部]]広報室 : [https://twitter.com/hu_eng @hu_eng]<br />
* 北海道大学 [[応用化学コース]] : [https://twitter.com/apchem_hokudai @apchem_hokudai]<br />
* 北海道大学大学院[[環境科学院・地球環境科学研究院|環境科学院]]地球圏科学専攻 : [https://twitter.com/ess_ees_hu @ess_ees_hu]<br />
* [[おしょろ丸|Oshoro-maru]] Hokudai : [https://twitter.com/oshorohokudai @oshorohokudai]<br />
<br />
== 同窓会 ==<br />
* 北海道大学 [[校友会エルム]] : [https://twitter.com/alumni_hokudai @alumni_hokudai]<br />
* [[北水同窓会]] : [https://twitter.com/HokusuiD @HokusuiD]<br />
* 北大東京同窓会 : [https://twitter.com/tokyoelm @tokyoelm]<br />
<br />
== 生協 ==<br />
* 北海道大学[[生活協同組合]](北大生協) : [https://twitter.com/HU_COOP_KK @HU_COOP_KK]<br />
* 北大生協 北部店 : [https://twitter.com/hokubucoop @hokubucoop]<br />
* 北大生協 中央購買 : [https://twitter.com/chuohcoop @chuohcoop]<br />
* 北大生協水産学部店 : [https://twitter.com/suisancoop @suisancoop]<br />
* 北大生協学生委員会 : [https://twitter.com/HU_COOP_GI_CS @HU_COOP_GI_CS]<br />
* 北大生協院生委員会 : [https://twitter.com/Hokudainsei_coo @Hokudainsei_coo]<br />
<br />
== 学生支援 ==<br />
* 北海道大学ラーニングサポート室 : [https://twitter.com/LSO_Hokudai @LSO_Hokudai]<br />
* 北海道大学 学生相談室 : [https://twitter.com/Hoku_Gakusou @Hoku_Gakusou]<br />
* 北海道大学学生相談ピアサポート : [https://twitter.com/peersupport_HU @peersupport_HU]<br />
* 北海道大学キャリアセンター : [https://twitter.com/hokudai_career @hokudai_career]<br />
* 北海道大学キャリアセンター公務員担当 : [https://twitter.com/hokudai_KOUMUIN @hokudai_KOUMUIN]<br />
* 北海道大学S-cubic 博士のキャリア支援 : [https://twitter.com/HokudaiDCcareer @HokudaiDCcareer]<br />
* 北海道大学[[保健センター]] : [https://twitter.com/tniSh5zqlQDmcXA @tniSh5zqlQDmcXA]<br />
<br />
== 研究機関 ==<br />
* [[CoSTEP]] : [https://twitter.com/costep_pr @costep_pr]<br />
* 北海道大学オープンエデュケーションセンター : [https://twitter.com/OEC_Hokudai @OEC_Hokudai]<br />
* 北海道大学[[URAステーション]] : [https://twitter.com/hokudai_ura @hokudai_ura]<br />
* 北方研究教育センター : [https://twitter.com/cnh_hokudai @cnh_hokudai]<br />
* 教養深化プログラム【北海道大学】 : [https://twitter.com/cuenp_hokudai @cuenp_hokudai]<br />
* Hokkaido University ICReDD : [https://twitter.com/ICReDDconnect @ICReDDconnect]<br />
* [[Modern Japanese Studies Program|MJSP]], Hokkaido University : [https://twitter.com/MJSP_Hokkaido @MJSP_Hokkaido]<br />
* [[Hokkaido Summer Institute]] : [https://twitter.com/Hokkaido_SI @Hokkaido_SI]<br />
* ARC-HU(北大北極域研究センター) : [https://twitter.com/ARC_HokkaidoU @ARC_HokkaidoU]<br />
* SRC-Hokudai : [https://twitter.com/SRC_Hokudai @SRC_Hokudai]<br />
* Institute for Catalysis (ICAT) / 北海道大学[[触媒科学研究所]] : [https://twitter.com/ICAT_Hokudai @ICAT_Hokudai]<br />
* 北海道大学 人間知・脳・AI研究教育センター / CHAIN, Hokkaido Univ : [https://twitter.com/ChainHokudai @ChainHokudai]<br />
* 北海道大学DEI推進本部 ダイバーシティ・インクルージョン : [https://twitter.com/HokudaiDEI @HokudaiDEI]<br />
* 北大大学院教育改革推進室@大学院生×社会を生み出す : [https://twitter.com/grad_hokudai @grad_hokudai]<br />
* [[COI&NEXT|hokudai.coi.next]] : [https://twitter.com/hokudai_coinext @hokudai_coinext]<br />
<br />
== 図書館 ==<br />
* 北海道大学[[附属図書館]](Hokkaido University Library) : [https://twitter.com/Hokudai_Library @Hokudai_Library]<br />
* 北水図書館(函館) : [https://twitter.com/Hokusui_T @Hokusui_T]<br />
* 新書交流プログラム : [https://twitter.com/with_new_books @with_new_books]<br />
<br />
== 博物館 ==<br />
* 北大[[総合博物館|博物館]] 地球展示室 : [https://twitter.com/hokudai_museum @hokudai_museum]<br />
* 北海道大学総合博物館陸上植物標本庫(SAPS) : [https://twitter.com/Herb_SAPS @Herb_SAPS]<br />
* 北大[[獣医学部|獣医]] 標本展示室 : [https://twitter.com/vetspecimen @vetspecimen]<br />
* 北海道大学[[植物園]]【公式】 : [https://twitter.com/HokkaidoUniv_bg @HokkaidoUniv_bg]<br />
* (ハコダテ)北大総合博 水産科学館 : [https://twitter.com/FSC_HOUM @FSC_HOUM]<br />
<br />
== 病院 ==<br />
* 北海道大学小児科【公式】 : [https://twitter.com/Hokudai_Ped @Hokudai_Ped]<br />
* [[北大病院|北海道大学病院]] 救急科 : [https://twitter.com/hokudai_qq @hokudai_qq]<br />
* 北大栄養 : [https://twitter.com/nmchuhp @nmchuhp]<br />
* 北海道大学呼吸器外科 : [https://twitter.com/Hokudai_TS @Hokudai_TS]<br />
* 北海道大学整形外科学教室 : [https://twitter.com/hokudai_seikei @hokudai_seikei]<br />
* 北大 消化器内科 : [https://twitter.com/QyLtZz66unEDFF6 @QyLtZz66unEDFF6]<br />
* 北海道大学大学院医学研究院眼科学教室 : [https://twitter.com/eye_med_hokudai @eye_med_hokudai]<br />
<br />
== その他 ==<br />
* [[いいね!Hokudai]] : [https://twitter.com/like_hokudai @like_hokudai]<br />
* [[北海道大学出版会]] : [https://twitter.com/Hokkaido_UP @Hokkaido_UP]<br />
* [[北大マルシェ]] Café&Labo : [https://twitter.com/marchecafe @marchecafe]<br />
* [[北大祭]]事務局 : [https://twitter.com/HOKUDAISAI @HOKUDAISAI]<br />
* 北海道大学[[体育会]] : [https://twitter.com/H_U_A_U @H_U_A_U]<br />
* 北大[[恵迪寮]] : [https://twitter.com/Keiteki_ryo @Keiteki_ryo]<br />
* 北大[[金葉祭]] : [https://twitter.com/konyousai @konyousai]<br />
* [[札幌市時計台|時計台]]サロン~[[農学部]]に聞いてみよう~ : [https://twitter.com/clocktowersalon @clocktowersalon]<br />
<br />
== 関連項目 ==<br />
* [[公式Xアカウント]]<br />
* [[北大ツイッター界隈]]<br />
* [[公式Threads一覧]]<br />
<br />
{{DEFAULTSORT:こうしきえつくすいちらん}}<br />
[[Category:お役立ち情報]]<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FTwitter%E3%82%A2%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88&diff=4334
公式Twitterアカウント
2023-08-02T15:50:10Z
<p>MasterWiki: MasterWiki がページ「公式Twitterアカウント」を「公式Xアカウント」に移動しました: Twitterの名称変更に伴う記事名変更</p>
<hr />
<div>#転送 [[公式Xアカウント]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E3%82%A2%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88&diff=4333
公式Xアカウント
2023-08-02T15:50:10Z
<p>MasterWiki: MasterWiki がページ「公式Twitterアカウント」を「公式Xアカウント」に移動しました: Twitterの名称変更に伴う記事名変更</p>
<hr />
<div>'''公式Twitterアカウント'''(こうしきツイッターアカウント)は大学当局が開設した北大の公式Twitterアカウント。日本語版アカウントと英語版アカウントがある。<br />
<br />
== 英語版 ==<br />
先に開設されたのは英語版アカウントである。内容は部局のニュース、イベント情報、留学生向け情報、北大で学びたい外国人向け情報などである。また、他の部局の公式アカウントに投稿された注目記事や[[体育会]]系部活の活躍をリツイートする場合も多い。<br />
<br />
フォロワー数は、2018年12月の時点で2600名だったが、2019年9月に5000フォロワーを達成した。<br />
特別学生の[[onちゃん]]の11万フォロワーという極端なケースはあるが、フォロワー5000人は北大関係のTwitterアカウントとしてはフォロワー数が多い部類に入る。<br />
2021年1月現在では7500フォロワーに達している。<br />
<br />
=== Tuesday Trivia ===<br />
かつて毎週火曜日に「Tuesday Trivia」が投稿され、名物であった。これは北大に関わる豆知識を4択クイズ形式、または○×クイズ形式で出題するものである。戦前~昭和時代までの歴史に関するクイズ、北大の国際性に関するクイズが多い。<br />
[[北大構内で会える生物]]の多様性から、北大の[[牛]]に関するクイズもみられる。2019年の[[北大祭]]の直前には、[[ふっとう君]]に関するクイズが出題された。北大生の中には、今週の「Tuesday Trivia」でどのジャンルのクイズが出題されるかを予想する人もいる。<br />
<br />
翌水曜日に正解が発表される。しかし、公式Instagramアカウント開設以降、火曜日のうちに公式Instagramアカウントでネタバレをするようになった。<br />
<br />
最も正解率が低かったのは、2020年8月25日出題のものである。「Hokkaido University Botanic Garden has a museum. True or false?」という2択問題にTrueが85.4%の回答を集めたが、答えはFalseであった。[[植物園]]内に博物館は3館あり1館ではないからという理由である。<br />
{{#widget:Tweet|id=1298078387387285505}}<br />
<br />
== 日本語版 ==<br />
英語版アカウントだけ開設されていた当時は、英語版アカウントの存在を知らずに北大の「日本語の」公式Twitterアカウント開設の要望も見られた。<br />
<br />
令和元年10月1日、ついに北大の日本語版公式アカウントが開設された。<br />
<br />
内容は、現状は公式ホームページの新着情報の紹介やリンク掲載にとどまっており、さらなる内容の充実が期待される。<br />
<br />
2022年12月現在は10800フォロワー程度いる。同月での大学公式アカウントのTwitterフォロワー数ランキングは、国立大学編で12位であった。<br />
<br />
令和4年度[[前期入試]]の合格発表の当日の告知ツイートで「春から北大」ハッシュタグを使用した。<br />
<br />
== アカウント ==<br />
* https://twitter.com/HokkaidoUni : (英語版)<br />
* https://twitter.com/HokkaidoUnivPR : (日本語版)<br />
<br />
== 関連項目 ==<br />
* [[理学部]] : 理学部としての公式アカウントを運営しており、たまにバズっている。<br />
<br />
{{DEFAULTSORT:こうしきついつたああかうんと}}<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E3%82%A2%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88&diff=4332
公式Xアカウント
2023-08-02T15:49:35Z
<p>MasterWiki: 153.211.184.131 (トーク) による編集を 153.174.254.86 による直前の版へ差し戻しました</p>
<hr />
<div>'''公式Twitterアカウント'''(こうしきツイッターアカウント)は大学当局が開設した北大の公式Twitterアカウント。日本語版アカウントと英語版アカウントがある。<br />
<br />
== 英語版 ==<br />
先に開設されたのは英語版アカウントである。内容は部局のニュース、イベント情報、留学生向け情報、北大で学びたい外国人向け情報などである。また、他の部局の公式アカウントに投稿された注目記事や[[体育会]]系部活の活躍をリツイートする場合も多い。<br />
<br />
フォロワー数は、2018年12月の時点で2600名だったが、2019年9月に5000フォロワーを達成した。<br />
特別学生の[[onちゃん]]の11万フォロワーという極端なケースはあるが、フォロワー5000人は北大関係のTwitterアカウントとしてはフォロワー数が多い部類に入る。<br />
2021年1月現在では7500フォロワーに達している。<br />
<br />
=== Tuesday Trivia ===<br />
かつて毎週火曜日に「Tuesday Trivia」が投稿され、名物であった。これは北大に関わる豆知識を4択クイズ形式、または○×クイズ形式で出題するものである。戦前~昭和時代までの歴史に関するクイズ、北大の国際性に関するクイズが多い。<br />
[[北大構内で会える生物]]の多様性から、北大の[[牛]]に関するクイズもみられる。2019年の[[北大祭]]の直前には、[[ふっとう君]]に関するクイズが出題された。北大生の中には、今週の「Tuesday Trivia」でどのジャンルのクイズが出題されるかを予想する人もいる。<br />
<br />
翌水曜日に正解が発表される。しかし、公式Instagramアカウント開設以降、火曜日のうちに公式Instagramアカウントでネタバレをするようになった。<br />
<br />
最も正解率が低かったのは、2020年8月25日出題のものである。「Hokkaido University Botanic Garden has a museum. True or false?」という2択問題にTrueが85.4%の回答を集めたが、答えはFalseであった。[[植物園]]内に博物館は3館あり1館ではないからという理由である。<br />
{{#widget:Tweet|id=1298078387387285505}}<br />
<br />
== 日本語版 ==<br />
英語版アカウントだけ開設されていた当時は、英語版アカウントの存在を知らずに北大の「日本語の」公式Twitterアカウント開設の要望も見られた。<br />
<br />
令和元年10月1日、ついに北大の日本語版公式アカウントが開設された。<br />
<br />
内容は、現状は公式ホームページの新着情報の紹介やリンク掲載にとどまっており、さらなる内容の充実が期待される。<br />
<br />
2022年12月現在は10800フォロワー程度いる。同月での大学公式アカウントのTwitterフォロワー数ランキングは、国立大学編で12位であった。<br />
<br />
令和4年度[[前期入試]]の合格発表の当日の告知ツイートで「春から北大」ハッシュタグを使用した。<br />
<br />
== アカウント ==<br />
* https://twitter.com/HokkaidoUni : (英語版)<br />
* https://twitter.com/HokkaidoUnivPR : (日本語版)<br />
<br />
== 関連項目 ==<br />
* [[理学部]] : 理学部としての公式アカウントを運営しており、たまにバズっている。<br />
<br />
{{DEFAULTSORT:こうしきついつたああかうんと}}<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E5%85%AC%E5%BC%8FX%E3%82%A2%E3%82%AB%E3%82%A6%E3%83%B3%E3%83%88(%E5%B1%A5%E6%AD%B4%E4%B8%8D%E7%B6%99%E6%89%BF%E3%81%AB%E4%BC%B4%E3%81%86%E5%89%8A%E9%99%A4%E4%BA%88%E5%AE%9A)&diff=4331
公式Xアカウント(履歴不継承に伴う削除予定)
2023-08-02T15:48:59Z
<p>MasterWiki: MasterWiki がページ「公式Xアカウント」を「公式Xアカウント(履歴不継承に伴う削除予定)」に、リダイレクトを残さずに移動しました</p>
<hr />
<div>'''公式Xアカウント'''(こうしきエックスアカウント)は大学当局が開設した北大の公式X(Twitter)アカウント。日本語版アカウントと英語版アカウントがある。<br />
<br />
== 英語版 ==<br />
先に開設されたのは英語版アカウントである。内容は部局のニュース、イベント情報、留学生向け情報、北大で学びたい外国人向け情報などである。また、他の部局の公式アカウントに投稿された注目記事や[[体育会]]系部活の活躍をリツイートする場合も多い。<br />
<br />
フォロワー数は、2018年12月の時点で2600名だったが、2019年9月に5000フォロワーを達成した。<br />
特別学生の[[onちゃん]]の11万フォロワーという極端なケースはあるが、フォロワー5000人は北大関係のXアカウントとしてはフォロワー数が多い部類に入る。<br />
2021年1月現在では7500フォロワーに達している。<br />
<br />
=== Tuesday Trivia ===<br />
かつて毎週火曜日に「Tuesday Trivia」が投稿され、名物であった。これは北大に関わる豆知識を4択クイズ形式、または○×クイズ形式で出題するものである。戦前~昭和時代までの歴史に関するクイズ、北大の国際性に関するクイズが多い。<br />
[[北大構内で会える生物]]の多様性から、北大の[[牛]]に関するクイズもみられる。2019年の[[北大祭]]の直前には、[[ふっとう君]]に関するクイズが出題された。北大生の中には、今週の「Tuesday Trivia」でどのジャンルのクイズが出題されるかを予想する人もいる。<br />
<br />
翌水曜日に正解が発表される。しかし、公式Instagramアカウント開設以降、火曜日のうちに公式Instagramアカウントでネタバレをするようになった。<br />
<br />
最も正解率が低かったのは、2020年8月25日出題のものである。「Hokkaido University Botanic Garden has a museum. True or false?」という2択問題にTrueが85.4%の回答を集めたが、答えはFalseであった。[[植物園]]内に博物館は3館あり1館ではないからという理由である。<br />
{{#widget:Tweet|id=1298078387387285505}}<br />
<br />
== 日本語版 ==<br />
英語版アカウントだけ開設されていた当時は、英語版アカウントの存在を知らずに北大の「日本語の」公式Twitterアカウント開設の要望も見られた。<br />
<br />
令和元年10月1日、ついに北大の日本語版公式アカウントが開設された。<br />
<br />
内容は、現状は公式ホームページの新着情報の紹介やリンク掲載にとどまっており、さらなる内容の充実が期待される。<br />
<br />
2022年12月現在は10800フォロワー程度いる。同月での大学公式アカウントのTwitterフォロワー数ランキングは、国立大学編で12位であった。<br />
<br />
令和4年度[[前期入試]]の合格発表の当日の告知ツイートで「春から北大」ハッシュタグを使用した。<br />
<br />
== アカウント ==<br />
* https://twitter.com/HokkaidoUni : (英語版)<br />
* https://twitter.com/HokkaidoUnivPR : (日本語版)<br />
<br />
== 関連項目 ==<br />
* [[理学部]] : 理学部としての公式アカウントを運営しており、たまにバズっている。<br />
<br />
{{DEFAULTSORT:こうしきえつくすあかうんと}}<br />
[[Category:メディア]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=3454
MediaWiki:Sitenotice
2023-03-12T09:53:35Z
<p>MasterWiki: </p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_student_header468x60</htmlet><br />
<br />
<htmlet>puzzle_header</htmlet><br />
<br />
<strong>【ゲキムズ?】 [https://hokudaiwiki.net/puzzle/ 北大地図パズル]</strong><br />
<br />
<!--<br />
<strong>【メンテナンス予告】2023/01/14 0:00 より</strong><br />
メンテナンス作業のためしばらくの間、アクセスができなくなります<br />
--><br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=3320
MediaWiki:Sitenotice
2023-01-14T00:09:30Z
<p>MasterWiki: </p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_student_header468x60</htmlet><br />
<br />
<htmlet>puzzle_header</htmlet><br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 あります</strong><br />
<br />
<!--<br />
<strong>【メンテナンス予告】2023/01/14 0:00 より</strong><br />
メンテナンス作業のためしばらくの間、アクセスができなくなります<br />
--><br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=3317
MediaWiki:Sitenotice
2023-01-12T06:49:14Z
<p>MasterWiki: </p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_student_header468x60</htmlet><br />
<br />
<htmlet>puzzle_header</htmlet><br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 あります</strong><br />
<br />
<strong>【メンテナンス予告】2023/01/14 0:00 より</strong><br />
<br />
メンテナンス作業のためしばらくの間、アクセスができなくなります<br />
<br />
大学入学共通テストの間にはおわります<br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=3041
MediaWiki:Sitenotice
2022-05-29T01:27:44Z
<p>MasterWiki: バナーの調整</p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_student_header468x60</htmlet><br />
<br />
<htmlet>puzzle_header</htmlet><br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 あります</strong><br />
<!--<br />
<strong>【メンテナンス予告】2021/06/23 0:30 より</strong><br />
<br />
メンテナンス作業のため数十分程度の間、記事の編集ができなくなる見込みです<br />
--><br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=3008
MediaWiki:Hf-nsfooter-
2022-05-17T13:18:37Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<!--<br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
--><br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
<!-- | 本日 --><br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|}<br />
<br />
北大Wikiに関する[[北大Wiki:北大Wikiについて#お問い合わせ|お問い合わせはこちら]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=3007
MediaWiki:Hf-nsfooter-
2022-05-17T13:09:21Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<!--<br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
--><br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
<!-- | 本日 --><br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|}<br />
<br />
北大Wikiに関する[[北大Wiki:北大Wikiについて#お問い合わせ|お問い合わせはこちら]]<br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_popover</htmlet></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2691
MediaWiki:Hf-nsfooter-
2021-06-24T08:29:52Z
<p>MasterWiki: リンクを削除</p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<!--<br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
--><br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
<!-- | 本日 --><br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|}<br />
<br />
北大Wikiに関する[[北大Wiki:北大Wikiについて#お問い合わせ|お問い合わせはこちら]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=2679
MediaWiki:Sitenotice
2021-06-22T16:11:06Z
<p>MasterWiki: メンテナンスのアナウンスを解除</p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_header</htmlet><br />
<br />
<strong>Amazonリンククリック後、紹介商品に限らず何かを買うと北大Wikiの運営費になります</strong><br />
<br />
<!--<br />
<strong>【メンテナンス予告】2021/06/23 0:30 より</strong><br />
<br />
メンテナンス作業のため数十分程度の間、記事の編集ができなくなる見込みです<br />
--><br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}<br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 できました 挑戦者求む</strong></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=2678
MediaWiki:Sitenotice
2021-06-22T09:18:37Z
<p>MasterWiki: メンテナンスのお知らせを掲載</p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_header</htmlet><br />
<!--<br />
<strong>Amazonリンククリック後、紹介商品に限らず何かを買うと北大Wikiの運営費になります</strong><br />
--><br />
<br />
<strong>【メンテナンス予告】2021/06/23 0:30 より</strong><br />
<br />
メンテナンス作業のため数十分程度の間、記事の編集ができなくなる見込みです<br />
<br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}<br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 できました 挑戦者求む</strong></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB:hokudaiwiki_logo202105.png&diff=2646
ファイル:hokudaiwiki logo202105.png
2021-05-17T09:14:30Z
<p>MasterWiki: Produced by [https://twitter.com/intent/user?user_id=1250823791107878916 囚人], 2021</p>
<hr />
<div>== 概要 ==<br />
Produced by [https://twitter.com/intent/user?user_id=1250823791107878916 囚人], 2021<br />
== ライセンス ==<br />
{{CC BY-SA 4.0}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB:hokudaiwiki_logo2.png&diff=2626
ファイル:hokudaiwiki logo2.png
2021-05-16T08:58:04Z
<p>MasterWiki: Produced by [https://twitter.com/intent/user?user_id=1250823791107878916 囚人], 2021</p>
<hr />
<div>== 概要 ==<br />
Produced by [https://twitter.com/intent/user?user_id=1250823791107878916 囚人], 2021<br />
== ライセンス ==<br />
{{CC BY-SA 4.0}}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2528
MediaWiki:Hf-nsfooter-
2021-04-28T02:49:17Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
<!-- | 本日 --><br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|}<br />
<br />
北大Wikiに関する[[北大Wiki:北大Wikiについて#お問い合わせ|お問い合わせはこちら]]</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Sitenotice&diff=2523
MediaWiki:Sitenotice
2021-04-26T16:47:41Z
<p>MasterWiki: 北大地図パズルのお知らせ追加</p>
<hr />
<div><!--<br />
<htmlet>g_ad</htmlet><br />
<htmlet>nend</htmlet><br />
【広告タッチ1回で 0.15 円が北大Wiki運営費になります】<br />
--><br />
<htmlet>amzn_header</htmlet><br />
<br />
<strong>Amazonリンククリック後、紹介商品に限らず何かを買うと北大Wikiの運営費になります</strong><br />
<!--<br />
<strong>【メンテナンス予告】2021/02/08 22:00 より</strong><br />
<br />
この時間よりしばらく閲覧・編集等できなくなる予定です<br />
--><br />
<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/|layout=button_count}}<br />
<br />
<strong>【[https://hokudaiwiki.net/puzzle/ 北大地図パズル]】 できました 挑戦者求む</strong></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2467
MediaWiki:Hf-nsfooter-
2021-03-12T08:28:08Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
<!-- | 本日 --><br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
<!-- | style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}} --><br />
|}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2463
MediaWiki:Hf-nsfooter-
2021-03-10T00:05:45Z
<p>MasterWiki: アクセス数表示に当日のデータを追加</p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
<br />
{| class="wikitable"<br />
!colspan="4"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
| 本日<br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|0 days}}}}}}<br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|0 days}}}}}}<br />
|}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2350
MediaWiki:Hf-nsfooter-
2021-02-24T07:29:02Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
|<br />
| 全期間<br />
| 最近1週間<br />
|-<br />
| 記事「{{FULLPAGENAME}}」<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
|-<br />
| [[北大Wiki]]全体<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}}<br />
| style="text-align:right;" | {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
|}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Hf-nsfooter-&diff=2349
MediaWiki:Hf-nsfooter-
2021-02-24T06:52:40Z
<p>MasterWiki: </p>
<hr />
<div>-----------------<br />
<htmlet>tweet_button</htmlet><br />
{{#widget:Facebook Like Button|profile=https://hokudaiwiki.net/wiki/{{FULLPAGENAME}}|layout=button_count|share=true|width=180}}<br />
<br />
<!-- Google AdSense --><br />
<!-- <htmlet>g_ad</htmlet> --><br />
<br />
<!-- Amazon associates --><br />
<htmlet>amzn_footer</htmlet><br />
<br />
札幌農学校クッキーをこのリンクから買うと北大Wikiに寄付もできるし、クッキー売上の一部は北大生に向けた「きのとや奨学金」に充てられます。<br />
<br />
{| class="wikitable"<br />
!colspan="3"|北大Wikiアクセス数<br />
|-<br />
| || 全期間 || 最近1週間<br />
|-<br />
| 記事「{{FULLPAGENAME}}」 || {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}}}}} || {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|page={{FULLPAGENAME}}|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
|-<br />
| [[北大Wiki]]全体 || {{formatnum:{{#googleanalyticsmetrics: metric=pageviews}}}} || {{formatnum:{{#googleanalyticsmetrics: metric=pageviews|startDate={{#time:Y-m-d|-7 days}}}}}}<br />
|}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=MediaWiki:Common.css&diff=2329
MediaWiki:Common.css
2021-02-22T07:16:52Z
<p>MasterWiki: </p>
<hr />
<div>/* ここに記述したCSSはすべての外装に反映されます */<br />
<br />
/* To make images responsive */<br />
.res-img img {<br />
max-width:100%;<br />
height:auto;<br />
}<br />
<br />
.res-iframe {<br />
position: relative;<br />
width: 100%;<br />
padding-top: 56.25%;<br />
}<br />
<br />
.res-iframe iframe {<br />
position: absolute;<br />
top: 0;<br />
right: 0;<br />
width: 100%;<br />
height: 100%;<br />
}<br />
<br />
/* Style for horizontal lists (separator following item).<br />
@source mediawiki.org/wiki/Snippets/Horizontal_lists<br />
@revision 8 (2016-05-21)<br />
@author [[User:Edokter]]<br />
*/<br />
.hlist dl,<br />
.hlist ol,<br />
.hlist ul {<br />
margin: 0;<br />
padding: 0;<br />
}<br />
<br />
/* Display list items inline */<br />
.hlist dd,<br />
.hlist dt,<br />
.hlist li {<br />
margin: 0;<br />
display: inline;<br />
}<br />
<br />
/* Display nested lists inline */<br />
.hlist.inline,<br />
.hlist.inline dl,<br />
.hlist.inline ol,<br />
.hlist.inline ul,<br />
.hlist dl dl, .hlist dl ol, .hlist dl ul,<br />
.hlist ol dl, .hlist ol ol, .hlist ol ul,<br />
.hlist ul dl, .hlist ul ol, .hlist ul ul {<br />
display: inline;<br />
}<br />
<br />
/* Hide empty list items */<br />
.hlist .mw-empty-li {<br />
display: none;<br />
}<br />
<br />
/* Generate interpuncts */<br />
.hlist dt:after {<br />
content: ": ";<br />
}<br />
<br />
/**<br />
* Note hlist style usage differd in<br />
* the Minerva skin. Remember .hlist is a class defined in core as well! Please check Minerva desktop (and Minerva.css) when changing<br />
* See https://phabricator.wikimedia.org/T213239<br />
*/<br />
.hlist dd:after,<br />
.hlist li:after {<br />
content: " · ";<br />
font-weight: bold;<br />
}<br />
<br />
.hlist dd:last-child:after,<br />
.hlist dt:last-child:after,<br />
.hlist li:last-child:after {<br />
content: none;<br />
}<br />
<br />
/* Add parentheses around nested lists */<br />
.hlist dd dd:first-child:before, .hlist dd dt:first-child:before, .hlist dd li:first-child:before,<br />
.hlist dt dd:first-child:before, .hlist dt dt:first-child:before, .hlist dt li:first-child:before,<br />
.hlist li dd:first-child:before, .hlist li dt:first-child:before, .hlist li li:first-child:before {<br />
content: " (";<br />
font-weight: normal;<br />
}<br />
<br />
.hlist dd dd:last-child:after, .hlist dd dt:last-child:after, .hlist dd li:last-child:after,<br />
.hlist dt dd:last-child:after, .hlist dt dt:last-child:after, .hlist dt li:last-child:after,<br />
.hlist li dd:last-child:after, .hlist li dt:last-child:after, .hlist li li:last-child:after {<br />
content: ")";<br />
font-weight: normal;<br />
}<br />
<br />
/* Put ordinals in front of ordered list items */<br />
.hlist ol {<br />
counter-reset: listitem;<br />
}<br />
<br />
.hlist ol > li {<br />
counter-increment: listitem;<br />
}<br />
<br />
.hlist ol > li:before {<br />
content: " " counter(listitem) "\a0";<br />
}<br />
<br />
.hlist dd ol > li:first-child:before,<br />
.hlist dt ol > li:first-child:before,<br />
.hlist li ol > li:first-child:before {<br />
content: " (" counter(listitem) "\a0";<br />
}<br />
<br />
<br />
/* Default style for navigation boxes */<br />
.navbox { /* Navbox container style */<br />
box-sizing: border-box;<br />
border: 1px solid #a2a9b1;<br />
width: 100%;<br />
clear: both;<br />
font-size: 88%;<br />
text-align: center;<br />
padding: 1px;<br />
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */<br />
}<br />
<br />
.navbox .navbox {<br />
margin-top: 0; /* No top margin for nested navboxes */<br />
}<br />
<br />
.navbox + .navbox {<br />
margin-top: -1px; /* Single pixel border between adjacent navboxes */<br />
}<br />
<br />
.navbox-inner,<br />
.navbox-subgroup {<br />
width: 100%;<br />
}<br />
<br />
.navbox-group,<br />
.navbox-title,<br />
.navbox-abovebelow {<br />
padding: 0.25em 1em; /* Title, group and above/below styles */<br />
line-height: 1.5em;<br />
text-align: center;<br />
}<br />
<br />
th.navbox-group { /* Group style */<br />
white-space: nowrap;<br />
/* @noflip */<br />
text-align: right;<br />
}<br />
<br />
.navbox,<br />
.navbox-subgroup {<br />
background-color: #fdfdfd; /* Background color */<br />
}<br />
<br />
.navbox-list {<br />
line-height: 1.5em;<br />
border-color: #fdfdfd; /* Must match background color */<br />
}<br />
<br />
/* cell spacing for navbox cells */<br />
tr + tr > .navbox-abovebelow,<br />
tr + tr > .navbox-group,<br />
tr + tr > .navbox-image,<br />
tr + tr > .navbox-list { /* Borders above 2nd, 3rd, etc. rows */<br />
border-top: 2px solid #fdfdfd; /* Must match background color */<br />
}<br />
<br />
.navbox th,<br />
.navbox-title {<br />
background-color: #ccccff; /* Level 1 color */<br />
}<br />
<br />
.navbox-abovebelow,<br />
th.navbox-group,<br />
.navbox-subgroup .navbox-title {<br />
background-color: #ddddff; /* Level 2 color */<br />
}<br />
<br />
.navbox-subgroup .navbox-group,<br />
.navbox-subgroup .navbox-abovebelow {<br />
background-color: #e6e6ff; /* Level 3 color */<br />
}<br />
<br />
.navbox-even {<br />
background-color: #f7f7f7; /* Even row striping */<br />
}<br />
<br />
.navbox-odd {<br />
background-color: transparent; /* Odd row striping */<br />
}<br />
<br />
.navbox .hlist td dl,<br />
.navbox .hlist td ol,<br />
.navbox .hlist td ul,<br />
.navbox td.hlist dl,<br />
.navbox td.hlist ol,<br />
.navbox td.hlist ul {<br />
padding: 0.125em 0; /* Adjust hlist padding in navboxes */<br />
}<br />
<br />
/* Styling for JQuery makeCollapsible, matching that of collapseButton */<br />
.mw-parser-output .mw-collapsible-toggle {<br />
font-weight: normal;<br />
/* @noflip */<br />
text-align: right;<br />
padding-right: 0.2em;<br />
padding-left: 0.2em;<br />
}<br />
<br />
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {<br />
/* @noflip */<br />
float: left;<br />
/* @noflip */<br />
text-align: left;<br />
}<br />
<br />
/* Extension:AmazonSearch */<br />
DIV.amazonsearch {<br />
clear: both;<br />
width: 100%;<br />
margin: 0 auto;<br />
padding: 0.5em;<br />
border: 1px solid #444;<br />
overflow: hidden;<br />
}<br />
DIV.amazonsearch IMG.amazonsearchimg {<br />
float: left;<br />
margin: 0.1em 1em 0.1em 0.1em;<br />
}<br />
DIV.amazonsearch P.amazonsearchname {<br />
margin: 0;<br />
font-size: 90%;<br />
text-indent: 0;<br />
}<br />
DIV.amazonsearch P.amazonsearchauthor {<br />
margin: 0;<br />
font-size: 80%;<br />
text-indent: 0;<br />
}<br />
DIV.amazonsearch UL {<br />
margin: 0;<br />
}<br />
DIV.amazonsearch UL LI {<br />
display: inline-block;<br />
text-align: center;<br />
list-style: none;<br />
font-size: 90%;<br />
width: 12em;<br />
margin: 0.2em;<br />
padding: 0.2em 0.5em 0.2em 0.5em;<br />
border-radius: 0.5em;<br />
white-space: nowrap;<br />
}<br />
DIV.amazonsearch UL LI A {<br />
color: #fff;<br />
}<br />
DIV.amazonsearch UL LI.shoplinkamazon {<br />
background-color: #f90;<br />
}<br />
/* END Extension:AmazonSearch */<br />
<br />
/*<br />
* Content in columns with CSS instead of tables [[Template:Columns]]<br />
* 2009-02-10 by [[User:mizusumashi]]<br />
* 段組み表示の設定<br />
*/<br />
div.columns-2 div.column {<br />
float: left;<br />
width: 50%;<br />
min-width: 300px;<br />
}<br />
div.columns-3 div.column {<br />
float: left;<br />
width: 33.3%;<br />
min-width: 200px;<br />
}<br />
div.columns-4 div.column {<br />
float: left;<br />
width: 25%;<br />
min-width: 150px;<br />
}<br />
div.columns-5 div.column {<br />
float: left;<br />
width: 20%;<br />
min-width: 120px;<br />
}<br />
/*<br />
* 段組み表示の設定終わり<br />
*/<br />
<br />
/* Otheruses等の冒頭曖昧さ回避テンプレート */<br />
.dablink {<br />
margin: 0.5em 0;<br />
padding: 3px 2em;<br />
background-color: transparent;<br />
border-bottom: 1px solid #a2a9b1;<br />
font-size: 90%;<br />
}<br />
/*<br />
* Otheruses等の表示の設定終わり<br />
*/</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Math&diff=2318
モジュール:Math
2021-02-21T14:53:11Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>--[[<br />
<br />
This module provides a number of basic mathematical operations.<br />
<br />
]]<br />
<br />
local yesno, getArgs -- lazily initialized<br />
<br />
local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.<br />
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.<br />
<br />
--[[<br />
Helper functions used to avoid redundant code.<br />
]]<br />
<br />
local function err(msg)<br />
-- Generates wikitext error messages.<br />
return mw.ustring.format('<strong class="error">書式エラー: %s</strong>', msg)<br />
end<br />
<br />
local function unpackNumberArgs(args)<br />
-- Returns an unpacked list of arguments specified with numerical keys.<br />
local ret = {}<br />
for k, v in pairs(args) do<br />
if type(k) == 'number' then<br />
table.insert(ret, v)<br />
end<br />
end<br />
return unpack(ret)<br />
end<br />
<br />
local function makeArgArray(...)<br />
-- Makes an array of arguments from a list of arguments that might include nils.<br />
local args = {...} -- Table of arguments. It might contain nils or non-number values, so we can't use ipairs.<br />
local nums = {} -- Stores the numbers of valid numerical arguments.<br />
local ret = {}<br />
for k, v in pairs(args) do<br />
v = p._cleanNumber(v)<br />
if v then<br />
nums[#nums + 1] = k<br />
args[k] = v<br />
end<br />
end<br />
table.sort(nums)<br />
for i, num in ipairs(nums) do<br />
ret[#ret + 1] = args[num]<br />
end<br />
return ret<br />
end<br />
<br />
local function fold(func, ...)<br />
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,<br />
-- and must return a number as an output. This number is then supplied as input to the next function call.<br />
local vals = makeArgArray(...)<br />
local count = #vals -- The number of valid arguments<br />
if count == 0 then return<br />
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.<br />
nil, 0<br />
end<br />
local ret = table.remove(vals, 1)<br />
for _, val in ipairs(vals) do<br />
ret = func(ret, val)<br />
end<br />
return ret, count<br />
end<br />
<br />
--[[<br />
Fold arguments by selectively choosing values (func should return when to choose the current "dominant" value).<br />
]]<br />
local function binary_fold(func, ...)<br />
local value = fold((function(a, b) if func(a, b) then return a else return b end end), ...)<br />
return value<br />
end<br />
<br />
--[[<br />
random<br />
<br />
Generate a random number<br />
<br />
Usage:<br />
{{#invoke: Math | random }}<br />
{{#invoke: Math | random | maximum value }}<br />
{{#invoke: Math | random | minimum value | maximum value }}<br />
]]<br />
<br />
function wrap.random(args)<br />
local first = p._cleanNumber(args[1])<br />
local second = p._cleanNumber(args[2])<br />
return p._random(first, second)<br />
end<br />
<br />
function p._random(first, second)<br />
math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))<br />
-- math.random will throw an error if given an explicit nil parameter, so we need to use if statements to check the params.<br />
if first and second then<br />
if first <= second then -- math.random doesn't allow the first number to be greater than the second.<br />
return math.random(first, second)<br />
end<br />
elseif first then<br />
return math.random(first)<br />
else<br />
return math.random()<br />
end<br />
end<br />
<br />
--[[<br />
order<br />
<br />
Determine order of magnitude of a number<br />
<br />
Usage:<br />
{{#invoke: Math | order | value }}<br />
]]<br />
<br />
function wrap.order(args)<br />
local input_string = (args[1] or args.x or '0');<br />
local input_number = p._cleanNumber(input_string);<br />
if input_number == nil then<br />
return err('order関数に渡された引数が数字ではありません')<br />
else<br />
return p._order(input_number)<br />
end<br />
end<br />
<br />
function p._order(x)<br />
if x == 0 then return 0 end<br />
return math.floor(math.log10(math.abs(x)))<br />
end<br />
<br />
--[[<br />
precision<br />
<br />
Detemines the precision of a number using the string representation<br />
<br />
Usage:<br />
{{ #invoke: Math | precision | value }}<br />
]]<br />
<br />
function wrap.precision(args)<br />
local input_string = (args[1] or args.x or '0');<br />
local trap_fraction = args.check_fraction;<br />
local input_number;<br />
<br />
if not yesno then<br />
yesno = require('Module:Yesno')<br />
end<br />
if yesno(trap_fraction, true) then -- Returns true for all input except nil, false, "no", "n", "0" and a few others. See [[Module:Yesno]].<br />
local pos = string.find(input_string, '/', 1, true);<br />
if pos ~= nil then<br />
if string.find(input_string, '/', pos + 1, true) == nil then<br />
local denominator = string.sub(input_string, pos+1, -1);<br />
local denom_value = tonumber(denominator);<br />
if denom_value ~= nil then<br />
return math.log10(denom_value);<br />
end<br />
end<br />
end<br />
end<br />
<br />
input_number, input_string = p._cleanNumber(input_string);<br />
if input_string == nil then<br />
return err('precision関数に渡された引数が数字ではありません')<br />
else<br />
return p._precision(input_string)<br />
end<br />
end<br />
<br />
function p._precision(x)<br />
if type(x) == 'number' then<br />
x = tostring(x)<br />
end<br />
x = string.upper(x)<br />
<br />
local decimal = x:find('%.')<br />
local exponent_pos = x:find('E')<br />
local result = 0;<br />
<br />
if exponent_pos ~= nil then<br />
local exponent = string.sub(x, exponent_pos + 1)<br />
x = string.sub(x, 1, exponent_pos - 1)<br />
result = result - tonumber(exponent)<br />
end<br />
<br />
if decimal ~= nil then<br />
result = result + string.len(x) - decimal<br />
return result<br />
end<br />
<br />
local pos = string.len(x);<br />
while x:byte(pos) == string.byte('0') do<br />
pos = pos - 1<br />
result = result - 1<br />
if pos <= 0 then<br />
return 0<br />
end<br />
end<br />
<br />
return result<br />
end<br />
<br />
<br />
--[[<br />
max<br />
<br />
Finds the maximum argument<br />
<br />
Usage:<br />
{{#invoke:Math| max | value1 | value2 | ... }}<br />
<br />
Note, any values that do not evaluate to numbers are ignored.<br />
]]<br />
<br />
function wrap.max(args)<br />
return p._max(unpackNumberArgs(args))<br />
end<br />
<br />
function p._max(...)<br />
local max_value = binary_fold((function(a, b) return a > b end), ...)<br />
if max_value then<br />
return max_value<br />
end<br />
end<br />
<br />
--[[<br />
median<br />
<br />
Find the median of set of numbers<br />
<br />
Usage:<br />
{{#invoke:Math | median | number1 | number2 | ...}}<br />
OR<br />
{{#invoke:Math | median }}<br />
]]<br />
<br />
function wrap.median(args)<br />
return p._median(unpackNumberArgs(args))<br />
end<br />
<br />
function p._median(...)<br />
local vals = makeArgArray(...)<br />
local count = #vals<br />
table.sort(vals)<br />
<br />
if count == 0 then<br />
return 0<br />
end<br />
<br />
if p._mod(count, 2) == 0 then<br />
return (vals[count/2] + vals[count/2+1])/2<br />
else<br />
return vals[math.ceil(count/2)]<br />
end<br />
end<br />
<br />
--[[<br />
min<br />
<br />
Finds the minimum argument<br />
<br />
Usage:<br />
{{#invoke:Math| min | value1 | value2 | ... }}<br />
OR<br />
{{#invoke:Math| min }}<br />
<br />
When used with no arguments, it takes its input from the parent<br />
frame. Note, any values that do not evaluate to numbers are ignored.<br />
]]<br />
<br />
function wrap.min(args)<br />
return p._min(unpackNumberArgs(args))<br />
end<br />
<br />
function p._min(...)<br />
local min_value = binary_fold((function(a, b) return a < b end), ...)<br />
if min_value then<br />
return min_value<br />
end<br />
end<br />
<br />
--[[<br />
sum<br />
<br />
Finds the sum<br />
<br />
Usage:<br />
{{#invoke:Math| sum | value1 | value2 | ... }}<br />
OR<br />
{{#invoke:Math| sum }}<br />
<br />
Note, any values that do not evaluate to numbers are ignored.<br />
]]<br />
<br />
function wrap.sum(args)<br />
return p._sum(unpackNumberArgs(args))<br />
end<br />
<br />
function p._sum(...)<br />
local sums, count = fold((function(a, b) return a + b end), ...)<br />
if not sums then<br />
return 0<br />
else<br />
return sums<br />
end<br />
end<br />
<br />
--[[<br />
average<br />
<br />
Finds the average<br />
<br />
Usage:<br />
{{#invoke:Math| average | value1 | value2 | ... }}<br />
OR<br />
{{#invoke:Math| average }}<br />
<br />
Note, any values that do not evaluate to numbers are ignored.<br />
]]<br />
<br />
function wrap.average(args)<br />
return p._average(unpackNumberArgs(args))<br />
end<br />
<br />
function p._average(...)<br />
local sum, count = fold((function(a, b) return a + b end), ...)<br />
if not sum then<br />
return 0<br />
else<br />
return sum / count<br />
end<br />
end<br />
<br />
--[[<br />
round<br />
<br />
Rounds a number to specified precision<br />
<br />
Usage:<br />
{{#invoke:Math | round | value | precision }}<br />
<br />
--]]<br />
<br />
function wrap.round(args)<br />
local value = p._cleanNumber(args[1] or args.value or 0)<br />
local precision = p._cleanNumber(args[2] or args.precision or 0)<br />
if value == nil or precision == nil then<br />
return err('round関数に渡された引数が数字ではありません')<br />
else<br />
return p._round(value, precision)<br />
end<br />
end<br />
<br />
function p._round(value, precision)<br />
local rescale = math.pow(10, precision or 0);<br />
return math.floor(value * rescale + 0.5) / rescale;<br />
end<br />
<br />
--[[<br />
log10<br />
<br />
returns the log (base 10) of a number<br />
<br />
Usage:<br />
{{#invoke:Math | log10 | x }}<br />
]]<br />
<br />
function wrap.log10(args)<br />
return math.log10(args[1])<br />
end<br />
<br />
--[[<br />
mod<br />
<br />
Implements the modulo operator<br />
<br />
Usage:<br />
{{#invoke:Math | mod | x | y }}<br />
<br />
--]]<br />
<br />
function wrap.mod(args)<br />
local x = p._cleanNumber(args[1])<br />
local y = p._cleanNumber(args[2])<br />
if not x then<br />
return err('mod関数に渡された第1引数が数字ではありません')<br />
elseif not y then<br />
return err('mod関数に渡された第2引数が数字ではありません')<br />
else<br />
return p._mod(x, y)<br />
end<br />
end<br />
<br />
function p._mod(x, y)<br />
local ret = x % y<br />
if not (0 <= ret and ret < y) then<br />
ret = 0<br />
end<br />
return ret<br />
end<br />
<br />
--[[<br />
gcd<br />
<br />
Calculates the greatest common divisor of multiple numbers<br />
<br />
Usage:<br />
{{#invoke:Math | gcd | value 1 | value 2 | value 3 | ... }}<br />
--]]<br />
<br />
function wrap.gcd(args)<br />
return p._gcd(unpackNumberArgs(args))<br />
end<br />
<br />
function p._gcd(...)<br />
local function findGcd(a, b)<br />
local r = b<br />
local oldr = a<br />
while r ~= 0 do<br />
local quotient = math.floor(oldr / r)<br />
oldr, r = r, oldr - quotient * r<br />
end<br />
if oldr < 0 then<br />
oldr = oldr * -1<br />
end<br />
return oldr<br />
end<br />
local result, count = fold(findGcd, ...)<br />
return result<br />
end<br />
<br />
--[[<br />
precision_format<br />
<br />
Rounds a number to the specified precision and formats according to rules<br />
originally used for {{template:Rnd}}. Output is a string.<br />
<br />
Usage:<br />
{{#invoke: Math | precision_format | number | precision }}<br />
]]<br />
<br />
function wrap.precision_format(args)<br />
local value_string = args[1] or 0<br />
local precision = args[2] or 0<br />
return p._precision_format(value_string, precision)<br />
end<br />
<br />
function p._precision_format(value_string, precision)<br />
-- For access to Mediawiki built-in formatter.<br />
local lang = mw.getContentLanguage();<br />
<br />
local value<br />
value, value_string = p._cleanNumber(value_string)<br />
precision = p._cleanNumber(precision)<br />
<br />
-- Check for non-numeric input<br />
if value == nil or precision == nil then<br />
return err('_precision_format関数に渡された引数が不正です')<br />
end<br />
<br />
local current_precision = p._precision(value)<br />
local order = p._order(value)<br />
<br />
-- Due to round-off effects it is neccesary to limit the returned precision under<br />
-- some circumstances because the terminal digits will be inaccurately reported.<br />
if order + precision >= 14 then<br />
if order + p._precision(value_string) >= 14 then<br />
precision = 13 - order;<br />
end<br />
end<br />
<br />
-- If rounding off, truncate extra digits<br />
if precision < current_precision then<br />
value = p._round(value, precision)<br />
current_precision = p._precision(value)<br />
end<br />
<br />
local formatted_num = lang:formatNum(math.abs(value))<br />
local sign<br />
<br />
-- Use proper unary minus sign rather than ASCII default<br />
if value < 0 then<br />
sign = '−'<br />
else<br />
sign = ''<br />
end<br />
<br />
-- Handle cases requiring scientific notation<br />
if string.find(formatted_num, 'E', 1, true) ~= nil or math.abs(order) >= 9 then<br />
value = value * math.pow(10, -order)<br />
current_precision = current_precision + order<br />
precision = precision + order<br />
formatted_num = lang:formatNum(math.abs(value))<br />
else<br />
order = 0;<br />
end<br />
formatted_num = sign .. formatted_num<br />
<br />
-- Pad with zeros, if needed<br />
if current_precision < precision then<br />
local padding<br />
if current_precision <= 0 then<br />
if precision > 0 then<br />
local zero_sep = lang:formatNum(1.1)<br />
formatted_num = formatted_num .. zero_sep:sub(2,2)<br />
<br />
padding = precision<br />
if padding > 20 then<br />
padding = 20<br />
end<br />
<br />
formatted_num = formatted_num .. string.rep('0', padding)<br />
end<br />
else<br />
padding = precision - current_precision<br />
if padding > 20 then<br />
padding = 20<br />
end<br />
formatted_num = formatted_num .. string.rep('0', padding)<br />
end<br />
end<br />
<br />
-- Add exponential notation, if necessary.<br />
if order ~= 0 then<br />
-- Use proper unary minus sign rather than ASCII default<br />
if order < 0 then<br />
order = '−' .. lang:formatNum(math.abs(order))<br />
else<br />
order = lang:formatNum(order)<br />
end<br />
<br />
formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'<br />
end<br />
<br />
return formatted_num<br />
end<br />
<br />
--[[<br />
Helper function that interprets the input numerically. If the<br />
input does not appear to be a number, attempts evaluating it as<br />
a parser functions expression.<br />
]]<br />
<br />
function p._cleanNumber(number_string)<br />
if type(number_string) == 'number' then<br />
-- We were passed a number, so we don't need to do any processing.<br />
return number_string, tostring(number_string)<br />
elseif type(number_string) ~= 'string' or not number_string:find('%S') then<br />
-- We were passed a non-string or a blank string, so exit.<br />
return nil, nil;<br />
end<br />
<br />
-- Attempt basic conversion<br />
local number = tonumber(number_string)<br />
<br />
-- If failed, attempt to evaluate input as an expression<br />
if number == nil then<br />
local success, result = pcall(mw.ext.ParserFunctions.expr, number_string)<br />
if success then<br />
number = tonumber(result)<br />
number_string = tostring(number)<br />
else<br />
number = nil<br />
number_string = nil<br />
end<br />
else<br />
number_string = number_string:match("^%s*(.-)%s*$") -- String is valid but may contain padding, clean it.<br />
number_string = number_string:match("^%+(.*)$") or number_string -- Trim any leading + signs.<br />
if number_string:find('^%-?0[xX]') then<br />
-- Number is using 0xnnn notation to indicate base 16; use the number that Lua detected instead.<br />
number_string = tostring(number)<br />
end<br />
end<br />
<br />
return number, number_string<br />
end<br />
<br />
--[[<br />
Wrapper function that does basic argument processing. This ensures that all functions from #invoke can use either the current<br />
frame or the parent frame, and it also trims whitespace for all arguments and removes blank arguments.<br />
]]<br />
<br />
local mt = { __index = function(t, k)<br />
return function(frame)<br />
if not getArgs then<br />
getArgs = require('Module:Arguments').getArgs<br />
end<br />
return wrap[k](getArgs(frame)) -- Argument processing is left to Module:Arguments. Whitespace is trimmed and blank arguments are removed.<br />
end<br />
end }<br />
<br />
return setmetatable(p, mt)</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Location_map/data/Tokyo_city&diff=2316
モジュール:Location map/data/Tokyo city
2021-02-21T14:53:11Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>return require('Module:Location map/data/Japan Tokyo city')</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Location_map/data/Japan_Tokyo_city&diff=2314
モジュール:Location map/data/Japan Tokyo city
2021-02-21T14:53:11Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>return {<br />
name = '東京都区部',<br />
top = 35.821,<br />
bottom = 35.513,<br />
left = 139.555,<br />
right = 139.923,<br />
image = 'Map Tokyo special wards.jpg'<br />
}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Location_map/data/Japan_Tokyo&diff=2312
モジュール:Location map/data/Japan Tokyo
2021-02-21T14:53:10Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>return {<br />
name = '東京都',<br />
top = 35.92,<br />
bottom = 35.48,<br />
left = 138.92,<br />
right = 139.93,<br />
image = 'Tokyo-to géolocalisation.svg',<br />
image1 = 'Tokyo-to géolocalisation relief.svg'<br />
}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Location_map/data/Japan&diff=2310
モジュール:Location map/data/Japan
2021-02-21T14:53:10Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>return {<br />
name = '日本',<br />
x = '100*(($1>30.90)*($2-128.24)/(149.27-128.24)+($1<=30.90)*($2-110.43)/(131.44-110.43))',<br />
y = '100*(($1>30.90)*($1-45.86)/(30.02-45.86)+($1<=30.90)*($1-39.54)/(23.71-39.54))',<br />
image = 'Japan location map with side map of the Ryukyu Islands.svg',<br />
image1 = 'Japan natural location map with side map of the Ryukyu Islands.jpg',<br />
image2 = 'Japan bluemarble location map with side map of the Ryukyu Islands.jpg'<br />
}</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Location_map&diff=2308
モジュール:Location map
2021-02-21T14:53:10Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>require('Module:No globals')<br />
<br />
local p = {}<br />
<br />
local getArgs = require('Module:Arguments').getArgs<br />
<br />
local function round(n, decimals)<br />
local pow = 10^(decimals or 0)<br />
return math.floor(n * pow + 0.5) / pow<br />
end<br />
<br />
function p.getMapParams(map, frame)<br />
if not map then<br />
error('Location mapの名前は必ず指定しなければなりません。', 2)<br />
end<br />
local moduletitle = mw.title.new('Module:Location map/data/' .. map)<br />
if not moduletitle then<br />
error(string.format('%qはLocation mapの名前として無効です。', map), 2)<br />
elseif moduletitle.exists then<br />
local mapData = mw.loadData('Module:Location map/data/' .. map)<br />
return function(name, params)<br />
if name == nil then<br />
return 'Module:Location map/data/' .. map<br />
elseif mapData[name] == nil then<br />
return ''<br />
elseif params then<br />
return mw.message.newRawMessage(tostring(mapData[name]), unpack(params)):plain()<br />
else<br />
return mapData[name]<br />
end<br />
end<br />
elseif mw.title.new('Template:Location map ' .. map).exists then<br />
local cache = {}<br />
if type(frame) ~= 'table' or type(frame.expandTemplate) ~= 'function' then<br />
error('古いLocation mapを使うときにフレームが存在しなければなりません。')<br />
end<br />
return function(name, params)<br />
if params then<br />
return frame:expandTemplate{title = 'Location map ' .. map, args = { name, unpack(params) }}<br />
else<br />
if name == nil then<br />
return 'Template:Location map ' .. map<br />
elseif cache[name] == nil then<br />
cache[name] = frame:expandTemplate{title = 'Location map ' .. map, args = { name }}<br />
end<br />
return cache[name]<br />
end<br />
end<br />
else<br />
error('Location mapのモジュール「"Module:Location map/data/' .. map .. '"」もしくはテンプレート「"Template:Location map ' .. map .. '"」が作成されていません。', 2)<br />
end<br />
end<br />
<br />
function p.data(frame, args, map)<br />
if not args then<br />
args = getArgs(frame, {frameOnly = true})<br />
end<br />
if not map then<br />
map = p.getMapParams(args[1], frame)<br />
end<br />
local params = {}<br />
for k,v in ipairs(args) do<br />
if k > 2 then<br />
params[k-2] = v<br />
end<br />
end<br />
return map(args[2], #params ~= 0 and params)<br />
end<br />
<br />
local hemisphereMultipliers = {<br />
longitude = { W = -1, w = -1, E = 1, e = 1 },<br />
latitude = { S = -1, s = -1, N = 1, n = 1 }<br />
}<br />
<br />
local function decdeg(degrees, minutes, seconds, hemisphere, decimal, direction)<br />
if decimal then<br />
if degrees then<br />
error(direction .. 'において10進数形式と度分秒は両方指定できません。', 2)<br />
elseif minutes then<br />
error(direction .. 'において分は度分秒方式でのみ指定してください。', 2)<br />
elseif seconds then<br />
error(direction .. 'において秒は度分秒方式でのみ指定してください。', 2)<br />
elseif hemisphere then<br />
error(direction .. 'において半球は度分秒方式でのみ指定してください。', 2)<br />
end<br />
local retval = tonumber(decimal)<br />
if retval then<br />
return retval<br />
end<br />
error(direction .. 'の値"' .. decimal .. '"は無効です。', 2)<br />
elseif seconds and not minutes then<br />
error(direction .. 'の秒を指定する時は分も指定してください。', 2)<br />
elseif not degrees then<br />
if minutes then<br />
error(direction .. 'の分を指定する時は度も指定してください。', 2)<br />
elseif hemisphere then<br />
error(direction .. 'の半球を指定する時は度も指定してください。', 2)<br />
end<br />
return nil<br />
end<br />
decimal = tonumber(degrees)<br />
if not decimal then<br />
error(direction .. 'の度の値"' .. degrees .. '"は無効です。', 2)<br />
elseif minutes and not tonumber(minutes) then<br />
error(direction .. 'の分の値"' .. minutes .. '"は無効です。', 2)<br />
elseif seconds and not tonumber(seconds) then<br />
error(direction .. 'の秒の値"' .. seconds .. '"は無効です。', 2)<br />
end<br />
decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600<br />
if hemisphere then<br />
local multiplier = hemisphereMultipliers[direction][hemisphere]<br />
if not multiplier then<br />
error(direction .. 'の半球である"' .. hemisphere .. '"は無効です。', 2)<br />
end<br />
decimal = decimal * multiplier<br />
end<br />
return decimal<br />
end<br />
<br />
-- Finds a parameter in a transclusion of {{Coord}}.<br />
local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign<br />
local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]')<br />
if para == 'longitude' then result = {result[3], result[4]} end<br />
if not tonumber(result[1]) or not result[2] then return error('不正な座標指定です。', 2) end<br />
return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]<br />
end<br />
<br />
-- effectively make removeBlanks false for caption and maplink, and true for everything else<br />
-- if useWikidata is present but blank, convert it to false instead of nil<br />
-- p.top, p.bottom, and their callers need to use this<br />
function p.valueFunc(key, value)<br />
if value then<br />
value = mw.text.trim(value)<br />
end<br />
if value ~= '' or key == 'caption' or key == 'maplink' then<br />
return value<br />
elseif key == 'useWikidata' then<br />
return false<br />
end<br />
end<br />
<br />
local function getContainerImage(args, map)<br />
if args.AlternativeMap then<br />
return args.AlternativeMap<br />
elseif args.relief and map('image1') ~= '' then<br />
return map('image1')<br />
else<br />
return map('image')<br />
end<br />
end<br />
<br />
function p.top(frame, args, map)<br />
if not args then<br />
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})<br />
end<br />
if not map then<br />
map = p.getMapParams(args[1], frame)<br />
end<br />
local width<br />
local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),"%d*"))<br />
if not args.width then<br />
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))<br />
elseif mw.ustring.sub(args.width, -2) == 'px' then<br />
width = mw.ustring.sub(args.width, 1, -3)<br />
else<br />
width = args.width<br />
end<br />
local width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;<br />
if width_as_number == 0 then<br />
-- check to see if width is junk. If it is, then use default calculation<br />
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))<br />
width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;<br />
end <br />
if args.max_width ~= "" and args.max_width ~= nil then<br />
-- check to see if width bigger than max_width<br />
local max_as_number = tonumber(mw.ustring.match(args.max_width,"%d*")) or 0;<br />
if width_as_number>max_as_number and max_as_number>0 then<br />
width = args.max_width;<br />
end<br />
end<br />
local retval = args.float == 'center' and '<div class="center">' or ''<br />
if args.caption and args.caption ~= '' and args.border ~= 'infobox' then<br />
retval = retval .. '<div class="noviewer thumb '<br />
if args.float == '"left"' or args.float == 'left' then<br />
retval = retval .. 'tleft'<br />
elseif args.float == '"center"' or args.float == 'center' or args.float == '"none"' or args.float == 'none' then<br />
retval = retval .. 'tnone'<br />
else<br />
retval = retval .. 'tright'<br />
end<br />
retval = retval .. '"><div class="thumbinner" style="width:' .. (width + 2) .. 'px'<br />
if args.border == 'none' then<br />
retval = retval .. ';border:none'<br />
elseif args.border then<br />
retval = retval .. ';border-color:' .. args.border<br />
end<br />
retval = retval .. '"><div style="position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray">' or '">')<br />
else<br />
retval = retval .. '<div style="width:' .. width .. 'px;'<br />
if args.float == '"left"' or args.float == 'left' then<br />
retval = retval .. 'float:left;clear:left'<br />
elseif args.float == '"center"' or args.float == 'center' then<br />
retval = retval .. 'float:none;clear:both;margin-left:auto;margin-right:auto'<br />
elseif args.float == '"none"' or args.float == 'none' then<br />
retval = retval .. 'float:none;clear:none'<br />
else<br />
retval = retval .. 'float:right;clear:right'<br />
end<br />
retval = retval .. '"><div style="width:' .. width .. 'px;padding:0"><div style="position:relative;width:' .. width .. 'px">'<br />
end<br />
local image = getContainerImage(args, map)<br />
retval = string.format(<br />
'%s[[File:%s|%spx|%s%s]]',<br />
retval,<br />
image,<br />
width,<br />
args.alt or ((args.label or mw.title.getCurrentTitle().text) .. 'の位置(' .. map('name')) .. '内)',<br />
args.maplink and ('|link=' .. args.maplink) or ''<br />
)<br />
if args.overlay_image then<br />
return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px]]</div>'<br />
else<br />
return retval<br />
end<br />
end<br />
<br />
function p.bottom(frame, args, map)<br />
if not args then<br />
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})<br />
end<br />
if not map then<br />
map = p.getMapParams(args[1], frame)<br />
end<br />
local retval = '</div>'<br />
<br />
if not args.caption or args.border == 'infobox' then<br />
if args.border then<br />
retval = retval .. '<div>'<br />
else<br />
retval = retval .. '<div style="font-size:90%;padding-top:3px">'<br />
end<br />
retval = retval<br />
.. (args.caption or (args.label or mw.title.getCurrentTitle().text) .. ' (' .. map('name') .. ')')<br />
.. '</div>'<br />
elseif args.caption ~= '' then<br />
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image<br />
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'<br />
end<br />
<br />
if args.switcherLabel then<br />
retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>'<br />
elseif args.autoSwitcherLabel then<br />
retval = retval .. '<span class="switcher-label" style="display:none">' .. map('name') .. 'の地図を表示</span>'<br />
end<br />
<br />
retval = retval .. '</div></div>'<br />
if args.caption_undefined then<br />
mw.log('caption_undefinedは廃止されたパラメータです。')<br />
local parent = frame:getParent()<br />
if parent then<br />
mw.log('Parent is ' .. parent:getTitle())<br />
end<br />
mw.logObject(args, 'args')<br />
retval = retval .. ''<br />
end<br />
if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then<br />
mw.log(map() .. 'において廃止されたパラメータです。')<br />
retval = retval .. ''<br />
end<br />
if string.find(map('name'), '|', 1, true) then<br />
mw.log(map() .. 'のLocation map名でパイプを使用しています。')<br />
retval = retval .. ''<br />
end<br />
if args.float == 'center' then<br />
retval = retval .. '</div>'<br />
end<br />
return retval<br />
end<br />
<br />
local function markOuterDiv(x, y, imageDiv, labelDiv)<br />
return mw.html.create('div')<br />
:cssText('position:absolute;z-index:1;top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%')<br />
:node(imageDiv)<br />
:node(labelDiv)<br />
end<br />
<br />
local function markImageDiv(mark, marksize, label, link, alt, title)<br />
local builder = mw.html.create('div')<br />
:cssText('position:absolute;left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px;line-height:0')<br />
:attr('title', title)<br />
if marksize ~= 0 then<br />
builder:wikitext(string.format(<br />
'[[File:%s|%dx%dpx|%s|link=%s%s]]',<br />
mark,<br />
marksize,<br />
marksize,<br />
label,<br />
link,<br />
alt and ('|alt=' .. alt) or ''<br />
))<br />
end<br />
return builder<br />
end<br />
<br />
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)<br />
if tonumber(label_size) == 0 then<br />
return mw.html.create('div'):cssText('font-size:0%;position:absolute'):wikitext(label)<br />
end<br />
local builder = mw.html.create('div')<br />
:cssText('font-size:' .. label_size .. '%;line-height:110%;position:absolute;width:' .. label_width .. 'em')<br />
local distance = round(marksize / 2 + 1)<br />
local spanCss<br />
if position == 'top' then -- specified top<br />
builder:cssText('bottom:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em;text-align:center')<br />
elseif position == 'bottom' then -- specified bottom<br />
builder:cssText('top:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em;text-align:center')<br />
elseif position == 'left' or (tonumber(x) > 70 and position ~= 'right') then -- specified left or autodetected to left<br />
builder:cssText('top:-0.75em;right:' .. distance .. 'px;text-align:right')<br />
spanCss = 'float:right'<br />
else -- specified right or autodetected to right<br />
builder:cssText('top:-0.75em;left:' .. distance .. 'px;text-align:left')<br />
spanCss = 'float:left'<br />
end<br />
builder = builder:tag('span')<br />
:cssText('padding:1px')<br />
:cssText(spanCss)<br />
:wikitext(label)<br />
if background then<br />
builder:cssText('background-color:' .. background)<br />
end<br />
return builder:done()<br />
end<br />
<br />
local function getX(longitude, left, right)<br />
local width = (right - left) % 360<br />
if width == 0 then<br />
width = 360<br />
end<br />
local distanceFromLeft = (longitude - left) % 360<br />
-- the distance needed past the map to the right equals distanceFromLeft - width. the distance needed past the map to the left equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter<br />
if distanceFromLeft - width / 2 >= 180 then<br />
distanceFromLeft = distanceFromLeft - 360<br />
end<br />
return 100 * distanceFromLeft / width<br />
end<br />
<br />
local function getY(latitude, top, bottom)<br />
return 100 * (top - latitude) / (top - bottom)<br />
end<br />
<br />
function p.mark(frame, args, map)<br />
if not args then<br />
args = getArgs(frame, {wrappers = 'Template:Location map~'})<br />
end<br />
if not map then<br />
map = p.getMapParams(args[1], frame)<br />
end<br />
local x, y, longitude, latitude<br />
longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude')<br />
latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude')<br />
if args.coordinates then<br />
-- Temporarily removed to facilitate infobox conversion.<br />
<br />
-- if longitude or latitude then<br />
-- error('[[Module:Coordinates]]からの座標とローカル指定座標の両方を提供できません。')<br />
-- end<br />
longitude = coord2text('longitude', args.coordinates)<br />
latitude = coord2text('latitude', args.coordinates)<br />
elseif not longitude and not latitude and args.useWikidata then<br />
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.<br />
local entity = mw.wikibase.getEntity()<br />
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then<br />
local value = entity.claims.P625[1].mainsnak.datavalue.value<br />
longitude, latitude = value.longitude, value.latitude<br />
end<br />
end<br />
if not longitude then<br />
error('緯度の値が指定されていません。')<br />
elseif not latitude then<br />
error('経度の値が指定されていません。')<br />
end<br />
local builder = mw.html.create()<br />
if (not args.lon_deg) ~= (not args.lat_deg) then<br />
builder:wikitext('')<br />
elseif (not args.lon_min) ~= (not args.lat_min) then<br />
builder:wikitext('')<br />
elseif (not args.lon_sec) ~= (not args.lat_sec) then<br />
builder:wikitext('')<br />
elseif (not args.lon_dir) ~= (not args.lat_dir) then<br />
builder:wikitext('')<br />
elseif (not args.long) ~= (not args.lat) then<br />
builder:wikitext('')<br />
end<br />
if args.skew or args.lon_shift or args.markhigh then<br />
mw.log('呼び出しにおいて廃止されたパラメータです。')<br />
local parent = frame:getParent()<br />
if parent then<br />
mw.log(parent:getTitle() .. 'の親です。')<br />
end<br />
mw.logObject(args, 'args')<br />
builder:wikitext('')<br />
end<br />
if map('x') ~= '' then<br />
x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude })))<br />
else<br />
x = tonumber(getX(longitude, map('left'), map('right')))<br />
end<br />
if map('y') ~= '' then<br />
y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude })))<br />
else<br />
y = tonumber(getY(latitude, map('top'), map('bottom')))<br />
end<br />
if (x < 0 or x > 100 or y < 0 or y > 100) and not args.outside then<br />
mw.log('外部フラグ設定無しに地図外にマークが置かれました。 x = ' .. x .. ', y = ' .. y)<br />
local parent = frame:getParent()<br />
if parent then<br />
mw.log(parent:getTitle() .. 'の親です。')<br />
end<br />
mw.logObject(args, 'args')<br />
builder:wikitext('')<br />
end<br />
local mark = args.mark or map('mark')<br />
if mark == '' then<br />
mark = 'Red pog.svg'<br />
end<br />
local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8<br />
local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2])<br />
local labelDiv<br />
if args.label and args.position ~= 'none' then<br />
labelDiv = markLabelDiv(args.label, args.label_size or 90, args.label_width or 6, args.position, args.background, x, marksize)<br />
end<br />
return builder:node(markOuterDiv(x, y, imageDiv, labelDiv))<br />
end<br />
<br />
local function switcherSeparate(s)<br />
if s == nil then return {} end<br />
local retval = {}<br />
for i in string.gmatch(s .. '#', '([^#]*)#') do<br />
i = mw.text.trim(i)<br />
retval[#retval + 1] = (i ~= '' and i)<br />
end<br />
return retval<br />
end<br />
<br />
function p.main(frame, args, map)<br />
if not args then<br />
args = getArgs(frame, {wrappers = 'Template:Location map', valueFunc = p.valueFunc})<br />
end<br />
if args.useWikidata == nil then<br />
args.useWikidata = true<br />
end<br />
if not map then<br />
if args[1] then<br />
map = {}<br />
for mapname in string.gmatch(args[1], '[^#]+') do<br />
map[#map + 1] = p.getMapParams(mapname, frame)<br />
end<br />
if #map == 1 then map = map[1] end<br />
else<br />
map = p.getMapParams('World', frame)<br />
end<br />
end<br />
if type(map) == 'table' then<br />
local altmaps = switcherSeparate(args.AlternativeMap)<br />
if #altmaps > #map then<br />
error(string.format('%dのAlternativeMapsが提供されていますが、%dの地図のみの提供になります。', #altmaps, #map))<br />
end<br />
local overlays = switcherSeparate(args.overlay_image)<br />
if #overlays > #map then<br />
error(string.format('%dのoverlay_imagesが提供されていますが、%dの地図のみの提供になります。', #overlays, #map))<br />
end<br />
local outputs = {}<br />
args.autoSwitcherLabel = true<br />
for k,v in ipairs(map) do<br />
args.AlternativeMap = altmaps[k]<br />
args.overlay_image = overlays[k]<br />
outputs[k] = p.main(frame, args, v)<br />
end<br />
return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>'<br />
else<br />
return p.top(frame, args, map) .. tostring( p.mark(frame, args, map) ) .. p.bottom(frame, args, map)<br />
end<br />
end<br />
<br />
return p</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Coordinates&diff=2306
モジュール:Coordinates
2021-02-21T14:53:09Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>--[[<br />
This module is intended to replace the functionality of {{Coord}} and related<br />
templates. It provides several methods, including<br />
<br />
{{#invoke:Coordinates | coord }} : General function formatting and displaying<br />
coordinate values.<br />
<br />
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal<br />
degree values to DMS format.<br />
<br />
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format<br />
to decimal degree format.<br />
<br />
{{#invoke:Coordinates | link }} : Export the link used to reach the tools<br />
<br />
]]<br />
<br />
require('Module:No globals')<br />
<br />
local math_mod = require("Module:Math");<br />
local coordinates = {};<br />
<br />
local current_page = mw.title.getCurrentTitle()<br />
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );<br />
local coord_link = 'https://geohack.toolforge.org/geohack.php?language=ja&pagename=' .. page_name .. '&params='<br />
<br />
--[[ Helper function, replacement for {{coord/display/title}} ]]<br />
local function displaytitle(s, notes)<br />
local l = "[[地理座標系|座標]]: " .. s<br />
local co = '<span id="coordinates">' .. l .. notes .. '</span>';<br />
return '<span style="font-size: small;">' .. co .. '</span>';<br />
end<br />
<br />
--[[ Helper function, Replacement for {{coord/display/inline}} ]]<br />
local function displayinline(s, notes)<br />
return s .. notes <br />
end<br />
<br />
--[[ Helper function, used in detecting DMS formatting ]]<br />
local function dmsTest(first, second)<br />
if type(first) ~= 'string' or type(second) ~= 'string' then<br />
return nil<br />
end<br />
local s = (first .. second):upper()<br />
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')<br />
end<br />
<br />
<br />
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]<br />
local function makeInvokeFunc(funcName)<br />
return function (frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:Coord'<br />
})<br />
return coordinates[funcName](args, frame)<br />
end<br />
end<br />
<br />
--[[ Helper function, handle optional args. ]]<br />
local function optionalArg(arg, supplement)<br />
return arg and arg .. supplement or ''<br />
end<br />
<br />
--[[<br />
Formats any error messages generated for display<br />
]]<br />
local function errorPrinter(errors)<br />
local result = ""<br />
for i,v in ipairs(errors) do<br />
local errorHTML = '<strong class="error">座標: ' .. v[2] .. '</strong>'<br />
result = result .. errorHTML .. "<br />"<br />
end<br />
return result<br />
end<br />
<br />
--[[<br />
Determine the required CSS class to display coordinates<br />
<br />
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself<br />
default is the mode as specificied by the user when calling the {{coord}} template<br />
mode is the display mode (dec or dms) that we will need to determine the css class for <br />
]]<br />
local function displayDefault(default, mode)<br />
if default == "" then<br />
default = "dec"<br />
end<br />
<br />
if default == mode then<br />
return "geo-default"<br />
else<br />
return "geo-nondefault"<br />
end<br />
end<br />
<br />
--[[<br />
specPrinter<br />
<br />
Output formatter. Takes the structure generated by either parseDec<br />
or parseDMS and formats it for inclusion on Wikipedia.<br />
]]<br />
local function specPrinter(args, coordinateSpec)<br />
local uriComponents = coordinateSpec["param"]<br />
if uriComponents == "" then<br />
-- RETURN error, should never be empty or nil<br />
return "エラー: param が空です"<br />
end<br />
if args["name"] then<br />
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])<br />
end<br />
<br />
local geodmshtml = '<span class="geo-dms" title="この位置の地図や航空写真などにリンクするページを表示します">'<br />
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '<br />
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'<br />
.. '</span>'<br />
<br />
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0<br />
local geodeclat<br />
if lat < 0 then<br />
-- FIXME this breaks the pre-existing precision<br />
geodeclat = "南緯" .. tostring(coordinateSpec["dec-lat"]):sub(2) .. "度"<br />
else<br />
geodeclat = "北緯" .. (coordinateSpec["dec-lat"] or 0) .. "度"<br />
end<br />
<br />
local long = tonumber( coordinateSpec["dec-long"] ) or 0<br />
local geodeclong<br />
if long < 0 then<br />
-- FIXME does not handle unicode minus<br />
geodeclong = "西経" .. tostring(coordinateSpec["dec-long"]):sub(2) .. "度"<br />
else<br />
geodeclong = "東経" .. (coordinateSpec["dec-long"] or 0) .. "度"<br />
end<br />
<br />
local geodechtml = '<span class="geo-dec" title="この位置の地図や航空写真などにリンクするページを表示します">'<br />
.. geodeclat .. ' '<br />
.. geodeclong<br />
.. '</span>'<br />
<br />
local geonumhtml = '<span class="geo">'<br />
.. coordinateSpec["dec-lat"] .. '; '<br />
.. coordinateSpec["dec-long"]<br />
.. '</span>'<br />
<br />
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'<br />
.. '<span class="geo-multi-punct">&#xfeff; / &#xfeff;</span>'<br />
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';<br />
<br />
if not args["name"] then<br />
inner = inner .. geodechtml <br />
.. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span></span>'<br />
else<br />
inner = inner .. '<span class="vcard">' .. geodechtml <br />
.. '<span style="display:none">&#xfeff; / ' .. geonumhtml .. '</span>'<br />
.. '<span style="display:none">&#xfeff; (<span class="fn org">'<br />
.. args["name"] .. '</span>)</span></span></span>'<br />
end<br />
<br />
return '<span class="plainlinks nourlexpansion">' .. <br />
'[' .. coord_link .. uriComponents .. ' ' .. inner .. ']' .. '</span>'<br />
end<br />
<br />
--[[ Helper function, convert decimal to degrees ]]<br />
local function convert_dec2dms_d(coordinate)<br />
local d = math_mod._round( coordinate, 0 ) .. "°"<br />
return d .. ""<br />
end<br />
<br />
--[[ Helper function, convert decimal to degrees and minutes ]]<br />
local function convert_dec2dms_dm(coordinate) <br />
coordinate = math_mod._round( coordinate * 60, 0 );<br />
local m = coordinate % 60;<br />
coordinate = math.floor( (coordinate - m) / 60 );<br />
local d = coordinate % 360 .."度"<br />
<br />
return d .. string.format( "%02d分", m )<br />
end<br />
<br />
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]<br />
local function convert_dec2dms_dms(coordinate)<br />
coordinate = math_mod._round( coordinate * 60 * 60, 0 );<br />
local s = coordinate % 60<br />
coordinate = math.floor( (coordinate - s) / 60 );<br />
local m = coordinate % 60<br />
coordinate = math.floor( (coordinate - m) / 60 );<br />
local d = coordinate % 360 .."度"<br />
<br />
return d .. string.format( "%02d分", m ) .. string.format( "%02d秒", s )<br />
end<br />
<br />
--[[ <br />
Helper function, convert decimal latitude or longitude to <br />
degrees, minutes, and seconds format based on the specified precision. <br />
]]<br />
local function convert_dec2dms(coordinate, firstPrefix, secondPrefix, precision)<br />
local coord = tonumber(coordinate)<br />
local prefix<br />
if coord >= 0 then<br />
prefix = firstPrefix<br />
else<br />
prefix = secondPrefix<br />
end<br />
<br />
precision = precision:lower();<br />
if precision == "dms" then<br />
return prefix .. convert_dec2dms_dms( math.abs( coord ) );<br />
elseif precision == "dm" then<br />
return prefix .. convert_dec2dms_dm( math.abs( coord ) );<br />
elseif precision == "d" then<br />
return prefix .. convert_dec2dms_d( math.abs( coord ) );<br />
end<br />
end<br />
<br />
--[[<br />
Convert DMS format into a N or E decimal coordinate<br />
]]<br />
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)<br />
local degrees = tonumber(degrees_str)<br />
local minutes = tonumber(minutes_str) or 0<br />
local seconds = tonumber(seconds_str) or 0<br />
<br />
local factor = 1<br />
direction = direction:gsub('^ *(.-) *$', '%1');<br />
if direction == "S" or direction == "W" then<br />
factor = -1<br />
end<br />
<br />
local precision = 0<br />
if seconds_str then<br />
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );<br />
elseif minutes_str and minutes_str ~= '' then<br />
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );<br />
else<br />
precision = math.max( math_mod._precision(degrees_str), 0 );<br />
end<br />
<br />
local decimal = factor * (degrees+(minutes+seconds/60)/60) <br />
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.<br />
end<br />
<br />
--[[ <br />
Checks input values to for out of range errors.<br />
]]<br />
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )<br />
local errors = {};<br />
lat_d = tonumber( lat_d ) or 0;<br />
lat_m = tonumber( lat_m ) or 0;<br />
lat_s = tonumber( lat_s ) or 0;<br />
long_d = tonumber( long_d ) or 0;<br />
long_m = tonumber( long_m ) or 0;<br />
long_s = tonumber( long_s ) or 0;<br />
<br />
if strong then<br />
if lat_d < 0 then<br />
table.insert(errors, {source, "緯度が0度を下回っていますが南北が指定されています"})<br />
end<br />
if long_d < 0 then<br />
table.insert(errors, {source, "経度が0度を下回っていますが東西が指定されています"})<br />
end<br />
--[[ <br />
#coordinates is inconsistent about whether this is an error. If globe: is<br />
specified, it won't error on this condition, but otherwise it will.<br />
<br />
For not simply disable this check.<br />
<br />
if long_d > 180 then<br />
table.insert(errors, {source, "経度が180度を上回っていますが東西が指定されています"})<br />
end<br />
]]<br />
end <br />
<br />
if lat_d > 90 then<br />
table.insert(errors, {source, "緯度の度が90を上回っています"})<br />
end<br />
if lat_d < -90 then<br />
table.insert(errors, {source, "緯度の度が-90を下回っています"})<br />
end<br />
if lat_m >= 60 then<br />
table.insert(errors, {source, "緯度の分が60以上です"})<br />
end<br />
if lat_m < 0 then<br />
table.insert(errors, {source, "緯度の分が0を下回っています"})<br />
end<br />
if lat_s >= 60 then<br />
table.insert(errors, {source, "緯度の秒が60以上です"})<br />
end<br />
if lat_s < 0 then<br />
table.insert(errors, {source, "緯度の秒が0を下回っています"})<br />
end<br />
if long_d >= 360 then<br />
table.insert(errors, {source, "経度の度が360以上です"})<br />
end<br />
if long_d <= -360 then<br />
table.insert(errors, {source, "経度の度が-360以下です"})<br />
end<br />
if long_m >= 60 then<br />
table.insert(errors, {source, "経度の分が60以上です"})<br />
end<br />
if long_m < 0 then<br />
table.insert(errors, {source, "経度の分が0を下回っています"})<br />
end<br />
if long_s >= 60 then<br />
table.insert(errors, {source, "経度の秒が60以上です"})<br />
end<br />
if long_s < 0 then<br />
table.insert(errors, {source, "経度の秒が0を下回っています"})<br />
end<br />
<br />
return errors;<br />
end<br />
<br />
--[[<br />
parseDec<br />
<br />
Transforms decimal format latitude and longitude into the a<br />
structure to be used in displaying coordinates<br />
]]<br />
local function parseDec( lat, long, format )<br />
local coordinateSpec = {}<br />
local errors = {}<br />
<br />
if not long then<br />
return nil, {{"parseDec", "経度が指定されていません"}}<br />
elseif not tonumber(long) then<br />
return nil, {{"parseDec", "経度が数値として認識できません: " .. long}}<br />
end<br />
<br />
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false ); <br />
coordinateSpec["dec-lat"] = lat;<br />
coordinateSpec["dec-long"] = long;<br />
<br />
local mode = coordinates.determineMode( lat, long );<br />
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "北緯", "南緯", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}<br />
coordinateSpec["dms-long"] = convert_dec2dms( long, "東経", "西経", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}} <br />
<br />
if format then<br />
coordinateSpec.default = format<br />
else<br />
coordinateSpec.default = "dec"<br />
end<br />
<br />
return coordinateSpec, errors<br />
end<br />
<br />
--[[<br />
parseDMS<br />
<br />
Transforms degrees, minutes, seconds format latitude and longitude <br />
into the a structure to be used in displaying coordinates<br />
]]<br />
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )<br />
local coordinateSpec, errors, backward = {}, {}<br />
local errors = {}<br />
<br />
lat_f = lat_f:upper();<br />
long_f = long_f:upper();<br />
<br />
-- Check if specified backward<br />
if lat_f == 'E' or lat_f == 'W' then<br />
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;<br />
end <br />
<br />
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );<br />
if not long_d then<br />
return nil, {{"parseDMS", "経度が指定されていません" }}<br />
elseif not tonumber(long_d) then<br />
return nil, {{"parseDMS", "経度が数値として認識できません:" .. long_d }}<br />
end<br />
<br />
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then <br />
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then<br />
if lat_f:upper() == 'S' then <br />
lat_d = '-' .. lat_d;<br />
end<br />
if long_f:upper() == 'W' then <br />
long_d = '-' .. long_d;<br />
end <br />
<br />
return parseDec( lat_d, long_d, format );<br />
end <br />
end <br />
<br />
coordinateSpec["dms-lat"] = (lat_f=="N" and "北緯" or "南緯") .. lat_d.."度"..optionalArg(lat_m,"分") .. optionalArg(lat_s,"秒")<br />
coordinateSpec["dms-long"] = (long_f=="E" and "東経" or "西経") .. long_d.."度"..optionalArg(long_m,"分") .. optionalArg(long_s,"秒")<br />
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}<br />
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}<br />
<br />
if format then<br />
coordinateSpec.default = format<br />
else<br />
coordinateSpec.default = "dms"<br />
end <br />
<br />
return coordinateSpec, errors, backward<br />
end<br />
<br />
--[[ <br />
Check the input arguments for coord to determine the kind of data being provided<br />
and then make the necessary processing.<br />
]]<br />
local function formatTest(args)<br />
local result, errors<br />
local backward, primary = false, false<br />
<br />
local function getParam(args, lim)<br />
local ret = {}<br />
for i = 1, lim do<br />
ret[i] = args[i] or ''<br />
end<br />
return table.concat(ret, '_')<br />
end<br />
<br />
if not args[1] then<br />
-- no lat logic<br />
return errorPrinter( {{"formatTest", "緯度が指定されていません"}} )<br />
elseif not tonumber(args[1]) then<br />
-- bad lat logic<br />
return errorPrinter( {{"formatTest", "緯度が数値として認識できません:" .. args[1]}} )<br />
elseif not args[4] and not args[5] and not args[6] then<br />
-- dec logic<br />
result, errors = parseDec(args[1], args[2], args.format)<br />
if not result then<br />
return errorPrinter(errors);<br />
end <br />
result.param = table.concat({args[1], 'N', args[2] or '', 'E', args[3] or ''}, '_')<br />
elseif dmsTest(args[4], args[8]) then<br />
-- dms logic<br />
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4], <br />
args[5], args[6], args[7], args[8], args.format)<br />
if args[10] then<br />
table.insert( errors, { 'formatTest', '座標オプションが認識できません' } );<br />
end<br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 9)<br />
elseif dmsTest(args[3], args[6]) then<br />
-- dm logic<br />
result, errors, backward = parseDMS(args[1], args[2], nil, args[3], <br />
args[4], args[5], nil, args[6], args['format'])<br />
if args[8] then<br />
table.insert(errors, {'formatTest', '座標オプションが認識できません'});<br />
end<br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 7)<br />
elseif dmsTest(args[2], args[4]) then<br />
-- d logic<br />
result, errors, backward = parseDMS(args[1], nil, nil, args[2], <br />
args[3], nil, nil, args[4], args.format)<br />
if args[6] then<br />
table.insert( errors, { 'formatTest', '座標オプションが認識できません' } );<br />
end <br />
if not result then<br />
return errorPrinter(errors)<br />
end<br />
result.param = getParam(args, 5)<br />
else<br />
-- Error<br />
return errorPrinter( {{"formatTest", "引数の形式が認識できません"}} )<br />
end<br />
result.name = args.name<br />
<br />
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}<br />
for _, v in ipairs(extra_param) do<br />
if args[v] then <br />
table.insert( errors, {'formatTest', '引数: "' .. v .. '=" は "' .. v .. ':" という形式でなければいけません' } );<br />
end<br />
end<br />
<br />
local ret = specPrinter(args, result)<br />
if #errors > 0 then<br />
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:座標タグに誤りがあるページ]]'<br />
end<br />
return ret, backward<br />
end<br />
<br />
--[[<br />
Generate Wikidata tracking categories.<br />
]]<br />
local function makeWikidataCategories()<br />
local ret<br />
if mw.wikibase and current_page.namespace == 0 then<br />
local entity = mw.wikibase.getEntityObject()<br />
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1] then<br />
local snaktype = entity.claims.P625[1].mainsnak.snaktype<br />
if snaktype == 'value' then<br />
-- coordinates exist both here and on Wikidata, and can be compared.<br />
ret = 'ウィキデータにある座標'<br />
elseif snaktype == 'somevalue' then<br />
ret = 'ウィキデータで不明な値となっている座標'<br />
elseif snaktype == 'novalue' then<br />
ret = 'ウィキデータで値なしとなっている座標'<br />
end<br />
else<br />
-- We have to either import the coordinates to Wikidata or remove them here.<br />
ret = 'ウィキデータにない座標'<br />
end<br />
end<br />
if ret then<br />
return string.format('[[Category:%s]]', ret)<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
--[[<br />
link<br />
<br />
Simple function to export the coordinates link for other uses.<br />
<br />
Usage:<br />
{{ Invoke:Coordinates | link }}<br />
<br />
]]<br />
function coordinates.link(frame)<br />
return coord_link;<br />
end<br />
<br />
--[[<br />
dec2dms<br />
<br />
Wrapper to allow templates to call dec2dms directly.<br />
<br />
Usage:<br />
{{ Invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix | <br />
negative_suffix | precision }}<br />
<br />
decimal_coordinate is converted to DMS format. If positive, the positive_suffix<br />
is appended (typical N or E), if negative, the negative suffix is appended. The<br />
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail<br />
to use.<br />
]]<br />
coordinates.dec2dms = makeInvokeFunc('_dec2dms')<br />
function coordinates._dec2dms(args)<br />
local coordinate = args[1]<br />
local firstPostfix = args[2] or ''<br />
local secondPostfix = args[3] or ''<br />
local precision = args[4] or ''<br />
<br />
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)<br />
end<br />
<br />
--[[<br />
Helper function to determine whether to use D, DM, or DMS<br />
format depending on the precision of the decimal input.<br />
]]<br />
function coordinates.determineMode( value1, value2 )<br />
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );<br />
if precision <= 0 then<br />
return 'd'<br />
elseif precision <= 2 then<br />
return 'dm';<br />
else<br />
return 'dms';<br />
end<br />
end <br />
<br />
--[[<br />
dms2dec<br />
<br />
Wrapper to allow templates to call dms2dec directly.<br />
<br />
Usage:<br />
{{ Invoke:Coordinates | dms2dec | direction_flag | degrees | <br />
minutes | seconds }}<br />
<br />
Converts DMS values specified as degrees, minutes, seconds too decimal format.<br />
direction_flag is one of N, S, E, W, and determines whether the output is <br />
positive (i.e. N and E) or negative (i.e. S and W).<br />
]]<br />
coordinates.dms2dec = makeInvokeFunc('_dms2dec')<br />
function coordinates._dms2dec(args)<br />
local direction = args[1]<br />
local degrees = args[2]<br />
local minutes = args[3]<br />
local seconds = args[4]<br />
<br />
return convert_dms2dec(direction, degrees, minutes, seconds)<br />
end<br />
<br />
--[[<br />
coord<br />
<br />
Main entry point for Lua function to replace {{coord}}<br />
<br />
Usage:<br />
{{ Invoke:Coordinates | coord }}<br />
{{ Invoke:Coordinates | coord | lat | long }}<br />
{{ Invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}<br />
...<br />
<br />
Refer to {{coord}} documentation page for many additional parameters and <br />
configuration options.<br />
<br />
Note: This function provides the visual display elements of {{coord}}. In<br />
order to load coordinates into the database, the {{#coordinates:}} parser <br />
function must also be called, this is done automatically in the Lua<br />
version of {{coord}}.<br />
]]<br />
coordinates.coord = makeInvokeFunc('_coord')<br />
function coordinates._coord(args)<br />
if (not args[1] or not tonumber(args[1])) and not args[2] and mw.wikibase.getEntityObject() then<br />
args[3] = args[1]; args[1] = nil<br />
local entity = mw.wikibase.getEntityObject()<br />
if entity <br />
and entity.claims<br />
and entity.claims.P625<br />
and entity.claims.P625[1].mainsnak.snaktype == 'value'<br />
then<br />
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision<br />
args[1]=entity.claims.P625[1].mainsnak.datavalue.value.latitude<br />
args[2]=entity.claims.P625[1].mainsnak.datavalue.value.longitude<br />
if precision then<br />
precision=-math_mod._round(math.log(precision)/math.log(10),0)<br />
args[1]=math_mod._round(args[1],precision)<br />
args[2]=math_mod._round(args[2],precision)<br />
end<br />
end<br />
end<br />
<br />
local contents, backward = formatTest(args)<br />
local Notes = args.notes or ''<br />
local Display = args.display and args.display:lower() or 'inline'<br />
<br />
local function isInline(s)<br />
-- Finds whether coordinates are displayed inline.<br />
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'<br />
end<br />
local function isInTitle(s)<br />
-- Finds whether coordinates are displayed in the title.<br />
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'<br />
end<br />
<br />
local function coord_wrapper(in_args)<br />
-- Calls the parser function {{#coordinates:}}.<br />
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''<br />
end<br />
<br />
local text = ''<br />
if isInline(Display) then<br />
text = text .. displayinline(contents, Notes)<br />
end<br />
if isInTitle(Display) then<br />
text = text<br />
.. displaytitle(contents, Notes)<br />
.. makeWikidataCategories()<br />
end<br />
if not args.nosave then<br />
local page_title, count = mw.title.getCurrentTitle(), 1<br />
if backward then<br />
local tmp = {}<br />
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end<br />
tmp.count = count; count = 2*(count-1)<br />
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end<br />
for i, v in ipairs(tmp) do args[i] = v end<br />
else<br />
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end<br />
end<br />
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end<br />
args.notes, args.format, args.display = nil<br />
text = text .. coord_wrapper(args)<br />
end<br />
return text<br />
end<br />
<br />
--[[<br />
coord2text<br />
<br />
Extracts a single value from a transclusion of {{Coord}}.<br />
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.<br />
<br />
Usage:<br />
<br />
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}<br />
<br />
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source<br />
<br />
]]<br />
function coordinates.coord2text(frame)<br />
if frame.args[1] == '' or frame.args[2] == '' or not frame.args[2] then return nil end<br />
frame.args[2] = mw.text.trim(frame.args[2])<br />
if frame.args[2] == 'lat' or frame.args[2] == 'long' then<br />
local result, negative = mw.text.split((mw.ustring.match(frame.args[1],'%d+.?%d*°[NS] %d+.?%d*°[EW]') or ''), ' ')<br />
if frame.args[2] == 'lat' then<br />
result, negative = result[1], 'S'<br />
else<br />
result, negative = result[2], 'W'<br />
end<br />
result = mw.text.split(result, '°')<br />
if result[2] == negative then result[1] = '-'..result[1] end<br />
return result[1]<br />
else<br />
return mw.ustring.match(frame.args[1], 'params=.-_'..frame.args[2]..':(.-)[ _]')<br />
end<br />
end<br />
<br />
--[[<br />
coordinsert<br />
<br />
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.<br />
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.<br />
<br />
Usage:<br />
<br />
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}<br />
<br />
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.<br />
<br />
]]<br />
function coordinates.coordinsert(frame)<br />
for i, v in ipairs(frame.args) do<br />
if i ~= 1 then<br />
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ') end<br />
end<br />
end<br />
return frame.args[1]<br />
end<br />
<br />
return coordinates</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Clickable_button_2&diff=2304
モジュール:Clickable button 2
2021-02-21T14:53:08Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>-- This module implements {{clickable button 2}}.<br />
<br />
local yesno = require('Module:Yesno')<br />
<br />
local p = {}<br />
<br />
function p.main(frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = 'Template:Clickable button 2'<br />
})<br />
return p.luaMain(args)<br />
end<br />
<br />
function p.luaMain(args)<br />
if not args[1] and not args.url then<br />
return ''<br />
end<br />
local data = p.makeLinkData(args)<br />
local link = p.renderLink(data)<br />
local trackingCategories = p.renderTrackingCategories(args)<br />
return link .. trackingCategories<br />
end<br />
<br />
function p.makeLinkData(args)<br />
local data = {}<br />
<br />
-- Get the link and display values, and find whether we are outputting a<br />
-- wikilink or a URL.<br />
if args.url then<br />
data.isUrl = true<br />
data.link = args.url<br />
if args[1] then<br />
data.display = args[1]<br />
else<br />
data.display = args.url<br />
end<br />
else<br />
data.isUrl = false<br />
data.link = args[1]<br />
if args[2] then<br />
data.display = args[2]<br />
else<br />
data.display = args[1]<br />
end<br />
end<br />
<br />
-- Classes<br />
local class = args.class and args.class:lower()<br />
data.classes = {}<br />
if class == 'ui-button-green'<br />
or class == 'ui-button-blue'<br />
or class == 'ui-button-red'<br />
then<br />
table.insert(<br />
data.classes,<br />
'submit ui-button ui-widget ui-state-default ui-corner-all'<br />
.. ' ui-button-text-only ui-button-text'<br />
)<br />
else<br />
table.insert(data.classes, 'mw-ui-button')<br />
end<br />
if class then<br />
table.insert(data.classes, class)<br />
end<br />
<br />
-- Styles<br />
do<br />
--[[<br />
-- Check whether we are on the same page as we have specified in<br />
-- args[1], but not if we are using a URL link, as then args[1] is only<br />
-- a display value. If we are currently on the page specified in<br />
-- args[1] make the button colour darker so that it stands out from<br />
-- other buttons on the page.<br />
--]]<br />
local success, linkTitle, currentTitle<br />
if not data.isUrl then<br />
currentTitle = mw.title.getCurrentTitle()<br />
success, linkTitle = pcall(mw.title.new, args[1])<br />
end<br />
if success<br />
and linkTitle<br />
and mw.title.equals(currentTitle, linkTitle)<br />
then<br />
if class == 'ui-button-blue'<br />
or class == 'mw-ui-progressive'<br />
or class == 'mw-ui-constructive'<br />
then<br />
data.backgroundColor = '#2962CB'<br />
elseif class == 'ui-button-green' then<br />
data.backgroundColor = '#008B6D'<br />
elseif class == 'ui-button-red' or class == 'mw-ui-destructive' then<br />
data.backgroundColor = '#A6170F'<br />
else<br />
data.backgroundColor = '#CCC'<br />
data.color = '#666'<br />
end<br />
end<br />
-- Add user-specified styles.<br />
data.style = args.style<br />
end<br />
<br />
return data<br />
end<br />
<br />
function p.renderLink(data)<br />
-- Render the display span tag.<br />
local display<br />
do<br />
local displaySpan = mw.html.create('span')<br />
for i, class in ipairs(data.classes or {}) do<br />
displaySpan:addClass(class)<br />
end<br />
displaySpan<br />
:css{<br />
['background-color'] = data.backgroundColor,<br />
color = data.color<br />
}<br />
if data.style then<br />
displaySpan:cssText(data.style)<br />
end<br />
displaySpan:wikitext(data.display)<br />
display = tostring(displaySpan)<br />
end<br />
<br />
-- Render the link<br />
local link <br />
if data.isUrl then<br />
link = string.format('[%s %s]', data.link, display)<br />
else<br />
link = string.format('[[%s|%s]]', data.link, display)<br />
end<br />
<br />
return string.format('<span class="plainlinks">%s</span>', link)<br />
end<br />
<br />
function p.renderTrackingCategories(args)<br />
if yesno(args.category) == false then<br />
return ''<br />
end<br />
local class = args.class and args.class:lower()<br />
if class == 'ui-button-green'<br />
or class == 'ui-button-blue'<br />
or class == 'ui-button-red'<br />
then<br />
return ''<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
return p</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:%E7%94%BB%E5%83%8F%E5%8B%9F%E9%9B%86%E4%B8%AD&diff=2302
テンプレート:画像募集中
2021-02-21T14:53:08Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><div style="text-align: center;">[[ファイル:{{#switch: {{{1|{{{type|}}}}}}<br />
| 1 = Gthumb.svg<br />
| 2 = Replace this image JA.svg<br />
| 3 = Requestpicture.JPG<br />
| #default = Gthumb.svg<br />
}}|{{#if: {{{2|{{{size|}}}}}}<br />
| {{{2|{{{size}}}}}}<br />
| {{#switch: {{{1|{{{type|}}}}}}<br />
| 2 = 150px<br />
| 3 = 230px<br />
| #default = {{{size}}}<!-- size? --><br />
}}<br />
}}|link=commons:Special:UploadWizard]]<br /><!--<br />
--><span style="font-size: smaller;"><!--<br />
-->{{Clickable button 2|c:Special:UploadWizard|画像をアップロード|class=mw-ui-progressive}}<!--<br />
--></span></div><includeonly>{{#switch: {{NAMESPACE}}<br />
| {{ns:0}} | {{ns:1}} = {{#if:{{{cat|}}}<br />
| [[Category:{{{cat}}}の画像提供依頼]]<br />
}}<br />
| #default=<br />
}}{{#if: {{{cat1|}}}<br />
| [[Category:{{{cat1}}}の画像提供依頼]]<br />
}}{{#if: {{{cat2|}}}<br />
| [[Category:{{{cat2}}}の画像提供依頼]]<br />
}}{{#if: {{{cat3|}}}<br />
| [[Category:{{{cat3}}}の画像提供依頼]]<br />
}}{{#if: {{{cat4|}}}<br />
| [[Category:{{{cat4}}}の画像提供依頼]]<br />
}}{{#if: {{{cat5|}}}<br />
| [[Category:{{{cat5}}}の画像提供依頼]]<br />
}}</includeonly><noinclude><br />
{{Documentation}}</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:%E5%BB%BA%E7%AF%89%E7%89%A9%E3%81%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E7%94%A8%E3%83%95%E3%83%83%E3%82%BF%E3%83%BC&diff=2300
テンプレート:建築物のテンプレート用フッター
2021-02-21T14:53:07Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>{{Navbox<br />
|name=建築物のテンプレート用フッター<br />
|titlestyle=background:#b0c4de<br />
|title=建築物のテンプレート<br />
|listclass=hlist hlist-hyphen<br />
|list1 =<br />
* [[Template:建築物|建築物]]<br />
* [[Template:博物館|収集展示施設]]<br />
** 博物館<br />
** 美術館<br />
** 科学館等<br />
* [[Template:Infobox 図書館|図書館]]<br />
* [[Template:ホール概要|ホール]]<br />
* [[Template:体育館|体育館]]<br />
* [[Template:スタジアム情報ボックス|スタジアム]]<br />
* [[Template:プール|プール]]<br />
* [[Template:動物園|動物園]]<br />
* [[Template:植物園|植物園]]<br />
* [[Template:水族館|水族館]]<br />
* [[Template:行政施設|行政施設]]<br />
* [[Template:日本の警察署|日本の警察署]]<br />
* [[Template:韓国の警察署|韓国の警察署]]<br />
* [[Template:郵便局|日本の郵便局]]<br />
* [[Template:日本郵便直営店|日本郵便直営店]]<br />
* [[Template:ゆうちょ銀行直営店|ゆうちょ銀行直営店]]<br />
* [[Template:医療機関|医療機関]]<br />
* [[Template:商業施設|商業施設]]<br />
* [[Template:基礎情報 超高層ビル|超高層ビル]]<br />
* [[Template:基礎情報 テーマパーク|テーマパーク]]<br />
}}<noinclude><br />
{{Documentation}}<br />
</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:%E5%BB%BA%E7%AF%89%E7%89%A9/doc&diff=2298
テンプレート:建築物/doc
2021-02-21T14:53:06Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><noinclude>{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}</noinclude><br />
<!-- 以下でテンプレートの解説を編集してください --><br />
'''建築物'''([[#他の建築物テンプレート]]に当て嵌まらないもの)の[[Help:テンプレート|テンプレート]]です。<br />
*主な使用例<br />
**[[表参道ヒルズ]]<br />
**[[徳島市中央公民館]]<br />
**[[西新宿三井ビルディング]]<br />
**[[アクティ汐留]]<br />
**[[サンリオピューロランド]]<br />
== 使い方 ==<br />
下記の部分を[[コピー・アンド・ペースト]]して、「=」の右に記入して下さい。「名称」以外は空欄でも構いません。空欄の項目は表示されません。また、[[Help:テンプレート|テンプレート]]は自動的に右に寄ります。<br />
<pre><br />
{{建築物<br />
|名称 = <br />
|旧名称 = <br />
|画像 = <!--noと記入すれば画像提供依頼から外せます--><br />
|画像説明 = <br />
|用途 = <br />
|旧用途 = <br />
|設計者 = <br />
|構造設計者 = <br />
|設備設計者 = <br />
|施工 = <br />
|建築主 = <br />
|事業主体 = <br />
|管理運営 = <br />
|構造形式 = <br />
|敷地面積= |敷地面積ref= |敷地面積備考=<br />
|建築面積= |建築面積ref= |建築面積備考=<br />
|延床面積= |延床面積ref= |延床面積備考=<br />
|状態 = <br />
|階数 = <br />
|高さ = <br />
|エレベーター数 = <br />
|戸数 = <br />
|駐車台数 = <br />
|着工 = <br />
|竣工 = <br />
|開館開所 = <br />
|改築 = <br />
|解体 = <br />
|所在地郵便番号 = <br />
|所在地 = <br />
|緯度度 = |緯度分 = |緯度秒 = |N(北緯)及びS(南緯) = <br />
|経度度 = |経度分 = |経度秒 = |E(東経)及びW(西経) = <br />
|地図国コード = <br />
|座標右上表示 = <br />
|位置図種類 = <br />
|文化財 = <br />
|指定・登録等日 = <br />
|備考 = <br />
}}<br />
</pre><br />
<br />
== 項目の解説 ==<br />
;敷地面積、建築面積、延床面積<br />
:数値のみ入力して下さい。単位([[平方メートル|m&sup2;]])は自動的に付加されます。<br />
; 緯度度・緯度分・緯度秒 、経度度・経度分・経度秒<br />
: 座標(緯度・経度)を記入します。座標は、[http://wikitools.web.fc2.com/geo/ ジオロケーター]で取得できます。調べ方は[[Wikipedia:緯度・経度の調べ方]]を参照。<br />
: 座標の条件はデフォルトでは日本国内を想定し、「北緯」「東経」「JP」となっています。これらは「N(北緯)及びS(南緯)」「E(東経)及びW(西経)」「地図国コード」部分を入力することにより変更できます。<br />
<br />
; 地図国コード<br />
: 座標位置が日本国内の場合には「JP」を指定します。各国の国コードは[[プロジェクト:地理座標#地域]]を参照。<br />
<br />
== 使用例 ==<br />
{{建築物<br />
|名称 = 表参道ヒルズ<br />
|旧名称 = <br />
|画像 = Omote-sando03s3200.jpg<br />
|画像説明 = 表参道ヒルズ<br />
|用途 = [[店舗]]、[[集合住宅]]<br />
|旧用途 = <br />
|設計者 = {{flatlist|<br />
* 安藤忠雄建築研究所<br />
* 森ビル設計共同企業体<br />
}}<br />
|構造設計者 = 金箱構造設計事務所<br />
|設備設計者 = 森村設計、明野設備研究所<br />
|施工 = {{flatlist|<br />
* [[大林組]]<br />
* [[関電工]]<br />
* 高砂熱学工業<br />
* 三建設備工業<br />
}}<br />
|建築主 = 神宮前四丁目地区市街地再開発組合<br />
|事業主体 = <br />
|管理運営 = <br />
|構造形式 = 鉄骨鉄筋コンクリート造、一部鉄筋コンクリート造、及び鉄骨造<br />
|敷地面積=6051.36 |敷地面積ref= |敷地面積備考=<br />
|建築面積=5030.76 |建築面積ref= |建築面積備考=<br />
|延床面積=34061.72 |延床面積ref= |延床面積備考=<br />
|階数 = 地上6階、地下6階<br />
|高さ = 23.3m<br />
|着工 = [[2003年]]8月<br />
|竣工 = [[2006年]]1月<br />
|開館開所 = <br />
|改築 = <br />
|解体 = <br />
|所在地郵便番号 = 150-0001<br />
|所在地 = [[東京都]][[渋谷区]][[神宮前 (渋谷区)|神宮前]]四丁目12番10号<br />
|緯度度 = 35 |緯度分 = 40 |緯度秒 = 2.63<br />
|経度度 = 139 |経度分 = 42 |経度秒 = 31.41<br />
|座標右上表示 = Yes<br />
|位置図種類 = Tokyo city#Japan Tokyo#Japan<br />
|文化財指定 = <br />
|指定日 = <br />
|備考 = <br />
}}<br />
例えば、下記のようにマークアップすると、右のような表が挿入されます。その他は[[Special:Whatlinkshere/Template:建築物|Template:建築物を使用している記事一覧]]を参考にしてください。<br />
<pre style="overflow:auto; margin-left:0"><br />
{{建築物<br />
|名称 = 表参道ヒルズ<br />
|旧名称 = <br />
|画像 = Omote-sando03s3200.jpg<br />
|画像説明 = 表参道ヒルズ<br />
|用途 = [[店舗]]、[[集合住宅]]<br />
|旧用途 = <br />
|設計者 = {{flatlist|<br />
* 安藤忠雄建築研究所<br />
* 森ビル設計共同企業体<br />
}}<br />
|構造設計者 = 金箱構造設計事務所<br />
|設備設計者 = 森村設計、明野設備研究所<br />
|施工 = {{flatlist|<br />
* [[大林組]]<br />
* [[関電工]]<br />
* 高砂熱学工業<br />
* 三建設備工業<br />
}}<br />
|建築主 = 神宮前四丁目地区市街地再開発組合<br />
|事業主体 = <br />
|管理運営 = <br />
|構造形式 = 鉄骨鉄筋コンクリート造、一部鉄筋コンクリート造、及び鉄骨造<br />
|敷地面積=6051.36 |敷地面積ref= |敷地面積備考=<br />
|建築面積=5030.76 |建築面積ref= |建築面積備考=<br />
|延床面積=34061.72 |延床面積ref= |延床面積備考=<br />
|階数 = 地上6階、地下6階<br />
|高さ = 23.3m<br />
|着工 = [[2003年]]8月<br />
|竣工 = [[2006年]]1月<br />
|開館開所 = <br />
|改築 = <br />
|解体 = <br />
|所在地郵便番号 = 150-0001<br />
|所在地 = [[東京都]][[渋谷区]][[神宮前 (渋谷区)|神宮前]]四丁目12番10号<br />
|緯度度 = 35 |緯度分 = 40 |緯度秒 = 2.63<br />
|経度度 = 139 |経度分 = 42 |経度秒 = 31.41<br />
|座標右上表示 = Yes<br />
|位置図種類 = Tokyo city#Japan Tokyo#Japan<br />
|文化財 = <br />
|指定・登録等日 = <br />
|備考 = <br />
}}</pre><br />
<!--<br />
・右下に小型ギャラリー?<br />
・設備設計も入れるか?<br />
・任意属性を入れられるようにするか?<br />
・「建築物」をリストアップしたページにリンクする?<br />
--><br />
{{clear}}<br />
<br />
== 関連項目 ==<br />
{{ウィキプロジェクトリンク|建築}}<br />
* [[:カテゴリ:建築物]]<br />
* [[Template:Infobox building]]<br />
{{建築物のテンプレート用フッター}}<br />
<br />
== テンプレートデータ ==<br />
{{TemplateDataHeader}}<br />
<templatedata><br />
{<br />
"description": "建築物(他の建築物テンプレートに当て嵌まらないもの)のテンプレートです。",<br />
"params": {<br />
"名称": {<br />
"label": "名称",<br />
"type": "string",<br />
"required": false<br />
},<br />
"画像": {<br />
"label": "画像",<br />
"type": "string",<br />
"required": false<br />
},<br />
"画像説明": {<br />
"label": "画像説明",<br />
"type": "string",<br />
"required": false<br />
},<br />
"旧名称": {<br />
"label": "旧名称",<br />
"type": "string",<br />
"required": false<br />
},<br />
"用途": {<br />
"label": "用途",<br />
"type": "string",<br />
"required": false<br />
},<br />
"旧用途": {<br />
"label": "旧用途",<br />
"type": "string",<br />
"required": false<br />
},<br />
"設計者": {<br />
"label": "設計者",<br />
"type": "string",<br />
"required": false<br />
},<br />
"構造設計者": {<br />
"label": "構造設計者",<br />
"type": "string",<br />
"required": false<br />
},<br />
"設備設計者": {<br />
"label": "設備設計者",<br />
"type": "string",<br />
"required": false<br />
},<br />
"施工": {<br />
"label": "施工",<br />
"type": "string",<br />
"required": false<br />
},<br />
"建築主": {<br />
"label": "建築主",<br />
"type": "string",<br />
"required": false<br />
},<br />
"事業主体": {<br />
"label": "事業主体",<br />
"type": "string",<br />
"required": false<br />
},<br />
"管理運営": {<br />
"label": "管理運営",<br />
"type": "string",<br />
"required": false<br />
},<br />
"構造形式": {<br />
"label": "構造形式",<br />
"type": "string",<br />
"required": false<br />
},<br />
"敷地面積": {<br />
"label": "敷地面積",<br />
"type": "string",<br />
"required": false<br />
},<br />
"敷地面積ref": {<br />
"label": "敷地面積ref",<br />
"type": "string",<br />
"required": false<br />
},<br />
"敷地面積備考": {<br />
"label": "敷地面積備考",<br />
"type": "string",<br />
"required": false<br />
},<br />
"建築面積": {<br />
"label": "建築面積",<br />
"type": "string",<br />
"required": false<br />
},<br />
"建築面積ref": {<br />
"label": "建築面積ref",<br />
"type": "string",<br />
"required": false<br />
},<br />
"建築面積備考": {<br />
"label": "建築面積備考",<br />
"type": "string",<br />
"required": false<br />
},<br />
"延床面積": {<br />
"label": "延床面積",<br />
"type": "string",<br />
"required": false<br />
},<br />
"延床面積ref": {<br />
"label": "延床面積ref",<br />
"type": "string",<br />
"required": false<br />
},<br />
"延床面積備考": {<br />
"label": "延床面積備考",<br />
"type": "string",<br />
"required": false<br />
},<br />
"階数": {<br />
"label": "階数",<br />
"type": "string",<br />
"required": false<br />
},<br />
"高さ": {<br />
"label": "高さ",<br />
"type": "string",<br />
"required": false<br />
},<br />
"エレベーター数": {<br />
"label": "エレベーター数",<br />
"type": "string",<br />
"required": false<br />
},<br />
"戸数": {<br />
"label": "戸数",<br />
"type": "string",<br />
"required": false<br />
},<br />
"駐車台数": {<br />
"label": "駐車台数",<br />
"type": "string",<br />
"required": false<br />
},<br />
"着工": {<br />
"label": "着工",<br />
"type": "string",<br />
"required": false<br />
},<br />
"竣工": {<br />
"label": "竣工",<br />
"type": "string",<br />
"required": false<br />
},<br />
"開館開所": {<br />
"label": "開館開所",<br />
"type": "string",<br />
"required": false<br />
},<br />
"改築": {<br />
"label": "改築",<br />
"type": "string",<br />
"required": false<br />
},<br />
"解体": {<br />
"label": "解体",<br />
"type": "string",<br />
"required": false<br />
},<br />
"所在地郵便番号": {<br />
"label": "所在地郵便番号",<br />
"type": "string",<br />
"required": false<br />
},<br />
"所在地": {<br />
"label": "所在地",<br />
"type": "string",<br />
"required": false<br />
},<br />
"位置": {<br />
"label": "位置",<br />
"type": "string",<br />
"required": false<br />
},<br />
"緯度度": {<br />
"label": "緯度度",<br />
"type": "string",<br />
"required": false<br />
},<br />
"緯度分": {<br />
"label": "緯度分",<br />
"type": "string",<br />
"required": false<br />
},<br />
"緯度秒": {<br />
"label": "緯度秒",<br />
"type": "string",<br />
"required": false<br />
},<br />
"N(北緯)及びS(南緯)": {<br />
"label": "N(北緯)及びS(南緯)",<br />
"type": "string",<br />
"required": false<br />
},<br />
"経度度": {<br />
"label": "経度度",<br />
"type": "string",<br />
"required": false<br />
},<br />
"経度分": {<br />
"label": "経度分",<br />
"type": "string",<br />
"required": false<br />
},<br />
"経度秒": {<br />
"label": "経度秒",<br />
"type": "string",<br />
"required": false<br />
},<br />
"E(東経)及びW(西経)": {<br />
"label": "E(東経)及びW(西経)",<br />
"type": "string",<br />
"required": false<br />
},<br />
"地図国コード": {<br />
"label": "地図国コード",<br />
"type": "string",<br />
"required": false<br />
},<br />
"座標右上表示": {<br />
"label": "座標右上表示",<br />
"type": "string",<br />
"required": false<br />
},<br />
"位置図種類": {<br />
"label": "位置図種類",<br />
"type": "string",<br />
"required": false<br />
},<br />
"備考": {<br />
"label": "備考",<br />
"type": "string",<br />
"required": false<br />
},<br />
"画像サイズ": {},<br />
"pushpin_map": {},<br />
"latm": {},<br />
"latNS": {},<br />
"latd": {},<br />
"latitude": {},<br />
"longm": {},<br />
"longEW": {},<br />
"longd": {},<br />
"longitude": {},<br />
"lats": {},<br />
"longs": {},<br />
"pushpin_label_position": {},<br />
"map_size": {},<br />
"pushpin_map_caption": {},<br />
"status": {},<br />
"状態": {},<br />
"demolished": {},<br />
"destroyed": {},<br />
"崩落": {},<br />
"cancelled": {},<br />
"topped_out": {},<br />
"est_completion": {},<br />
"完成予定": {},<br />
"建設期間": {},<br />
"built": {},<br />
"constructed": {},<br />
"construction_period": {},<br />
"文化財": {<br />
"label": "文化財",<br />
"description": "文化財の指定・登録・認定等の有無",<br />
"type": "string"<br />
},<br />
"指定・登録等日": {<br />
"label": "指定・登録等日",<br />
"description": "文化財の指定・登録・認定等の行われた年月日",<br />
"type": "string"<br />
}<br />
},<br />
"paramOrder": [<br />
"名称",<br />
"画像",<br />
"画像説明",<br />
"旧名称",<br />
"用途",<br />
"旧用途",<br />
"設計者",<br />
"構造設計者",<br />
"設備設計者",<br />
"施工",<br />
"建築主",<br />
"事業主体",<br />
"管理運営",<br />
"構造形式",<br />
"敷地面積",<br />
"敷地面積ref",<br />
"敷地面積備考",<br />
"建築面積",<br />
"建築面積ref",<br />
"建築面積備考",<br />
"延床面積",<br />
"延床面積ref",<br />
"延床面積備考",<br />
"階数",<br />
"高さ",<br />
"エレベーター数",<br />
"戸数",<br />
"駐車台数",<br />
"着工",<br />
"竣工",<br />
"開館開所",<br />
"改築",<br />
"解体",<br />
"所在地郵便番号",<br />
"所在地",<br />
"位置",<br />
"緯度度",<br />
"緯度分",<br />
"緯度秒",<br />
"N(北緯)及びS(南緯)",<br />
"経度度",<br />
"経度分",<br />
"経度秒",<br />
"E(東経)及びW(西経)",<br />
"地図国コード",<br />
"座標右上表示",<br />
"位置図種類",<br />
"文化財",<br />
"指定・登録等日",<br />
"備考",<br />
"画像サイズ",<br />
"pushpin_map",<br />
"latm",<br />
"latNS",<br />
"latd",<br />
"latitude",<br />
"longm",<br />
"longEW",<br />
"longd",<br />
"longitude",<br />
"lats",<br />
"longs",<br />
"pushpin_label_position",<br />
"map_size",<br />
"pushpin_map_caption",<br />
"status",<br />
"状態",<br />
"demolished",<br />
"destroyed",<br />
"崩落",<br />
"cancelled",<br />
"topped_out",<br />
"est_completion",<br />
"完成予定",<br />
"建設期間",<br />
"built",<br />
"constructed",<br />
"construction_period"<br />
]<br />
}<br />
</templatedata><br />
<includeonly>{{sandbox other||<br />
<!-- カテゴリは以下に追加してください --><br />
{{デフォルトソート:けんちくふつ}}<br />
[[カテゴリ:建築物の基礎情報テンプレート|*]]<br />
}}</includeonly></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:Location_map&diff=2296
テンプレート:Location map
2021-02-21T14:53:01Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><includeonly>{{#invoke:Location map|main}}</includeonly><noinclude>{{documentation}}</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:Flatlist&diff=2294
テンプレート:Flatlist
2021-02-21T14:52:59Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><includeonly><div class="hlist hlist-separated {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|<br />
{{{1}}}<br />
</div>}}</includeonly><noinclude><br />
{{documentation}}<br />
</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:Coord&diff=2292
テンプレート:Coord
2021-02-21T14:52:58Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><includeonly>{{#invoke:Coordinates|coord}}</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:Clickable_button_2&diff=2290
テンプレート:Clickable button 2
2021-02-21T14:52:57Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>{{#invoke:Clickable button 2|main}}<noinclude><br />
{{Documentation}}<br />
</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:Clear&diff=2288
テンプレート:Clear
2021-02-21T14:52:57Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div><div style="clear:{{{1|both}}};"></div><noinclude>{{pp-template}}<br />
{{documentation}}<br />
</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88:%E5%BB%BA%E7%AF%89%E7%89%A9&diff=2286
テンプレート:建築物
2021-02-21T14:52:56Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>{{Infobox<br />
|tnavbar = 建築物<br />
|headerstyle=background:#808080; color:#fff;<br />
|labelstyle=background:#d3d3d3;<br />
|datastyle=background:#f0f0f0;<br />
|abovestyle=background:#808080; color:#fff;<br />
|belowstyle=text-align:right; font-size:x-small;<br />
|above={{{名称|{{PAGENAME}}}}}<br />
|image={{#invoke:InfoboxImage|InfoboxImage|image={{ #if: {{{画像|}}} | {{#ifeq:{{lc:{{{画像}}}}} | no | | {{{画像}}}}} | {{画像募集中|cat=地域に未分類の施設}} }}|size={{{画像サイズ|}}}|sizedefault=280px}}<br />
|caption={{{画像説明|}}}<br />
|image2 ={{#if:{{{pushpin_map|{{{位置図種類|}}}}}}|<div class="center">{{Location map|{{{pushpin_map|{{{位置図種類}}}}}}<br />
|alt = <br />
|lat = {{#if:{{Ifempty|{{{latm|}}}|{{{緯度分|}}}}}{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}| |{{Ifempty|{{{latd|}}}|{{{latitude|}}}|{{{緯度度|}}}}} }}<br />
|long = {{#if:{{Ifempty|{{{longm|}}}|{{{経度分|}}}}}{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}| |{{Ifempty|{{{longd|}}}|{{{longitude|}}}|{{{経度度|}}}}} }}<br />
|lat_deg={{#if:{{Ifempty|{{{latm|}}}|{{{緯度分|}}}}}{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}|{{Ifempty|{{{latd|}}}|{{{緯度度|}}}}}| }}<br />
|lat_min={{#if:{{Ifempty|{{{latm|}}}|{{{緯度分|}}}}}{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}|{{Ifempty|{{{latm|}}}|{{{緯度分|}}}}}| }}<br />
|lat_sec={{#if:{{Ifempty|{{{lats|}}}|{{{緯度秒|}}}}}{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}|{{Ifempty|{{{lats|}}}|{{{緯度秒|}}}}}| }}<br />
|lat_dir={{#if:{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}|{{Ifempty|{{{latNS|}}}|{{{N(北緯)及びS(南緯)|}}}}}| }}<br />
|lon_deg={{#if:{{Ifempty|{{{longm|}}}|{{{経度分|}}}}}{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}|{{Ifempty|{{{longd|}}}|{{{経度度|}}}}}| }}<br />
|lon_min={{#if:{{Ifempty|{{{longm|}}}|{{{経度分|}}}}}{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}|{{Ifempty|{{{longm|}}}|{{{経度分|}}}}}| }}<br />
|lon_sec={{#if:{{Ifempty|{{{longs|}}}|{{{経度秒|}}}}}{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}|{{Ifempty|{{{longs|}}}|{{{経度秒|}}}}}| }}<br />
|lon_dir={{#if:{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}|{{Ifempty|{{{longEW|}}}|{{{E(東経)及びW(西経)|}}}}}| }}<br />
|float = center<br />
|caption = <br />
|border = none<br />
|mark = Red pog.svg<br />
|marksize = 7<br />
|position = {{{pushpin_label_position|}}}<br />
|label = <br />
|width = {{#if:{{{map_size|}}}|{{{map_size}}}|250}}<br />
}}</div>}}<br />
|caption2 = {{{pushpin_map_caption|}}}<br />
|header1=情報<br />
|label2=旧名称<br />
|data2={{{旧名称|}}}<br />
|label3=用途<br />
|data3={{{用途|}}}<br />
|label4=旧用途<br />
|data4={{{旧用途|}}}<br />
|label5=設計者<br />
|data5={{{設計者|}}}<br />
|label6=構造設計者<br />
|data6={{{構造設計者|}}}<br />
|label7=設備設計者<br />
|data7={{{設備設計者|}}}<br />
|label8=施工<br />
|data8={{{施工|}}}<br />
|label9=建築主<br />
|data9={{{建築主|}}}<br />
|label10=事業主体<br />
|data10={{{事業主体|}}}<br />
|label11=管理運営<br />
|data11={{{管理運営|}}}<br />
|label12=構造形式<br />
|data12={{{構造形式|}}}<br />
|label13=敷地面積<br />
|data13={{#if:{{{敷地面積|}}}|{{formatnum:{{{敷地面積|}}}}} m&sup2;}} {{#if:{{{敷地面積ref|}}}|{{{敷地面積ref|}}}}} {{#if:{{{敷地面積備考|}}}|<div style="font-size:smaller;">※{{{敷地面積備考|}}}</div>}}<br />
|label14=建築面積<br />
|data14={{#if:{{{建築面積|}}}|{{formatnum:{{{建築面積|}}}}} m&sup2;}} {{#if:{{{建築面積ref|}}}|{{{建築面積ref|}}}}} {{#if:{{{敷地面積|}}}|{{#if:{{{建築面積|}}}|{{#switch: {{#expr: {{formatnum:{{{建築面積}}}|R}} / {{formatnum:{{{建築面積}}}|R}}}}| 1 = |}}}}}} {{#if:{{{建築面積備考|}}}|<div style="font-size:smaller;">※{{{建築面積備考|}}}</div>}}<br />
|label15=延床面積<br />
|data15={{#if:{{{延床面積|}}}|{{formatnum:{{{延床面積|}}}}} m&sup2;}} {{#if:{{{延床面積ref|}}}|{{{延床面積ref|}}}}} {{#if:{{{敷地面積|}}}|{{#if:{{{延床面積|}}}|{{#switch: {{#expr: {{formatnum:{{{延床面積}}}|R}} / {{formatnum:{{{延床面積}}}|R}}}}| 1 = |}}}}}} {{#if:{{{延床面積備考|}}}|<div style="font-size:smaller;">※{{{延床面積備考|}}}</div>}}<br />
| label16 = 状態<br />
| class16 = category<br />
| data16 = {{#if:{{{status|{{{状態|}}}}}}|{{#switch:{{{status|{{{状態}}}}}}<br />
| 完成<br />
| Built<br />
| Completed<br />
| Complete = {{color|#006400|完成}}<br />
| 崩落<br />
| Destroyed = {{color|#e42328|崩落}}<br />
| 解体<br />
| Demolished = {{color|#000000|解体}}<br />
| 保留<br />
| On hold = {{color|#800080|保留}}<br />
| 建設中<br />
| Under construction = {{color|#800080|建設中}}<br />
| 建設中止<br />
| 中止<br />
| Cancelled<br />
| Canceled<br />
| Never built = {{color|#ff0000|建設中止}}<br />
| Topped-out = <span>[[上棟式|トッピング・アウト]]</span><br />
| 計画<br />
| 計画中<br />
| Proposed = <span style="color:#ffa500">計画中</span><br />
| #default = {{{status|{{{状態}}}}}}<br />
}}|{{#if:{{{demolished|{{{解体|}}}}}}{{{destroyed|{{{崩落|}}}}}}{{{cancelled|}}}{{{topped_out|}}}{{{est_completion|{{{完成予定|}}}}}}{{{建設期間|{{{built|{{{constructed|{{{construction_period|}}} }}} }}} }}}|<br />
{{#if:{{{demolished|{{{解体|}}}}}}|{{color|black|解体}}}}<br />
{{#if:{{{destroyed|{{{崩落|}}}}}}|{{color|#e42328|崩落}}}}<br />
{{#if:{{{cancelled|}}}|{{color|red|建設中止}}}}<br />
{{#if:{{{topped_out|}}}|[[上棟式|トッピング・アウト]]}}<br />
{{#if:{{{est_completion|{{{完成予定|}}}}}}|{{color|purple|建設中}}}}<br />
{{#if:{{{建設期間|{{{built|{{{constructed|{{{construction_period|}}} }}} }}} }}}|{{color|darkgreen|完成}}}}<br />
|<!--<includeonly>{{color|orange|計画中}}</includeonly>-->}}<br />
}}<br />
|label17=階数<br />
|data17={{{階数|}}}<br />
|label18=高さ<br />
|data18={{{高さ|}}}<br />
|label19=エレベーター数<br />
|data19={{{エレベーター数|}}}<br />
|label20=戸数<br />
|data20={{{戸数|}}}<br />
|label21=駐車台数<br />
|data21={{{駐車台数|}}}<br />
|label22=着工<br />
|data22={{{着工|}}}<br />
|label23=竣工<br />
|data23={{{竣工|}}}<br />
|label24=開館開所<br />
|data24={{{開館開所|}}}<br />
|label25=改築<br />
|data25={{{改築|}}}<br />
|label26=解体<br />
|data26={{{解体|}}}<br />
|label27=所在地<br />
|data27={{#if:{{{所在地郵便番号|}}}|{{color|red|〒}}{{{所在地郵便番号}}}<br />}}{{{所在地|}}}<br />
|label28=[[地理座標系|座標]]<br />
|data28={{{位置|}}}{{ #if: {{{緯度度|}}} | {{Coord|{{{緯度度}}}|{{{緯度分|}}}|{{{緯度秒|}}}|{{ #if: {{{N(北緯)及びS(南緯)|}}} | {{{N(北緯)及びS(南緯)}}} | N }}|{{{経度度}}}|{{{経度分|}}}|{{{経度秒|}}}|{{ #if: {{{E(東経)及びW(西経)|}}} | {{{E(東経)及びW(西経)}}} | E }}|type:landmark_region:{{ #if: {{{地図国コード|}}} | {{{地図国コード}}} | <!--JP--> }}|name={{{座標名|{{{名称|{{PAGENAME}}}}}}}}|display=inline{{ #ifeq: {{lc:{{{座標右上表示|}}}}}|no||,title}}}}}}<br />
|label29=文化財<br />
|data29={{{文化財|{{{文化財指定|}}}}}}<br />
|label30=指定・登録等日<br />
|data30={{{指定・登録等日|{{{指定日|}}}}}}<br />
|label31=備考<br />
|data31={{{備考|}}}<br />
}}<includeonly>{{#if:{{Ifempty|{{{位置|}}}|{{{緯度度|}}}}}||[[Category:座標が指定されていない記事]]}}</includeonly><noinclude><br />
{{Documentation}}</noinclude></div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Wd/i18n&diff=2284
モジュール:Wd/i18n
2021-02-21T14:49:41Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>-- The values and functions in this submodule should be localized per wiki.<br />
<br />
local p = {}<br />
<br />
function p.init(aliasesP)<br />
p = {<br />
["errors"] = {<br />
["unknown-data-type"] = "'$1'は不明もしくは未対応のデータタイプです。",<br />
["missing-required-parameter"] = "必要なパラメータが定義されていません。最低限1つ必要です。",<br />
["extra-required-parameter"] = "パラメータ「'$1'」は任意として定義する必要があります。",<br />
["no-function-specified"] = "コールするためのファンクションを指定してください指定してください。", -- equal to the standard module error message<br />
["main-called-twice"] = 'ファンクション"main"は2度も呼び出せません。',<br />
["no-such-function"] = 'ファンクション「"$1"」が存在しません。' -- equal to the standard module error message<br />
},<br />
["info"] = {<br />
["edit-on-wikidata"] = "ウィキデータを編集"<br />
},<br />
["numeric"] = {<br />
["decimal-mark"] = ".",<br />
["delimiter"] = ","<br />
},<br />
["datetime"] = {<br />
["prefixes"] = {<br />
["decade-period"] = ""<br />
},<br />
["suffixes"] = {<br />
["decade-period"] = "年代",<br />
["millennium"] = "千年紀",<br />
["century"] = "世紀",<br />
["million-years"] = "百万年",<br />
["billion-years"] = "億年",<br />
["year"] = "年",<br />
["years"] = "年"<br />
},<br />
["julian-calendar"] = "ユリウス暦", -- linked page title<br />
["julian"] = "ユリウス暦",<br />
["BCE"] = "BCE",<br />
["CE"] = "CE",<br />
["common-era"] = "en:Common Era" -- linked page title<br />
},<br />
["coord"] = {<br />
["latitude-north"] = "北緯",<br />
["latitude-south"] = "南緯",<br />
["longitude-east"] = "東経",<br />
["longitude-west"] = "西経",<br />
["degrees"] = "度",<br />
["minutes"] = "分",<br />
["seconds"] = '秒',<br />
["separator"] = ", "<br />
},<br />
["values"] = {<br />
["unknown"] = "不明",<br />
["none"] = "無し"<br />
},<br />
["cite"] = {<br />
["version"] = "2", -- increase this each time the below parameters are changed to avoid conflict errors<br />
["web"] = {<br />
-- <= left side: all allowed reference properties for *web page sources* per https://www.wikidata.org/wiki/Help:Sources<br />
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite web]] (if non-existent, keep empty i.e. "")<br />
[aliasesP.statedIn] = "website",<br />
[aliasesP.referenceURL] = "url",<br />
[aliasesP.publicationDate] = "date",<br />
[aliasesP.retrieved] = "access-date",<br />
[aliasesP.title] = "title",<br />
[aliasesP.archiveURL] = "archive-url",<br />
[aliasesP.archiveDate] = "archive-date",<br />
[aliasesP.language] = "language",<br />
[aliasesP.author] = "author", -- existence of author1, author2, author3, etc. is assumed<br />
[aliasesP.publisher] = "publisher",<br />
[aliasesP.quote] = "quote",<br />
[aliasesP.pages] = "pages" -- extra option<br />
},<br />
["q"] = {<br />
-- <= left side: all allowed reference properties for *sources other than web pages* per https://www.wikidata.org/wiki/Help:Sources<br />
-- => right side: corresponding parameter names in (equivalent of) [[:en:Template:Cite Q]] (if non-existent, keep empty i.e. "")<br />
[aliasesP.statedIn] = "1",<br />
[aliasesP.pages] = "pages",<br />
[aliasesP.column] = "at",<br />
[aliasesP.chapter] = "chapter",<br />
[aliasesP.sectionVerseOrParagraph] = "section",<br />
["external-id"] = "id", -- used for any type of database property ID<br />
[aliasesP.title] = "title",<br />
[aliasesP.publicationDate] = "date",<br />
[aliasesP.retrieved] = "access-date"<br />
}<br />
}<br />
}<br />
<br />
p.getOrdinalSuffix = function(num)<br />
if tostring(num):sub(-2,-2) == '1' then<br />
return "" -- 10th, 11th, 12th, 13th, ... 19th<br />
end<br />
<br />
num = tostring(num):sub(-1)<br />
<br />
if num == '1' then<br />
return ""<br />
elseif num == '2' then<br />
return ""<br />
elseif num == '3' then<br />
return ""<br />
else<br />
return ""<br />
end<br />
end<br />
<br />
p.addDelimiters = function(n)<br />
local left, num, right = string.match(n, "^([^%d]*%d)(%d*)(.-)$")<br />
<br />
if left and num and right then<br />
return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. p['numeric']['delimiter']):reverse()) .. right<br />
else<br />
return n<br />
end<br />
end<br />
<br />
return p<br />
end<br />
<br />
return p</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Wd&diff=2282
モジュール:Wd
2021-02-21T14:49:41Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>-- Original module located at [[:en:Module:Wd]] and [[:en:Module:Wd/i18n]].<br />
<br />
local p = {}<br />
local arg = ...<br />
local i18n<br />
<br />
local function loadI18n(aliasesP, frame)<br />
local title<br />
<br />
if frame then<br />
-- current module invoked by page/template, get its title from frame<br />
title = frame:getTitle()<br />
else<br />
-- current module included by other module, get its title from ...<br />
title = arg<br />
end<br />
<br />
if not i18n then<br />
i18n = require(title .. "/i18n").init(aliasesP)<br />
end<br />
end<br />
<br />
p.claimCommands = {<br />
property = "property",<br />
properties = "properties",<br />
qualifier = "qualifier",<br />
qualifiers = "qualifiers",<br />
reference = "reference",<br />
references = "references"<br />
}<br />
<br />
p.generalCommands = {<br />
label = "label",<br />
title = "title",<br />
description = "description",<br />
alias = "alias",<br />
aliases = "aliases",<br />
badge = "badge",<br />
badges = "badges"<br />
}<br />
<br />
p.flags = {<br />
linked = "linked",<br />
short = "short",<br />
raw = "raw",<br />
multilanguage = "multilanguage",<br />
unit = "unit",<br />
-------------<br />
preferred = "preferred",<br />
normal = "normal",<br />
deprecated = "deprecated",<br />
best = "best",<br />
future = "future",<br />
current = "current",<br />
former = "former",<br />
edit = "edit",<br />
editAtEnd = "edit@end",<br />
mdy = "mdy",<br />
single = "single",<br />
sourced = "sourced"<br />
}<br />
<br />
p.args = {<br />
eid = "eid",<br />
page = "page",<br />
date = "date"<br />
}<br />
<br />
local aliasesP = {<br />
coord = "P625",<br />
-----------------------<br />
image = "P18",<br />
author = "P50",<br />
publisher = "P123",<br />
importedFrom = "P143",<br />
statedIn = "P248",<br />
pages = "P304",<br />
language = "P407",<br />
hasPart = "P527",<br />
publicationDate = "P577",<br />
startTime = "P580",<br />
endTime = "P582",<br />
chapter = "P792",<br />
retrieved = "P813",<br />
referenceURL = "P854",<br />
sectionVerseOrParagraph = "P958",<br />
archiveURL = "P1065",<br />
title = "P1476",<br />
formatterURL = "P1630",<br />
quote = "P1683",<br />
shortName = "P1813",<br />
definingFormula = "P2534",<br />
archiveDate = "P2960",<br />
inferredFrom = "P3452",<br />
typeOfReference = "P3865",<br />
column = "P3903"<br />
}<br />
<br />
local aliasesQ = {<br />
percentage = "Q11229",<br />
prolepticJulianCalendar = "Q1985786",<br />
citeWeb = "Q5637226",<br />
citeQ = "Q22321052"<br />
}<br />
<br />
local parameters = {<br />
property = "%p",<br />
qualifier = "%q",<br />
reference = "%r",<br />
alias = "%a",<br />
badge = "%b",<br />
separator = "%s",<br />
general = "%x"<br />
}<br />
<br />
local formats = {<br />
property = "%p[%s][%r]",<br />
qualifier = "%q[%s][%r]",<br />
reference = "%r",<br />
propertyWithQualifier = "%p[ <span style=\"font-size:85\\%\">(%q)</span>][%s][%r]",<br />
alias = "%a[%s]",<br />
badge = "%b[%s]"<br />
}<br />
<br />
local hookNames = { -- {level_1, level_2}<br />
[parameters.property] = {"getProperty"},<br />
[parameters.reference] = {"getReferences", "getReference"},<br />
[parameters.qualifier] = {"getAllQualifiers"},<br />
[parameters.qualifier.."\\d"] = {"getQualifiers", "getQualifier"},<br />
[parameters.alias] = {"getAlias"},<br />
[parameters.badge] = {"getBadge"}<br />
}<br />
<br />
-- default value objects, should NOT be mutated but instead copied<br />
local defaultSeparators = {<br />
["sep"] = {" "},<br />
["sep%s"] = {","},<br />
["sep%q"] = {"; "},<br />
["sep%q\\d"] = {", "},<br />
["sep%r"] = nil, -- none<br />
["punc"] = nil -- none<br />
}<br />
<br />
local rankTable = {<br />
["preferred"] = 1,<br />
["normal"] = 2,<br />
["deprecated"] = 3<br />
}<br />
<br />
local Config = {}<br />
<br />
-- allows for recursive calls<br />
function Config:new()<br />
local cfg = {}<br />
setmetatable(cfg, self)<br />
self.__index = self<br />
<br />
cfg.separators = {<br />
-- single value objects wrapped in arrays so that we can pass by reference<br />
["sep"] = {copyTable(defaultSeparators["sep"])},<br />
["sep%s"] = {copyTable(defaultSeparators["sep%s"])},<br />
["sep%q"] = {copyTable(defaultSeparators["sep%q"])},<br />
["sep%r"] = {copyTable(defaultSeparators["sep%r"])},<br />
["punc"] = {copyTable(defaultSeparators["punc"])}<br />
}<br />
<br />
cfg.entity = nil<br />
cfg.entityID = nil<br />
cfg.propertyID = nil<br />
cfg.propertyValue = nil<br />
cfg.qualifierIDs = {}<br />
cfg.qualifierIDsAndValues = {}<br />
<br />
cfg.bestRank = true<br />
cfg.ranks = {true, true, false} -- preferred = true, normal = true, deprecated = false<br />
cfg.foundRank = #cfg.ranks<br />
cfg.flagBest = false<br />
cfg.flagRank = false<br />
<br />
cfg.periods = {true, true, true} -- future = true, current = true, former = true<br />
cfg.flagPeriod = false<br />
cfg.atDate = {parseDate(os.date('!%Y-%m-%d'))} -- today as {year, month, day}<br />
<br />
cfg.mdyDate = false<br />
cfg.singleClaim = false<br />
cfg.sourcedOnly = false<br />
cfg.editable = false<br />
cfg.editAtEnd = false<br />
<br />
cfg.inSitelinks = false<br />
<br />
cfg.langCode = mw.language.getContentLanguage().code<br />
cfg.langName = mw.language.fetchLanguageName(cfg.langCode, cfg.langCode)<br />
cfg.langObj = mw.language.new(cfg.langCode)<br />
<br />
cfg.siteID = mw.wikibase.getGlobalSiteId()<br />
<br />
cfg.states = {}<br />
cfg.states.qualifiersCount = 0<br />
cfg.curState = nil<br />
<br />
cfg.prefetchedRefs = nil<br />
<br />
return cfg<br />
end<br />
<br />
local State = {}<br />
<br />
function State:new(cfg, type)<br />
local stt = {}<br />
setmetatable(stt, self)<br />
self.__index = self<br />
<br />
stt.conf = cfg<br />
stt.type = type<br />
<br />
stt.results = {}<br />
<br />
stt.parsedFormat = {}<br />
stt.separator = {}<br />
stt.movSeparator = {}<br />
stt.puncMark = {}<br />
<br />
stt.linked = false<br />
stt.rawValue = false<br />
stt.shortName = false<br />
stt.anyLanguage = false<br />
stt.unitOnly = false<br />
stt.singleValue = false<br />
<br />
return stt<br />
end<br />
<br />
local function replaceAlias(id)<br />
if aliasesP[id] then<br />
id = aliasesP[id]<br />
end<br />
<br />
return id<br />
end<br />
<br />
local function errorText(code, param)<br />
local text = i18n["errors"][code]<br />
if param then text = mw.ustring.gsub(text, "$1", param) end<br />
return text<br />
end<br />
<br />
local function throwError(errorMessage, param)<br />
error(errorText(errorMessage, param))<br />
end<br />
<br />
local function replaceDecimalMark(num)<br />
return mw.ustring.gsub(num, "[.]", i18n['numeric']['decimal-mark'], 1)<br />
end<br />
<br />
local function padZeros(num, numDigits)<br />
local numZeros<br />
local negative = false<br />
<br />
if num < 0 then<br />
negative = true<br />
num = num * -1<br />
end<br />
<br />
num = tostring(num)<br />
numZeros = numDigits - num:len()<br />
<br />
for _ = 1, numZeros do<br />
num = "0"..num<br />
end<br />
<br />
if negative then<br />
num = "-"..num<br />
end<br />
<br />
return num<br />
end<br />
<br />
local function replaceSpecialChar(chr)<br />
if chr == '_' then<br />
-- replace underscores with spaces<br />
return ' '<br />
else<br />
return chr<br />
end<br />
end<br />
<br />
local function replaceSpecialChars(str)<br />
local chr<br />
local esc = false<br />
local strOut = ""<br />
<br />
for i = 1, #str do<br />
chr = str:sub(i,i)<br />
<br />
if not esc then<br />
if chr == '\\' then<br />
esc = true<br />
else<br />
strOut = strOut .. replaceSpecialChar(chr)<br />
end<br />
else<br />
strOut = strOut .. chr<br />
esc = false<br />
end<br />
end<br />
<br />
return strOut<br />
end<br />
<br />
local function buildWikilink(target, label)<br />
if not label or target == label then<br />
return "[[" .. target .. "]]"<br />
else<br />
return "[[" .. target .. "|" .. label .. "]]"<br />
end<br />
end<br />
<br />
-- used to make frame.args mutable, to replace #frame.args (which is always 0)<br />
-- with the actual amount and to simply copy tables<br />
function copyTable(tIn)<br />
if not tIn then<br />
return nil<br />
end<br />
<br />
local tOut = {}<br />
<br />
for i, v in pairs(tIn) do<br />
tOut[i] = v<br />
end<br />
<br />
return tOut<br />
end<br />
<br />
-- used to merge output arrays together;<br />
-- note that it currently mutates the first input array<br />
local function mergeArrays(a1, a2)<br />
for i = 1, #a2 do<br />
a1[#a1 + 1] = a2[i]<br />
end<br />
<br />
return a1<br />
end<br />
<br />
local function split(str, del)<br />
local out = {}<br />
local i, j = str:find(del)<br />
<br />
if i and j then<br />
out[1] = str:sub(1, i - 1)<br />
out[2] = str:sub(j + 1)<br />
else<br />
out[1] = str<br />
end<br />
<br />
return out<br />
end<br />
<br />
local function parseWikidataURL(url)<br />
local id<br />
<br />
if url:match('^http[s]?://') then<br />
id = split(url, "Q")<br />
<br />
if id[2] then<br />
return "Q" .. id[2]<br />
end<br />
end<br />
<br />
return nil<br />
end<br />
<br />
function parseDate(dateStr, precision)<br />
precision = precision or "d"<br />
<br />
local i, j, index, ptr<br />
local parts = {nil, nil, nil}<br />
<br />
if dateStr == nil then<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
-- 'T' for snak values, '/' for outputs with '/Julian' attached<br />
i, j = dateStr:find("[T/]")<br />
<br />
if i then<br />
dateStr = dateStr:sub(1, i-1)<br />
end<br />
<br />
local from = 1<br />
<br />
if dateStr:sub(1,1) == "-" then<br />
-- this is a negative number, look further ahead<br />
from = 2<br />
end<br />
<br />
index = 1<br />
ptr = 1<br />
<br />
i, j = dateStr:find("-", from)<br />
<br />
if i then<br />
-- year<br />
parts[index] = tonumber(mw.ustring.gsub(dateStr:sub(ptr, i-1), "^\+(.+)$", "%1"), 10) -- remove '+' sign (explicitly give base 10 to prevent error)<br />
<br />
if parts[index] == -0 then<br />
parts[index] = tonumber("0") -- for some reason, 'parts[index] = 0' may actually store '-0', so parse from string instead<br />
end<br />
<br />
if precision == "y" then<br />
-- we're done<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
index = index + 1<br />
ptr = i + 1<br />
<br />
i, j = dateStr:find("-", ptr)<br />
<br />
if i then<br />
-- month<br />
parts[index] = tonumber(dateStr:sub(ptr, i-1), 10)<br />
<br />
if precision == "m" then<br />
-- we're done<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
index = index + 1<br />
ptr = i + 1<br />
end<br />
end<br />
<br />
if dateStr:sub(ptr) ~= "" then<br />
-- day if we have month, month if we have year, or year<br />
parts[index] = tonumber(dateStr:sub(ptr), 10)<br />
end<br />
<br />
return parts[1], parts[2], parts[3] -- year, month, day<br />
end<br />
<br />
local function datePrecedesDate(aY, aM, aD, bY, bM, bD)<br />
if aY == nil or bY == nil then<br />
return nil<br />
end<br />
aM = aM or 1<br />
aD = aD or 1<br />
bM = bM or 1<br />
bD = bD or 1<br />
<br />
if aY < bY then<br />
return true<br />
end<br />
<br />
if aY > bY then<br />
return false<br />
end<br />
<br />
if aM < bM then<br />
return true<br />
end<br />
<br />
if aM > bM then<br />
return false<br />
end<br />
<br />
if aD < bD then<br />
return true<br />
end<br />
<br />
return false<br />
end<br />
<br />
local function getHookName(param, index)<br />
if hookNames[param] then<br />
return hookNames[param][index]<br />
elseif param:len() > 2 then<br />
return hookNames[param:sub(1, 2).."\\d"][index]<br />
else<br />
return nil<br />
end<br />
end<br />
<br />
local function alwaysTrue()<br />
return true<br />
end<br />
<br />
-- The following function parses a format string.<br />
--<br />
-- The example below shows how a parsed string is structured in memory.<br />
-- Variables other than 'str' and 'child' are left out for clarity's sake.<br />
--<br />
-- Example:<br />
-- "A %p B [%s[%q1]] C [%r] D"<br />
--<br />
-- Structure:<br />
-- [<br />
-- {<br />
-- str = "A "<br />
-- },<br />
-- {<br />
-- str = "%p"<br />
-- },<br />
-- {<br />
-- str = " B ",<br />
-- child =<br />
-- [<br />
-- {<br />
-- str = "%s",<br />
-- child =<br />
-- [<br />
-- {<br />
-- str = "%q1"<br />
-- }<br />
-- ]<br />
-- }<br />
-- ]<br />
-- },<br />
-- {<br />
-- str = " C ",<br />
-- child =<br />
-- [<br />
-- {<br />
-- str = "%r"<br />
-- }<br />
-- ]<br />
-- },<br />
-- {<br />
-- str = " D"<br />
-- }<br />
-- ]<br />
--<br />
local function parseFormat(str)<br />
local chr, esc, param, root, cur, prev, new<br />
local params = {}<br />
<br />
local function newObject(array)<br />
local obj = {} -- new object<br />
obj.str = ""<br />
<br />
array[#array + 1] = obj -- array{object}<br />
obj.parent = array<br />
<br />
return obj<br />
end<br />
<br />
local function endParam()<br />
if param > 0 then<br />
if cur.str ~= "" then<br />
cur.str = "%"..cur.str<br />
cur.param = true<br />
params[cur.str] = true<br />
cur.parent.req[cur.str] = true<br />
prev = cur<br />
cur = newObject(cur.parent)<br />
end<br />
param = 0<br />
end<br />
end<br />
<br />
root = {} -- array<br />
root.req = {}<br />
cur = newObject(root)<br />
prev = nil<br />
<br />
esc = false<br />
param = 0<br />
<br />
for i = 1, #str do<br />
chr = str:sub(i,i)<br />
<br />
if not esc then<br />
if chr == '\\' then<br />
endParam()<br />
esc = true<br />
elseif chr == '%' then<br />
endParam()<br />
if cur.str ~= "" then<br />
cur = newObject(cur.parent)<br />
end<br />
param = 2<br />
elseif chr == '[' then<br />
endParam()<br />
if prev and cur.str == "" then<br />
table.remove(cur.parent)<br />
cur = prev<br />
end<br />
cur.child = {} -- new array<br />
cur.child.req = {}<br />
cur.child.parent = cur<br />
cur = newObject(cur.child)<br />
elseif chr == ']' then<br />
endParam()<br />
if cur.parent.parent then<br />
new = newObject(cur.parent.parent.parent)<br />
if cur.str == "" then<br />
table.remove(cur.parent)<br />
end<br />
cur = new<br />
end<br />
else<br />
if param > 1 then<br />
param = param - 1<br />
elseif param == 1 then<br />
if not chr:match('%d') then<br />
endParam()<br />
end<br />
end<br />
<br />
cur.str = cur.str .. replaceSpecialChar(chr)<br />
end<br />
else<br />
cur.str = cur.str .. chr<br />
esc = false<br />
end<br />
<br />
prev = nil<br />
end<br />
<br />
endParam()<br />
<br />
-- make sure that at least one required parameter has been defined<br />
if not next(root.req) then<br />
throwError("missing-required-parameter")<br />
end<br />
<br />
-- make sure that the separator parameter "%s" is not amongst the required parameters<br />
if root.req[parameters.separator] then<br />
throwError("extra-required-parameter", parameters.separator)<br />
end<br />
<br />
return root, params<br />
end<br />
<br />
local function sortOnRank(claims)<br />
local rankPos<br />
local ranks = {{}, {}, {}, {}} -- preferred, normal, deprecated, (default)<br />
local sorted = {}<br />
<br />
for _, v in ipairs(claims) do<br />
rankPos = rankTable[v.rank] or 4<br />
ranks[rankPos][#ranks[rankPos] + 1] = v<br />
end<br />
<br />
sorted = ranks[1]<br />
sorted = mergeArrays(sorted, ranks[2])<br />
sorted = mergeArrays(sorted, ranks[3])<br />
<br />
return sorted<br />
end<br />
<br />
-- if id == nil then item connected to current page is used<br />
function Config:getLabel(id, raw, link, short)<br />
local label = nil<br />
local title = nil<br />
local prefix= ""<br />
<br />
if not id then<br />
id = mw.wikibase.getEntityIdForCurrentPage()<br />
<br />
if not id then<br />
return ""<br />
end<br />
end<br />
<br />
id = id:upper() -- just to be sure<br />
<br />
if raw then<br />
-- check if given id actually exists<br />
if mw.wikibase.isValidEntityId(id) and mw.wikibase.entityExists(id) then<br />
label = id<br />
<br />
if id:sub(1,1) == "P" then<br />
prefix = "Property:"<br />
end<br />
end<br />
<br />
prefix = "d:" .. prefix<br />
<br />
title = label -- may be nil<br />
else<br />
-- try short name first if requested<br />
if short then<br />
label = p._property{aliasesP.shortName, [p.args.eid] = id} -- get short name<br />
<br />
if label == "" then<br />
label = nil<br />
end<br />
end<br />
<br />
-- get label<br />
if not label then<br />
label = mw.wikibase.getLabelByLang(id, self.langCode)<br />
end<br />
end<br />
<br />
if not label then<br />
label = ""<br />
elseif link then<br />
-- build a link if requested<br />
if not title then<br />
if id:sub(1,1) == "Q" then<br />
title = mw.wikibase.getSitelink(id)<br />
elseif id:sub(1,1) == "P" then<br />
-- properties have no sitelink, link to Wikidata instead<br />
title = id<br />
prefix = "d:Property:"<br />
end<br />
end<br />
<br />
if title then<br />
label = buildWikilink(prefix .. title, label)<br />
end<br />
end<br />
<br />
return label<br />
end<br />
<br />
function Config:getEditIcon()<br />
local value = ""<br />
local prefix = ""<br />
local front = "&nbsp;"<br />
local back = ""<br />
<br />
if self.entityID:sub(1,1) == "P" then<br />
prefix = "Property:"<br />
end<br />
<br />
if self.editAtEnd then<br />
front = '<span style="float:'<br />
<br />
if self.langObj:isRTL() then<br />
front = front .. 'left'<br />
else<br />
front = front .. 'right'<br />
end<br />
<br />
front = front .. '">'<br />
back = '</span>'<br />
end<br />
<br />
value = "[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=" .. i18n['info']['edit-on-wikidata'] .. "|link=https://www.wikidata.org/wiki/" .. prefix .. self.entityID .. "?uselang=" .. self.langCode<br />
<br />
if self.propertyID then<br />
value = value .. "#" .. self.propertyID<br />
elseif self.inSitelinks then<br />
value = value .. "#sitelinks-wikipedia"<br />
end<br />
<br />
value = value .. "|" .. i18n['info']['edit-on-wikidata'] .. "]]"<br />
<br />
return front .. value .. back<br />
end<br />
<br />
-- used to create the final output string when it's all done, so that for references the<br />
-- function extensionTag("ref", ...) is only called when they really ended up in the final output<br />
function Config:concatValues(valuesArray)<br />
local outString = ""<br />
local j, skip<br />
<br />
for i = 1, #valuesArray do<br />
-- check if this is a reference<br />
if valuesArray[i].refHash then<br />
j = i - 1<br />
skip = false<br />
<br />
-- skip this reference if it is part of a continuous row of references that already contains the exact same reference<br />
while valuesArray[j] and valuesArray[j].refHash do<br />
if valuesArray[i].refHash == valuesArray[j].refHash then<br />
skip = true<br />
break<br />
end<br />
j = j - 1<br />
end<br />
<br />
if not skip then<br />
-- add <ref> tag with the reference's hash as its name (to deduplicate references)<br />
outString = outString .. mw.getCurrentFrame():extensionTag("ref", valuesArray[i][1], {name = valuesArray[i].refHash})<br />
end<br />
else<br />
outString = outString .. valuesArray[i][1]<br />
end<br />
end<br />
<br />
return outString<br />
end<br />
<br />
function Config:convertUnit(unit, raw, link, short, unitOnly)<br />
local space = " "<br />
local label = ""<br />
local itemID<br />
<br />
if unit == "" or unit == "1" then<br />
return nil<br />
end<br />
<br />
if unitOnly then<br />
space = ""<br />
end<br />
<br />
itemID = parseWikidataURL(unit)<br />
<br />
if itemID then<br />
if itemID == aliasesQ.percentage then<br />
return "%"<br />
else<br />
label = self:getLabel(itemID, raw, link, short)<br />
<br />
if label ~= "" then<br />
return space .. label<br />
end<br />
end<br />
end<br />
<br />
return ""<br />
end<br />
<br />
function State:getValue(snak)<br />
return self.conf:getValue(snak, self.rawValue, self.linked, self.shortName, self.anyLanguage, self.unitOnly, false, self.type:sub(1,2))<br />
end<br />
<br />
function Config:getValue(snak, raw, link, short, anyLang, unitOnly, noSpecial, type)<br />
if snak.snaktype == 'value' then<br />
local datatype = snak.datavalue.type<br />
local subtype = snak.datatype<br />
local datavalue = snak.datavalue.value<br />
<br />
if datatype == 'string' then<br />
if subtype == 'url' and link then<br />
-- create link explicitly<br />
if raw then<br />
-- will render as a linked number like [1]<br />
return "[" .. datavalue .. "]"<br />
else<br />
return "[" .. datavalue .. " " .. datavalue .. "]"<br />
end<br />
elseif subtype == 'commonsMedia' then<br />
if link then<br />
return buildWikilink("c:File:" .. datavalue, datavalue)<br />
elseif not raw then<br />
return "[[File:" .. datavalue .. "]]"<br />
else<br />
return datavalue<br />
end<br />
elseif subtype == 'geo-shape' and link then<br />
return buildWikilink("c:" .. datavalue, datavalue)<br />
elseif subtype == 'math' and not raw then<br />
local attribute = nil<br />
<br />
if (type == parameters.property or (type == parameters.qualifier and self.propertyID == aliasesP.hasPart)) and snak.property == aliasesP.definingFormula then<br />
attribute = {qid = self.entityID}<br />
end<br />
<br />
return mw.getCurrentFrame():extensionTag("math", datavalue, attribute)<br />
elseif subtype == 'external-id' and link then<br />
local url = p._property{aliasesP.formatterURL, [p.args.eid] = snak.property} -- get formatter URL<br />
<br />
if url ~= "" then<br />
url = mw.ustring.gsub(url, "$1", datavalue)<br />
return "[" .. url .. " " .. datavalue .. "]"<br />
else<br />
return datavalue<br />
end<br />
else<br />
return datavalue<br />
end<br />
elseif datatype == 'monolingualtext' then<br />
if anyLang or datavalue['language'] == self.langCode then<br />
return datavalue['text']<br />
else<br />
return nil<br />
end<br />
elseif datatype == 'quantity' then<br />
local value = ""<br />
local unit<br />
<br />
if not unitOnly then<br />
-- get value and strip + signs from front<br />
value = mw.ustring.gsub(datavalue['amount'], "^\+(.+)$", "%1")<br />
<br />
if raw then<br />
return value<br />
end<br />
<br />
-- replace decimal mark based on locale<br />
value = replaceDecimalMark(value)<br />
<br />
-- add delimiters for readability<br />
value = i18n.addDelimiters(value)<br />
end<br />
<br />
unit = self:convertUnit(datavalue['unit'], raw, link, short, unitOnly)<br />
<br />
if unit then<br />
value = value .. unit<br />
end<br />
<br />
return value<br />
elseif datatype == 'time' then<br />
local y, m, d, p, yDiv, yRound, yFull, value, calendarID, dateStr<br />
local yFactor = 1<br />
local sign = 1<br />
local prefix = ""<br />
local suffix = ""<br />
local mayAddCalendar = false<br />
local calendar = ""<br />
local precision = datavalue['precision']<br />
<br />
if precision == 11 then<br />
p = "d"<br />
elseif precision == 10 then<br />
p = "m"<br />
else<br />
p = "y"<br />
yFactor = 10^(9-precision)<br />
end<br />
<br />
y, m, d = parseDate(datavalue['time'], p)<br />
<br />
if y < 0 then<br />
sign = -1<br />
y = y * sign<br />
end<br />
<br />
-- if precision is tens/hundreds/thousands/millions/billions of years<br />
if precision <= 8 then<br />
yDiv = y / yFactor<br />
<br />
-- if precision is tens/hundreds/thousands of years<br />
if precision >= 6 then<br />
mayAddCalendar = true<br />
<br />
if precision <= 7 then<br />
-- round centuries/millenniums up (e.g. 20th century or 3rd millennium)<br />
yRound = math.ceil(yDiv)<br />
<br />
if not raw then<br />
if precision == 6 then<br />
suffix = i18n['datetime']['suffixes']['millennium']<br />
else<br />
suffix = i18n['datetime']['suffixes']['century']<br />
end<br />
<br />
suffix = i18n.getOrdinalSuffix(yRound) .. suffix<br />
else<br />
-- if not verbose, take the first year of the century/millennium<br />
-- (e.g. 1901 for 20th century or 2001 for 3rd millennium)<br />
yRound = (yRound - 1) * yFactor + 1<br />
end<br />
else<br />
-- precision == 8<br />
-- round decades down (e.g. 2010s)<br />
yRound = math.floor(yDiv) * yFactor<br />
<br />
if not raw then<br />
prefix = i18n['datetime']['prefixes']['decade-period']<br />
suffix = i18n['datetime']['suffixes']['decade-period']<br />
end<br />
end<br />
<br />
if raw and sign < 0 then<br />
-- if BCE then compensate for "counting backwards"<br />
-- (e.g. -2019 for 2010s BCE, -2000 for 20th century BCE or -3000 for 3rd millennium BCE)<br />
yRound = yRound + yFactor - 1<br />
end<br />
else<br />
local yReFactor, yReDiv, yReRound<br />
<br />
-- round to nearest for tens of thousands of years or more<br />
yRound = math.floor(yDiv + 0.5)<br />
<br />
if yRound == 0 then<br />
if precision <= 2 and y ~= 0 then<br />
yReFactor = 1e6<br />
yReDiv = y / yReFactor<br />
yReRound = math.floor(yReDiv + 0.5)<br />
<br />
if yReDiv == yReRound then<br />
-- change precision to millions of years only if we have a whole number of them<br />
precision = 3<br />
yFactor = yReFactor<br />
yRound = yReRound<br />
end<br />
end<br />
<br />
if yRound == 0 then<br />
-- otherwise, take the unrounded (original) number of years<br />
precision = 5<br />
yFactor = 1<br />
yRound = y<br />
mayAddCalendar = true<br />
end<br />
end<br />
<br />
if precision >= 1 and y ~= 0 then<br />
yFull = yRound * yFactor<br />
<br />
yReFactor = 1e9<br />
yReDiv = yFull / yReFactor<br />
yReRound = math.floor(yReDiv + 0.5)<br />
<br />
if yReDiv == yReRound then<br />
-- change precision to billions of years if we're in that range<br />
precision = 0<br />
yFactor = yReFactor<br />
yRound = yReRound<br />
else<br />
yReFactor = 1e6<br />
yReDiv = yFull / yReFactor<br />
yReRound = math.floor(yReDiv + 0.5)<br />
<br />
if yReDiv == yReRound then<br />
-- change precision to millions of years if we're in that range<br />
precision = 3<br />
yFactor = yReFactor<br />
yRound = yReRound<br />
end<br />
end<br />
end<br />
<br />
if not raw then<br />
if precision == 3 then<br />
suffix = i18n['datetime']['suffixes']['million-years']<br />
elseif precision == 0 then<br />
suffix = i18n['datetime']['suffixes']['billion-years']<br />
else<br />
yRound = yRound * yFactor<br />
if yRound == 1 then<br />
suffix = i18n['datetime']['suffixes']['year']<br />
else<br />
suffix = i18n['datetime']['suffixes']['years']<br />
end<br />
end<br />
else<br />
yRound = yRound * yFactor<br />
end<br />
end<br />
else<br />
yRound = y<br />
mayAddCalendar = true<br />
end<br />
<br />
if mayAddCalendar then<br />
calendarID = parseWikidataURL(datavalue['calendarmodel'])<br />
<br />
if calendarID and calendarID == aliasesQ.prolepticJulianCalendar then<br />
if not raw then<br />
if link then<br />
calendar = " ("..buildWikilink(i18n['datetime']['julian-calendar'], i18n['datetime']['julian'])..")"<br />
else<br />
calendar = " ("..i18n['datetime']['julian']..")"<br />
end<br />
else<br />
calendar = "/"..i18n['datetime']['julian']<br />
end<br />
end<br />
end<br />
<br />
if not raw then<br />
local ce = nil<br />
<br />
if sign < 0 then<br />
ce = i18n['datetime']['BCE']<br />
elseif precision <= 5 then<br />
ce = i18n['datetime']['CE']<br />
end<br />
<br />
if ce then<br />
if link then<br />
ce = buildWikilink(i18n['datetime']['common-era'], ce)<br />
end<br />
suffix = suffix .. " " .. ce<br />
end<br />
<br />
value = tostring(yRound)<br />
<br />
if m then<br />
dateStr = self.langObj:formatDate("F", "1-"..m.."-1")<br />
<br />
if d then<br />
if self.mdyDate then<br />
dateStr = dateStr .. " " .. d .. ","<br />
else<br />
dateStr = d .. " " .. dateStr<br />
end<br />
end<br />
<br />
value = dateStr .. " " .. value<br />
end<br />
<br />
value = prefix .. value .. suffix .. calendar<br />
else<br />
value = padZeros(yRound * sign, 4)<br />
<br />
if m then<br />
value = value .. "-" .. padZeros(m, 2)<br />
<br />
if d then<br />
value = value .. "-" .. padZeros(d, 2)<br />
end<br />
end<br />
<br />
value = value .. calendar<br />
end<br />
<br />
return value<br />
elseif datatype == 'globecoordinate' then<br />
-- logic from https://github.com/DataValues/Geo (v4.0.1)<br />
<br />
local precision, unitsPerDegree, numDigits, strFormat, value, globe<br />
local latitude, latConv, latValue, latLink<br />
local longitude, lonConv, lonValue, lonLink<br />
local latDirection, latDirectionN, latDirectionS, latDirectionEN<br />
local lonDirection, lonDirectionE, lonDirectionW, lonDirectionEN<br />
local degSymbol, minSymbol, secSymbol, separator<br />
<br />
local latDegrees = nil<br />
local latMinutes = nil<br />
local latSeconds = nil<br />
local lonDegrees = nil<br />
local lonMinutes = nil<br />
local lonSeconds = nil<br />
<br />
local latDegSym = ""<br />
local latMinSym = ""<br />
local latSecSym = ""<br />
local lonDegSym = ""<br />
local lonMinSym = ""<br />
local lonSecSym = ""<br />
<br />
local latDirectionEN_N = "N"<br />
local latDirectionEN_S = "S"<br />
local lonDirectionEN_E = "E"<br />
local lonDirectionEN_W = "W"<br />
<br />
if not raw then<br />
latDirectionN = i18n['coord']['latitude-north']<br />
latDirectionS = i18n['coord']['latitude-south']<br />
lonDirectionE = i18n['coord']['longitude-east']<br />
lonDirectionW = i18n['coord']['longitude-west']<br />
<br />
degSymbol = i18n['coord']['degrees']<br />
minSymbol = i18n['coord']['minutes']<br />
secSymbol = i18n['coord']['seconds']<br />
separator = i18n['coord']['separator']<br />
else<br />
latDirectionN = latDirectionEN_N<br />
latDirectionS = latDirectionEN_S<br />
lonDirectionE = lonDirectionEN_E<br />
lonDirectionW = lonDirectionEN_W<br />
<br />
degSymbol = "/"<br />
minSymbol = "/"<br />
secSymbol = "/"<br />
separator = "/"<br />
end<br />
<br />
latitude = datavalue['latitude']<br />
longitude = datavalue['longitude']<br />
<br />
if latitude < 0 then<br />
latDirection = latDirectionS<br />
latDirectionEN = latDirectionEN_S<br />
latitude = math.abs(latitude)<br />
else<br />
latDirection = latDirectionN<br />
latDirectionEN = latDirectionEN_N<br />
end<br />
<br />
if longitude < 0 then<br />
lonDirection = lonDirectionW<br />
lonDirectionEN = lonDirectionEN_W<br />
longitude = math.abs(longitude)<br />
else<br />
lonDirection = lonDirectionE<br />
lonDirectionEN = lonDirectionEN_E<br />
end<br />
<br />
precision = datavalue['precision']<br />
<br />
if not precision or precision <= 0 then<br />
precision = 1 / 3600 -- precision not set (correctly), set to arcsecond<br />
end<br />
<br />
-- remove insignificant detail<br />
latitude = math.floor(latitude / precision + 0.5) * precision<br />
longitude = math.floor(longitude / precision + 0.5) * precision<br />
<br />
if precision >= 1 - (1 / 60) and precision < 1 then<br />
precision = 1<br />
elseif precision >= (1 / 60) - (1 / 3600) and precision < (1 / 60) then<br />
precision = 1 / 60<br />
end<br />
<br />
if precision >= 1 then<br />
unitsPerDegree = 1<br />
elseif precision >= (1 / 60) then<br />
unitsPerDegree = 60<br />
else<br />
unitsPerDegree = 3600<br />
end<br />
<br />
numDigits = math.ceil(-math.log10(unitsPerDegree * precision))<br />
<br />
if numDigits <= 0 then<br />
numDigits = tonumber("0") -- for some reason, 'numDigits = 0' may actually store '-0', so parse from string instead<br />
end<br />
<br />
strFormat = "%." .. numDigits .. "f"<br />
<br />
if precision >= 1 then<br />
latDegrees = strFormat:format(latitude)<br />
lonDegrees = strFormat:format(longitude)<br />
<br />
if not raw then<br />
latDegSym = replaceDecimalMark(latDegrees) .. degSymbol<br />
lonDegSym = replaceDecimalMark(lonDegrees) .. degSymbol<br />
else<br />
latDegSym = latDegrees .. degSymbol<br />
lonDegSym = lonDegrees .. degSymbol<br />
end<br />
else<br />
latConv = math.floor(latitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits<br />
lonConv = math.floor(longitude * unitsPerDegree * 10^numDigits + 0.5) / 10^numDigits<br />
<br />
if precision >= (1 / 60) then<br />
latMinutes = latConv<br />
lonMinutes = lonConv<br />
else<br />
latSeconds = latConv<br />
lonSeconds = lonConv<br />
<br />
latMinutes = math.floor(latSeconds / 60)<br />
lonMinutes = math.floor(lonSeconds / 60)<br />
<br />
latSeconds = strFormat:format(latSeconds - (latMinutes * 60))<br />
lonSeconds = strFormat:format(lonSeconds - (lonMinutes * 60))<br />
<br />
if not raw then<br />
latSecSym = replaceDecimalMark(latSeconds) .. secSymbol<br />
lonSecSym = replaceDecimalMark(lonSeconds) .. secSymbol<br />
else<br />
latSecSym = latSeconds .. secSymbol<br />
lonSecSym = lonSeconds .. secSymbol<br />
end<br />
end<br />
<br />
latDegrees = math.floor(latMinutes / 60)<br />
lonDegrees = math.floor(lonMinutes / 60)<br />
<br />
latDegSym = latDegrees .. degSymbol<br />
lonDegSym = lonDegrees .. degSymbol<br />
<br />
latMinutes = latMinutes - (latDegrees * 60)<br />
lonMinutes = lonMinutes - (lonDegrees * 60)<br />
<br />
if precision >= (1 / 60) then<br />
latMinutes = strFormat:format(latMinutes)<br />
lonMinutes = strFormat:format(lonMinutes)<br />
<br />
if not raw then<br />
latMinSym = replaceDecimalMark(latMinutes) .. minSymbol<br />
lonMinSym = replaceDecimalMark(lonMinutes) .. minSymbol<br />
else<br />
latMinSym = latMinutes .. minSymbol<br />
lonMinSym = lonMinutes .. minSymbol<br />
end<br />
else<br />
latMinSym = latMinutes .. minSymbol<br />
lonMinSym = lonMinutes .. minSymbol<br />
end<br />
end<br />
<br />
latValue = latDegSym .. latMinSym .. latSecSym .. latDirection<br />
lonValue = lonDegSym .. lonMinSym .. lonSecSym .. lonDirection<br />
<br />
value = latValue .. separator .. lonValue<br />
<br />
if link then<br />
globe = parseWikidataURL(datavalue['globe'])<br />
<br />
if globe then<br />
globe = mw.wikibase.getLabelByLang(globe, "en"):lower()<br />
else<br />
globe = "earth"<br />
end<br />
<br />
latLink = table.concat({latDegrees, latMinutes, latSeconds}, "_")<br />
lonLink = table.concat({lonDegrees, lonMinutes, lonSeconds}, "_")<br />
<br />
value = "[https://tools.wmflabs.org/geohack/geohack.php?language="..self.langCode.."&params="..latLink.."_"..latDirectionEN.."_"..lonLink.."_"..lonDirectionEN.."_globe:"..globe.." "..value.."]"<br />
end<br />
<br />
return value<br />
elseif datatype == 'wikibase-entityid' then<br />
local label<br />
local itemID = datavalue['numeric-id']<br />
<br />
if subtype == 'wikibase-item' then<br />
itemID = "Q" .. itemID<br />
elseif subtype == 'wikibase-property' then<br />
itemID = "P" .. itemID<br />
else<br />
return '<strong class="error">' .. errorText('unknown-data-type', subtype) .. '</strong>'<br />
end<br />
<br />
label = self:getLabel(itemID, raw, link, short)<br />
<br />
if label == "" then<br />
label = nil<br />
end<br />
<br />
return label<br />
else<br />
return '<strong class="error">' .. errorText('unknown-data-type', datatype) .. '</strong>'<br />
end<br />
elseif snak.snaktype == 'somevalue' and not noSpecial then<br />
if raw then<br />
return " " -- single space represents 'somevalue'<br />
else<br />
return i18n['values']['unknown']<br />
end<br />
elseif snak.snaktype == 'novalue' and not noSpecial then<br />
if raw then<br />
return "" -- empty string represents 'novalue'<br />
else<br />
return i18n['values']['none']<br />
end<br />
else<br />
return nil<br />
end<br />
end<br />
<br />
function Config:getSingleRawQualifier(claim, qualifierID)<br />
local qualifiers<br />
<br />
if claim.qualifiers then qualifiers = claim.qualifiers[qualifierID] end<br />
<br />
if qualifiers and qualifiers[1] then<br />
return self:getValue(qualifiers[1], true) -- raw = true<br />
else<br />
return nil<br />
end<br />
end<br />
<br />
function Config:snakEqualsValue(snak, value)<br />
local snakValue = self:getValue(snak, true) -- raw = true<br />
<br />
if snakValue and snak.snaktype == 'value' and snak.datavalue.type == 'wikibase-entityid' then value = value:upper() end<br />
<br />
return snakValue == value<br />
end<br />
<br />
function Config:setRank(rank)<br />
local rankPos<br />
<br />
if rank == p.flags.best then<br />
self.bestRank = true<br />
self.flagBest = true -- mark that 'best' flag was given<br />
return<br />
end<br />
<br />
if rank:sub(1,9) == p.flags.preferred then<br />
rankPos = 1<br />
elseif rank:sub(1,6) == p.flags.normal then<br />
rankPos = 2<br />
elseif rank:sub(1,10) == p.flags.deprecated then<br />
rankPos = 3<br />
else<br />
return<br />
end<br />
<br />
-- one of the rank flags was given, check if another one was given before<br />
if not self.flagRank then<br />
self.ranks = {false, false, false} -- no other rank flag given before, so unset ranks<br />
self.bestRank = self.flagBest -- unsets bestRank only if 'best' flag was not given before<br />
self.flagRank = true -- mark that a rank flag was given<br />
end<br />
<br />
if rank:sub(-1) == "+" then<br />
for i = rankPos, 1, -1 do<br />
self.ranks[i] = true<br />
end<br />
elseif rank:sub(-1) == "-" then<br />
for i = rankPos, #self.ranks do<br />
self.ranks[i] = true<br />
end<br />
else<br />
self.ranks[rankPos] = true<br />
end<br />
end<br />
<br />
function Config:setPeriod(period)<br />
local periodPos<br />
<br />
if period == p.flags.future then<br />
periodPos = 1<br />
elseif period == p.flags.current then<br />
periodPos = 2<br />
elseif period == p.flags.former then<br />
periodPos = 3<br />
else<br />
return<br />
end<br />
<br />
-- one of the period flags was given, check if another one was given before<br />
if not self.flagPeriod then<br />
self.periods = {false, false, false} -- no other period flag given before, so unset periods<br />
self.flagPeriod = true -- mark that a period flag was given<br />
end<br />
<br />
self.periods[periodPos] = true<br />
end<br />
<br />
function Config:qualifierMatches(claim, id, value)<br />
local qualifiers<br />
<br />
if claim.qualifiers then qualifiers = claim.qualifiers[id] end<br />
if qualifiers then<br />
for _, v in pairs(qualifiers) do<br />
if self:snakEqualsValue(v, value) then<br />
return true<br />
end<br />
end<br />
elseif value == "" then<br />
-- if the qualifier is not present then treat it the same as the special value 'novalue'<br />
return true<br />
end<br />
<br />
return false<br />
end<br />
<br />
function Config:rankMatches(rankPos)<br />
if self.bestRank then<br />
return (self.ranks[rankPos] and self.foundRank >= rankPos)<br />
else<br />
return self.ranks[rankPos]<br />
end<br />
end<br />
<br />
function Config:timeMatches(claim)<br />
local startTime = nil<br />
local startTimeY = nil<br />
local startTimeM = nil<br />
local startTimeD = nil<br />
local endTime = nil<br />
local endTimeY = nil<br />
local endTimeM = nil<br />
local endTimeD = nil<br />
<br />
if self.periods[1] and self.periods[2] and self.periods[3] then<br />
-- any time<br />
return true<br />
end<br />
<br />
startTime = self:getSingleRawQualifier(claim, aliasesP.startTime)<br />
if startTime and startTime ~= "" and startTime ~= " " then<br />
startTimeY, startTimeM, startTimeD = parseDate(startTime)<br />
end<br />
<br />
endTime = self:getSingleRawQualifier(claim, aliasesP.endTime)<br />
if endTime and endTime ~= "" and endTime ~= " " then<br />
endTimeY, endTimeM, endTimeD = parseDate(endTime)<br />
end<br />
<br />
if startTimeY ~= nil and endTimeY ~= nil and datePrecedesDate(endTimeY, endTimeM, endTimeD, startTimeY, startTimeM, startTimeD) then<br />
-- invalidate end time if it precedes start time<br />
endTimeY = nil<br />
endTimeM = nil<br />
endTimeD = nil<br />
end<br />
<br />
if self.periods[1] then<br />
-- future<br />
if startTimeY and datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD) then<br />
return true<br />
end<br />
end<br />
<br />
if self.periods[2] then<br />
-- current<br />
if (startTimeY == nil or not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], startTimeY, startTimeM, startTimeD)) and<br />
(endTimeY == nil or datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD)) then<br />
return true<br />
end<br />
end<br />
<br />
if self.periods[3] then<br />
-- former<br />
if endTimeY and not datePrecedesDate(self.atDate[1], self.atDate[2], self.atDate[3], endTimeY, endTimeM, endTimeD) then<br />
return true<br />
end<br />
end<br />
<br />
return false<br />
end<br />
<br />
function Config:processFlag(flag)<br />
if not flag then<br />
return false<br />
end<br />
<br />
if flag == p.flags.linked then<br />
self.curState.linked = true<br />
return true<br />
elseif flag == p.flags.raw then<br />
self.curState.rawValue = true<br />
<br />
if self.curState == self.states[parameters.reference] then<br />
-- raw reference values end with periods and require a separator (other than none)<br />
self.separators["sep%r"][1] = {" "}<br />
end<br />
<br />
return true<br />
elseif flag == p.flags.short then<br />
self.curState.shortName = true<br />
return true<br />
elseif flag == p.flags.multilanguage then<br />
self.curState.anyLanguage = true<br />
return true<br />
elseif flag == p.flags.unit then<br />
self.curState.unitOnly = true<br />
return true<br />
elseif flag == p.flags.mdy then<br />
self.mdyDate = true<br />
return true<br />
elseif flag == p.flags.single then<br />
self.singleClaim = true<br />
return true<br />
elseif flag == p.flags.sourced then<br />
self.sourcedOnly = true<br />
return true<br />
elseif flag == p.flags.edit then<br />
self.editable = true<br />
return true<br />
elseif flag == p.flags.editAtEnd then<br />
self.editable = true<br />
self.editAtEnd = true<br />
return true<br />
elseif flag == p.flags.best or flag:match('^'..p.flags.preferred..'[+-]?$') or flag:match('^'..p.flags.normal..'[+-]?$') or flag:match('^'..p.flags.deprecated..'[+-]?$') then<br />
self:setRank(flag)<br />
return true<br />
elseif flag == p.flags.future or flag == p.flags.current or flag == p.flags.former then<br />
self:setPeriod(flag)<br />
return true<br />
elseif flag == "" then<br />
-- ignore empty flags and carry on<br />
return true<br />
else<br />
return false<br />
end<br />
end<br />
<br />
function Config:processFlagOrCommand(flag)<br />
local param = ""<br />
<br />
if not flag then<br />
return false<br />
end<br />
<br />
if flag == p.claimCommands.property or flag == p.claimCommands.properties then<br />
param = parameters.property<br />
elseif flag == p.claimCommands.qualifier or flag == p.claimCommands.qualifiers then<br />
self.states.qualifiersCount = self.states.qualifiersCount + 1<br />
param = parameters.qualifier .. self.states.qualifiersCount<br />
self.separators["sep"..param] = {copyTable(defaultSeparators["sep%q\\d"])}<br />
elseif flag == p.claimCommands.reference or flag == p.claimCommands.references then<br />
param = parameters.reference<br />
else<br />
return self:processFlag(flag)<br />
end<br />
<br />
if self.states[param] then<br />
return false<br />
end<br />
<br />
-- create a new state for each command<br />
self.states[param] = State:new(self, param)<br />
<br />
-- use "%x" as the general parameter name<br />
self.states[param].parsedFormat = parseFormat(parameters.general) -- will be overwritten for param=="%p"<br />
<br />
-- set the separator<br />
self.states[param].separator = self.separators["sep"..param] -- will be nil for param=="%p", which will be set separately<br />
<br />
if flag == p.claimCommands.property or flag == p.claimCommands.qualifier or flag == p.claimCommands.reference then<br />
self.states[param].singleValue = true<br />
end<br />
<br />
self.curState = self.states[param]<br />
<br />
return true<br />
end<br />
<br />
function Config:processSeparators(args)<br />
local sep<br />
<br />
for i, v in pairs(self.separators) do<br />
if args[i] then<br />
sep = replaceSpecialChars(args[i])<br />
<br />
if sep ~= "" then<br />
self.separators[i][1] = {sep}<br />
else<br />
self.separators[i][1] = nil<br />
end<br />
end<br />
end<br />
end<br />
<br />
function Config:setFormatAndSeparators(state, parsedFormat)<br />
state.parsedFormat = parsedFormat<br />
state.separator = self.separators["sep"]<br />
state.movSeparator = self.separators["sep"..parameters.separator]<br />
state.puncMark = self.separators["punc"]<br />
end<br />
<br />
-- determines if a claim has references by prefetching them from the claim using getReferences,<br />
-- which applies some filtering that determines if a reference is actually returned,<br />
-- and caches the references for later use<br />
function State:isSourced(claim)<br />
self.conf.prefetchedRefs = self:getReferences(claim)<br />
return (#self.conf.prefetchedRefs > 0)<br />
end<br />
<br />
function State:resetCaches()<br />
-- any prefetched references of the previous claim must not be used<br />
self.conf.prefetchedRefs = nil<br />
end<br />
<br />
function State:claimMatches(claim)<br />
local matches, rankPos<br />
<br />
-- first of all, reset any cached values used for the previous claim<br />
self:resetCaches()<br />
<br />
-- if a property value was given, check if it matches the claim's property value<br />
if self.conf.propertyValue then<br />
matches = self.conf:snakEqualsValue(claim.mainsnak, self.conf.propertyValue)<br />
else<br />
matches = true<br />
end<br />
<br />
-- if any qualifier values were given, check if each matches one of the claim's qualifier values<br />
for i, v in pairs(self.conf.qualifierIDsAndValues) do<br />
matches = (matches and self.conf:qualifierMatches(claim, i, v))<br />
end<br />
<br />
-- check if the claim's rank and time period match<br />
rankPos = rankTable[claim.rank] or 4<br />
matches = (matches and self.conf:rankMatches(rankPos) and self.conf:timeMatches(claim))<br />
<br />
-- if only claims with references must be returned, check if this one has any<br />
if self.conf.sourcedOnly then<br />
matches = (matches and self:isSourced(claim)) -- prefetches and caches references<br />
end<br />
<br />
return matches, rankPos<br />
end<br />
<br />
function State:out()<br />
local result -- collection of arrays with value objects<br />
local valuesArray -- array with value objects<br />
local sep = nil -- value object<br />
local out = {} -- array with value objects<br />
<br />
local function walk(formatTable, result)<br />
local valuesArray = {} -- array with value objects<br />
<br />
for i, v in pairs(formatTable.req) do<br />
if not result[i] or not result[i][1] then<br />
-- we've got no result for a parameter that is required on this level,<br />
-- so skip this level (and its children) by returning an empty result<br />
return {}<br />
end<br />
end<br />
<br />
for _, v in ipairs(formatTable) do<br />
if v.param then<br />
valuesArray = mergeArrays(valuesArray, result[v.str])<br />
elseif v.str ~= "" then<br />
valuesArray[#valuesArray + 1] = {v.str}<br />
end<br />
<br />
if v.child then<br />
valuesArray = mergeArrays(valuesArray, walk(v.child, result))<br />
end<br />
end<br />
<br />
return valuesArray<br />
end<br />
<br />
-- iterate through the results from back to front, so that we know when to add separators<br />
for i = #self.results, 1, -1 do<br />
result = self.results[i]<br />
<br />
-- if there is already some output, then add the separators<br />
if #out > 0 then<br />
sep = self.separator[1] -- fixed separator<br />
result[parameters.separator] = {self.movSeparator[1]} -- movable separator<br />
else<br />
sep = nil<br />
result[parameters.separator] = {self.puncMark[1]} -- optional punctuation mark<br />
end<br />
<br />
valuesArray = walk(self.parsedFormat, result)<br />
<br />
if #valuesArray > 0 then<br />
if sep then<br />
valuesArray[#valuesArray + 1] = sep<br />
end<br />
<br />
out = mergeArrays(valuesArray, out)<br />
end<br />
end<br />
<br />
-- reset state before next iteration<br />
self.results = {}<br />
<br />
return out<br />
end<br />
<br />
-- level 1 hook<br />
function State:getProperty(claim)<br />
local value = {self:getValue(claim.mainsnak)} -- create one value object<br />
<br />
if #value > 0 then<br />
return {value} -- wrap the value object in an array and return it<br />
else<br />
return {} -- return empty array if there was no value<br />
end<br />
end<br />
<br />
-- level 1 hook<br />
function State:getQualifiers(claim, param)<br />
local qualifiers<br />
<br />
if claim.qualifiers then qualifiers = claim.qualifiers[self.conf.qualifierIDs[param]] end<br />
if qualifiers then<br />
-- iterate through claim's qualifier statements to collect their values;<br />
-- return array with multiple value objects<br />
return self.conf.states[param]:iterate(qualifiers, {[parameters.general] = hookNames[parameters.qualifier.."\\d"][2], count = 1}) -- pass qualifier state with level 2 hook<br />
else<br />
return {} -- return empty array<br />
end<br />
end<br />
<br />
-- level 2 hook<br />
function State:getQualifier(snak)<br />
local value = {self:getValue(snak)} -- create one value object<br />
<br />
if #value > 0 then<br />
return {value} -- wrap the value object in an array and return it<br />
else<br />
return {} -- return empty array if there was no value<br />
end<br />
end<br />
<br />
-- level 1 hook<br />
function State:getAllQualifiers(claim, param, result, hooks)<br />
local out = {} -- array with value objects<br />
local sep = self.conf.separators["sep"..parameters.qualifier][1] -- value object<br />
<br />
-- iterate through the output of the separate "qualifier(s)" commands<br />
for i = 1, self.conf.states.qualifiersCount do<br />
<br />
-- if a hook has not been called yet, call it now<br />
if not result[parameters.qualifier..i] then<br />
self:callHook(parameters.qualifier..i, hooks, claim, result)<br />
end<br />
<br />
-- if there is output for this particular "qualifier(s)" command, then add it<br />
if result[parameters.qualifier..i] and result[parameters.qualifier..i][1] then<br />
<br />
-- if there is already some output, then add the separator<br />
if #out > 0 and sep then<br />
out[#out + 1] = sep<br />
end<br />
<br />
out = mergeArrays(out, result[parameters.qualifier..i])<br />
end<br />
end<br />
<br />
return out<br />
end<br />
<br />
-- level 1 hook<br />
function State:getReferences(claim)<br />
if self.conf.prefetchedRefs then<br />
-- return references that have been prefetched by isSourced<br />
return self.conf.prefetchedRefs<br />
end<br />
<br />
if claim.references then<br />
-- iterate through claim's reference statements to collect their values;<br />
-- return array with multiple value objects<br />
return self.conf.states[parameters.reference]:iterate(claim.references, {[parameters.general] = hookNames[parameters.reference][2], count = 1}) -- pass reference state with level 2 hook<br />
else<br />
return {} -- return empty array<br />
end<br />
end<br />
<br />
-- level 2 hook<br />
function State:getReference(statement)<br />
local key, citeWeb, citeQ, label<br />
local params = {}<br />
local citeParams = {['web'] = {}, ['q'] = {}}<br />
local citeMismatch = {}<br />
local useCite = nil<br />
local useParams = nil<br />
local value = ""<br />
local ref = {}<br />
<br />
local version = 1 -- increment this each time the below logic is changed to avoid conflict errors<br />
<br />
if statement.snaks then<br />
-- don't include "imported from", which is added by a bot<br />
if statement.snaks[aliasesP.importedFrom] then<br />
statement.snaks[aliasesP.importedFrom] = nil<br />
end<br />
<br />
-- don't include "inferred from", which is added by a bot<br />
if statement.snaks[aliasesP.inferredFrom] then<br />
statement.snaks[aliasesP.inferredFrom] = nil<br />
end<br />
<br />
-- don't include "type of reference"<br />
if statement.snaks[aliasesP.typeOfReference] then<br />
statement.snaks[aliasesP.typeOfReference] = nil<br />
end<br />
<br />
-- don't include "image" to prevent littering<br />
if statement.snaks[aliasesP.image] then<br />
statement.snaks[aliasesP.image] = nil<br />
end<br />
<br />
-- don't include "language" if it is equal to the local one<br />
if self:getReferenceDetail(statement.snaks, aliasesP.language) == self.conf.langName then<br />
statement.snaks[aliasesP.language] = nil<br />
end<br />
<br />
-- retrieve all the parameters<br />
for i in pairs(statement.snaks) do<br />
label = ""<br />
<br />
-- multiple authors may be given<br />
if i == aliasesP.author then<br />
params[i] = self:getReferenceDetails(statement.snaks, i, false, self.linked, true) -- link = true/false, anyLang = true<br />
else<br />
params[i] = {self:getReferenceDetail(statement.snaks, i, false, (self.linked or (i == aliasesP.statedIn)) and (statement.snaks[i][1].datatype ~= 'url'), true)} -- link = true/false, anyLang = true<br />
end<br />
<br />
if #params[i] == 0 then<br />
params[i] = nil<br />
else<br />
if statement.snaks[i][1].datatype == 'external-id' then<br />
key = "external-id"<br />
label = self.conf:getLabel(i)<br />
<br />
if label ~= "" then<br />
label = label .. " "<br />
end<br />
else<br />
key = i<br />
end<br />
<br />
-- add the parameter to each matching type of citation<br />
for j in pairs(citeParams) do<br />
-- do so if there was no mismatch with a previous parameter<br />
if not citeMismatch[j] then<br />
-- check if this parameter is not mismatching itself<br />
if i18n['cite'][j][key] then<br />
-- continue if an option is available in the corresponding cite template<br />
if i18n['cite'][j][key] ~= "" then<br />
citeParams[j][i18n['cite'][j][key]] = label .. params[i][1]<br />
<br />
-- if there are multiple parameter values (authors), add those too<br />
for k=2, #params[i] do<br />
citeParams[j][i18n['cite'][j][key]..k] = label .. params[i][k]<br />
end<br />
end<br />
else<br />
citeMismatch[j] = true<br />
end<br />
end<br />
end<br />
end<br />
end<br />
<br />
-- get title of general template for citing web references<br />
citeWeb = split(mw.wikibase.getSitelink(aliasesQ.citeWeb) or "", ":")[2] -- split off namespace from front<br />
<br />
-- get title of template that expands stated-in references into citations<br />
citeQ = split(mw.wikibase.getSitelink(aliasesQ.citeQ) or "", ":")[2] -- split off namespace from front<br />
<br />
-- (1) use the general template for citing web references if there is a match and if at least both "reference URL" and "title" are present<br />
if citeWeb and not citeMismatch['web'] and citeParams['web'][i18n['cite']['web'][aliasesP.referenceURL]] and citeParams['web'][i18n['cite']['web'][aliasesP.title]] then<br />
useCite = citeWeb<br />
useParams = citeParams['web']<br />
<br />
-- (2) use the template that expands stated-in references into citations if there is a match and if at least "stated in" is present<br />
elseif citeQ and not citeMismatch['q'] and citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] then<br />
-- we need the raw "stated in" Q-identifier for the this template<br />
citeParams['q'][i18n['cite']['q'][aliasesP.statedIn]] = self:getReferenceDetail(statement.snaks, aliasesP.statedIn, true) -- raw = true<br />
<br />
useCite = citeQ<br />
useParams = citeParams['q']<br />
end<br />
<br />
if useCite and useParams then<br />
-- if this module is being substituted then build a regular template call, otherwise expand the template<br />
if mw.isSubsting() then<br />
for i, v in pairs(useParams) do<br />
value = value .. "|" .. i .. "=" .. v<br />
end<br />
<br />
value = "{{" .. useCite .. value .. "}}"<br />
else<br />
value = mw.getCurrentFrame():expandTemplate{title=useCite, args=useParams}<br />
end<br />
<br />
-- (3) else, do some default rendering of name-value pairs, but only if at least "stated in", "reference URL" or "title" is present<br />
elseif params[aliasesP.statedIn] or params[aliasesP.referenceURL] or params[aliasesP.title] then<br />
citeParams['default'] = {}<br />
<br />
-- start by adding authors up front<br />
if params[aliasesP.author] and #params[aliasesP.author] > 0 then<br />
citeParams['default'][#citeParams['default'] + 1] = table.concat(params[aliasesP.author], " & ")<br />
end<br />
<br />
-- combine "reference URL" and "title" into one link if both are present<br />
if params[aliasesP.referenceURL] and params[aliasesP.title] then<br />
citeParams['default'][#citeParams['default'] + 1] = '[' .. params[aliasesP.referenceURL][1] .. ' "' .. params[aliasesP.title][1] .. '"]'<br />
elseif params[aliasesP.referenceURL] then<br />
citeParams['default'][#citeParams['default'] + 1] = params[aliasesP.referenceURL][1]<br />
elseif params[aliasesP.title] then<br />
citeParams['default'][#citeParams['default'] + 1] = '"' .. params[aliasesP.title][1] .. '"'<br />
end<br />
<br />
-- then add "stated in"<br />
if params[aliasesP.statedIn] then<br />
citeParams['default'][#citeParams['default'] + 1] = "''" .. params[aliasesP.statedIn][1] .. "''"<br />
end<br />
<br />
-- remove previously added parameters so that they won't be added a second time<br />
params[aliasesP.author] = nil<br />
params[aliasesP.referenceURL] = nil<br />
params[aliasesP.title] = nil<br />
params[aliasesP.statedIn] = nil<br />
<br />
-- add the rest of the parameters<br />
for i, v in pairs(params) do<br />
i = self.conf:getLabel(i)<br />
<br />
if i ~= "" then<br />
citeParams['default'][#citeParams['default'] + 1] = i .. ": " .. v[1]<br />
end<br />
end<br />
<br />
value = table.concat(citeParams['default'], "; ")<br />
<br />
if value ~= "" then<br />
value = value .. "."<br />
end<br />
end<br />
<br />
if value ~= "" then<br />
value = {value} -- create one value object<br />
<br />
if not self.rawValue then<br />
-- this should become a <ref> tag, so save the reference's hash for later<br />
value.refHash = "wikidata-" .. statement.hash .. "-v" .. (tonumber(i18n['cite']['version']) + version)<br />
end<br />
<br />
ref = {value} -- wrap the value object in an array<br />
end<br />
end<br />
<br />
return ref<br />
end<br />
<br />
-- gets a detail of one particular type for a reference<br />
function State:getReferenceDetail(snaks, dType, raw, link, anyLang)<br />
local switchLang = anyLang<br />
local value = nil<br />
<br />
if not snaks[dType] then<br />
return nil<br />
end<br />
<br />
-- if anyLang, first try the local language and otherwise any language<br />
repeat<br />
for _, v in ipairs(snaks[dType]) do<br />
value = self.conf:getValue(v, raw, link, false, anyLang and not switchLang, false, true) -- noSpecial = true<br />
<br />
if value then<br />
break<br />
end<br />
end<br />
<br />
if value or not anyLang then<br />
break<br />
end<br />
<br />
switchLang = not switchLang<br />
until anyLang and switchLang<br />
<br />
return value<br />
end<br />
<br />
-- gets the details of one particular type for a reference<br />
function State:getReferenceDetails(snaks, dType, raw, link, anyLang)<br />
local values = {}<br />
<br />
if not snaks[dType] then<br />
return {}<br />
end<br />
<br />
for _, v in ipairs(snaks[dType]) do<br />
-- if nil is returned then it will not be added to the table<br />
values[#values + 1] = self.conf:getValue(v, raw, link, false, anyLang, false, true) -- noSpecial = true<br />
end<br />
<br />
return values<br />
end<br />
<br />
-- level 1 hook<br />
function State:getAlias(object)<br />
local value = object.value<br />
local title = nil<br />
<br />
if value and self.linked then<br />
if self.conf.entityID:sub(1,1) == "Q" then<br />
title = mw.wikibase.getSitelink(self.conf.entityID)<br />
elseif self.conf.entityID:sub(1,1) == "P" then<br />
title = "d:Property:" .. self.conf.entityID<br />
end<br />
<br />
if title then<br />
value = buildWikilink(title, value)<br />
end<br />
end<br />
<br />
value = {value} -- create one value object<br />
<br />
if #value > 0 then<br />
return {value} -- wrap the value object in an array and return it<br />
else<br />
return {} -- return empty array if there was no value<br />
end<br />
end<br />
<br />
-- level 1 hook<br />
function State:getBadge(value)<br />
value = self.conf:getLabel(value, self.rawValue, self.linked, self.shortName)<br />
<br />
if value == "" then<br />
value = nil<br />
end<br />
<br />
value = {value} -- create one value object<br />
<br />
if #value > 0 then<br />
return {value} -- wrap the value object in an array and return it<br />
else<br />
return {} -- return empty array if there was no value<br />
end<br />
end<br />
<br />
function State:callHook(param, hooks, statement, result)<br />
local valuesArray, refHash<br />
<br />
-- call a parameter's hook if it has been defined and if it has not been called before<br />
if not result[param] and hooks[param] then<br />
valuesArray = self[hooks[param]](self, statement, param, result, hooks) -- array with value objects<br />
<br />
-- add to the result<br />
if #valuesArray > 0 then<br />
result[param] = valuesArray<br />
result.count = result.count + 1<br />
else<br />
result[param] = {} -- an empty array to indicate that we've tried this hook already<br />
return true -- miss == true<br />
end<br />
end<br />
<br />
return false<br />
end<br />
<br />
-- iterate through claims, claim's qualifiers or claim's references to collect values<br />
function State:iterate(statements, hooks, matchHook)<br />
matchHook = matchHook or alwaysTrue<br />
<br />
local matches = false<br />
local rankPos = nil<br />
local result, gotRequired<br />
<br />
for _, v in ipairs(statements) do<br />
-- rankPos will be nil for non-claim statements (e.g. qualifiers, references, etc.)<br />
matches, rankPos = matchHook(self, v)<br />
<br />
if matches then<br />
result = {count = 0} -- collection of arrays with value objects<br />
<br />
local function walk(formatTable)<br />
local miss<br />
<br />
for i2, v2 in pairs(formatTable.req) do<br />
-- call a hook, adding its return value to the result<br />
miss = self:callHook(i2, hooks, v, result)<br />
<br />
if miss then<br />
-- we miss a required value for this level, so return false<br />
return false<br />
end<br />
<br />
if result.count == hooks.count then<br />
-- we're done if all hooks have been called;<br />
-- returning at this point breaks the loop<br />
return true<br />
end<br />
end<br />
<br />
for _, v2 in ipairs(formatTable) do<br />
if result.count == hooks.count then<br />
-- we're done if all hooks have been called;<br />
-- returning at this point prevents further childs from being processed<br />
return true<br />
end<br />
<br />
if v2.child then<br />
walk(v2.child)<br />
end<br />
end<br />
<br />
return true<br />
end<br />
gotRequired = walk(self.parsedFormat)<br />
<br />
-- only append the result if we got values for all required parameters on the root level<br />
if gotRequired then<br />
-- if we have a rankPos (only with matchHook() for complete claims), then update the foundRank<br />
if rankPos and self.conf.foundRank > rankPos then<br />
self.conf.foundRank = rankPos<br />
end<br />
<br />
-- append the result<br />
self.results[#self.results + 1] = result<br />
<br />
-- break if we only need a single value<br />
if self.singleValue then<br />
break<br />
end<br />
end<br />
end<br />
end<br />
<br />
return self:out()<br />
end<br />
<br />
local function getEntityId(arg, eid, page, allowOmitPropPrefix)<br />
local id = nil<br />
local prop = nil<br />
<br />
if arg then<br />
if arg:sub(1,1) == ":" then<br />
page = arg<br />
eid = nil<br />
elseif arg:sub(1,1):upper() == "Q" or arg:sub(1,9):lower() == "property:" or allowOmitPropPrefix then<br />
eid = arg<br />
page = nil<br />
else<br />
prop = arg<br />
end<br />
end<br />
<br />
if eid then<br />
if eid:sub(1,9):lower() == "property:" then<br />
id = replaceAlias(mw.text.trim(eid:sub(10)))<br />
<br />
if id:sub(1,1):upper() ~= "P" then<br />
id = ""<br />
end<br />
else<br />
id = replaceAlias(eid)<br />
end<br />
elseif page then<br />
if page:sub(1,1) == ":" then<br />
page = mw.text.trim(page:sub(2))<br />
end<br />
<br />
id = mw.wikibase.getEntityIdForTitle(page) or ""<br />
end<br />
<br />
if not id then<br />
id = mw.wikibase.getEntityIdForCurrentPage() or ""<br />
end<br />
<br />
id = id:upper()<br />
<br />
if not mw.wikibase.isValidEntityId(id) then<br />
id = ""<br />
end<br />
<br />
return id, prop<br />
end<br />
<br />
local function nextArg(args)<br />
local arg = args[args.pointer]<br />
<br />
if arg then<br />
args.pointer = args.pointer + 1<br />
return mw.text.trim(arg)<br />
else<br />
return nil<br />
end<br />
end<br />
<br />
local function claimCommand(args, funcName)<br />
local cfg = Config:new()<br />
cfg:processFlagOrCommand(funcName) -- process first command (== function name)<br />
<br />
local lastArg, parsedFormat, formatParams, claims, value<br />
local hooks = {count = 0}<br />
<br />
-- set the date if given;<br />
-- must come BEFORE processing the flags<br />
if args[p.args.date] then<br />
cfg.atDate = {parseDate(args[p.args.date])}<br />
cfg.periods = {false, true, false} -- change default time constraint to 'current'<br />
end<br />
<br />
-- process flags and commands<br />
repeat<br />
lastArg = nextArg(args)<br />
until not cfg:processFlagOrCommand(lastArg)<br />
<br />
-- get the entity ID from either the positional argument, the eid argument or the page argument<br />
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page])<br />
<br />
if cfg.entityID == "" then<br />
return "" -- we cannot continue without a valid entity ID<br />
end<br />
<br />
cfg.entity = mw.wikibase.getEntity(cfg.entityID)<br />
<br />
if not cfg.propertyID then<br />
cfg.propertyID = nextArg(args)<br />
end<br />
<br />
cfg.propertyID = replaceAlias(cfg.propertyID)<br />
<br />
if not cfg.entity or not cfg.propertyID then<br />
return "" -- we cannot continue without an entity or a property ID<br />
end<br />
<br />
cfg.propertyID = cfg.propertyID:upper()<br />
<br />
if not cfg.entity.claims or not cfg.entity.claims[cfg.propertyID] then<br />
return "" -- there is no use to continue without any claims<br />
end<br />
<br />
claims = cfg.entity.claims[cfg.propertyID]<br />
<br />
if cfg.states.qualifiersCount > 0 then<br />
-- do further processing if "qualifier(s)" command was given<br />
<br />
if #args - args.pointer + 1 > cfg.states.qualifiersCount then<br />
-- claim ID or literal value has been given<br />
<br />
cfg.propertyValue = nextArg(args)<br />
end<br />
<br />
for i = 1, cfg.states.qualifiersCount do<br />
-- check if given qualifier ID is an alias and add it<br />
cfg.qualifierIDs[parameters.qualifier..i] = replaceAlias(nextArg(args) or ""):upper()<br />
end<br />
elseif cfg.states[parameters.reference] then<br />
-- do further processing if "reference(s)" command was given<br />
<br />
cfg.propertyValue = nextArg(args)<br />
end<br />
<br />
-- check for special property value 'somevalue' or 'novalue'<br />
if cfg.propertyValue then<br />
cfg.propertyValue = replaceSpecialChars(cfg.propertyValue)<br />
<br />
if cfg.propertyValue ~= "" and mw.text.trim(cfg.propertyValue) == "" then<br />
cfg.propertyValue = " " -- single space represents 'somevalue', whereas empty string represents 'novalue'<br />
else<br />
cfg.propertyValue = mw.text.trim(cfg.propertyValue)<br />
end<br />
end<br />
<br />
-- parse the desired format, or choose an appropriate format<br />
if args["format"] then<br />
parsedFormat, formatParams = parseFormat(args["format"])<br />
elseif cfg.states.qualifiersCount > 0 then -- "qualifier(s)" command given<br />
if cfg.states[parameters.property] then -- "propert(y|ies)" command given<br />
parsedFormat, formatParams = parseFormat(formats.propertyWithQualifier)<br />
else<br />
parsedFormat, formatParams = parseFormat(formats.qualifier)<br />
end<br />
elseif cfg.states[parameters.property] then -- "propert(y|ies)" command given<br />
parsedFormat, formatParams = parseFormat(formats.property)<br />
else -- "reference(s)" command given<br />
parsedFormat, formatParams = parseFormat(formats.reference)<br />
end<br />
<br />
-- if a "qualifier(s)" command and no "propert(y|ies)" command has been given, make the movable separator a semicolon<br />
if cfg.states.qualifiersCount > 0 and not cfg.states[parameters.property] then<br />
cfg.separators["sep"..parameters.separator][1] = {";"}<br />
end<br />
<br />
-- if only "reference(s)" has been given, set the default separator to none (except when raw)<br />
if cfg.states[parameters.reference] and not cfg.states[parameters.property] and cfg.states.qualifiersCount == 0<br />
and not cfg.states[parameters.reference].rawValue then<br />
cfg.separators["sep"][1] = nil<br />
end<br />
<br />
-- if exactly one "qualifier(s)" command has been given, make "sep%q" point to "sep%q1" to make them equivalent<br />
if cfg.states.qualifiersCount == 1 then<br />
cfg.separators["sep"..parameters.qualifier] = cfg.separators["sep"..parameters.qualifier.."1"]<br />
end<br />
<br />
-- process overridden separator values;<br />
-- must come AFTER tweaking the default separators<br />
cfg:processSeparators(args)<br />
<br />
-- define the hooks that should be called (getProperty, getQualifiers, getReferences);<br />
-- only define a hook if both its command ("propert(y|ies)", "reference(s)", "qualifier(s)") and its parameter ("%p", "%r", "%q1", "%q2", "%q3") have been given<br />
for i, v in pairs(cfg.states) do<br />
-- e.g. 'formatParams["%q1"] or formatParams["%q"]' to define hook even if "%q1" was not defined to be able to build a complete value for "%q"<br />
if formatParams[i] or formatParams[i:sub(1, 2)] then<br />
hooks[i] = getHookName(i, 1)<br />
hooks.count = hooks.count + 1<br />
end<br />
end<br />
<br />
-- the "%q" parameter is not attached to a state, but is a collection of the results of multiple states (attached to "%q1", "%q2", "%q3", ...);<br />
-- so if this parameter is given then this hook must be defined separately, but only if at least one "qualifier(s)" command has been given<br />
if formatParams[parameters.qualifier] and cfg.states.qualifiersCount > 0 then<br />
hooks[parameters.qualifier] = getHookName(parameters.qualifier, 1)<br />
hooks.count = hooks.count + 1<br />
end<br />
<br />
-- create a state for "properties" if it doesn't exist yet, which will be used as a base configuration for each claim iteration;<br />
-- must come AFTER defining the hooks<br />
if not cfg.states[parameters.property] then<br />
cfg.states[parameters.property] = State:new(cfg, parameters.property)<br />
<br />
-- if the "single" flag has been given then this state should be equivalent to "property" (singular)<br />
if cfg.singleClaim then<br />
cfg.states[parameters.property].singleValue = true<br />
end<br />
end<br />
<br />
-- if the "sourced" flag has been given then create a state for "reference" if it doesn't exist yet, using default values,<br />
-- which must exist in order to be able to determine if a claim has any references;<br />
-- must come AFTER defining the hooks<br />
if cfg.sourcedOnly and not cfg.states[parameters.reference] then<br />
cfg:processFlagOrCommand(p.claimCommands.reference) -- use singular "reference" to minimize overhead<br />
end<br />
<br />
-- set the parsed format and the separators (and optional punctuation mark);<br />
-- must come AFTER creating the additonal states<br />
cfg:setFormatAndSeparators(cfg.states[parameters.property], parsedFormat)<br />
<br />
-- process qualifier matching values, analogous to cfg.propertyValue<br />
for i, v in pairs(args) do<br />
i = tostring(i)<br />
<br />
if i:match('^[Pp]%d+$') or aliasesP[i] then<br />
v = replaceSpecialChars(v)<br />
<br />
-- check for special qualifier value 'somevalue'<br />
if v ~= "" and mw.text.trim(v) == "" then<br />
v = " " -- single space represents 'somevalue'<br />
end<br />
<br />
cfg.qualifierIDsAndValues[replaceAlias(i):upper()] = v<br />
end<br />
end<br />
<br />
-- first sort the claims on rank to pre-define the order of output (preferred first, then normal, then deprecated)<br />
claims = sortOnRank(claims)<br />
<br />
-- then iterate through the claims to collect values<br />
value = cfg:concatValues(cfg.states[parameters.property]:iterate(claims, hooks, State.claimMatches)) -- pass property state with level 1 hooks and matchHook<br />
<br />
-- if desired, add a clickable icon that may be used to edit the returned values on Wikidata<br />
if cfg.editable and value ~= "" then<br />
value = value .. cfg:getEditIcon()<br />
end<br />
<br />
return value<br />
end<br />
<br />
local function generalCommand(args, funcName)<br />
local cfg = Config:new()<br />
cfg.curState = State:new(cfg)<br />
<br />
local lastArg<br />
local value = nil<br />
<br />
repeat<br />
lastArg = nextArg(args)<br />
until not cfg:processFlag(lastArg)<br />
<br />
-- get the entity ID from either the positional argument, the eid argument or the page argument<br />
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true)<br />
<br />
if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then<br />
return "" -- we cannot continue without an entity<br />
end<br />
<br />
-- serve according to the given command<br />
if funcName == p.generalCommands.label then<br />
value = cfg:getLabel(cfg.entityID, cfg.curState.rawValue, cfg.curState.linked, cfg.curState.shortName)<br />
elseif funcName == p.generalCommands.title then<br />
cfg.inSitelinks = true<br />
<br />
if cfg.entityID:sub(1,1) == "Q" then<br />
value = mw.wikibase.getSitelink(cfg.entityID)<br />
end<br />
<br />
if cfg.curState.linked and value then<br />
value = buildWikilink(value)<br />
end<br />
elseif funcName == p.generalCommands.description then<br />
value = mw.wikibase.getDescription(cfg.entityID)<br />
else<br />
local parsedFormat, formatParams<br />
local hooks = {count = 0}<br />
<br />
cfg.entity = mw.wikibase.getEntity(cfg.entityID)<br />
<br />
if funcName == p.generalCommands.alias or funcName == p.generalCommands.badge then<br />
cfg.curState.singleValue = true<br />
end<br />
<br />
if funcName == p.generalCommands.alias or funcName == p.generalCommands.aliases then<br />
if not cfg.entity.aliases or not cfg.entity.aliases[cfg.langCode] then<br />
return "" -- there is no use to continue without any aliasses<br />
end<br />
<br />
local aliases = cfg.entity.aliases[cfg.langCode]<br />
<br />
-- parse the desired format, or parse the default aliases format<br />
if args["format"] then<br />
parsedFormat, formatParams = parseFormat(args["format"])<br />
else<br />
parsedFormat, formatParams = parseFormat(formats.alias)<br />
end<br />
<br />
-- process overridden separator values;<br />
-- must come AFTER tweaking the default separators<br />
cfg:processSeparators(args)<br />
<br />
-- define the hook that should be called (getAlias);<br />
-- only define the hook if the parameter ("%a") has been given<br />
if formatParams[parameters.alias] then<br />
hooks[parameters.alias] = getHookName(parameters.alias, 1)<br />
hooks.count = hooks.count + 1<br />
end<br />
<br />
-- set the parsed format and the separators (and optional punctuation mark)<br />
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)<br />
<br />
-- iterate to collect values<br />
value = cfg:concatValues(cfg.curState:iterate(aliases, hooks))<br />
elseif funcName == p.generalCommands.badge or funcName == p.generalCommands.badges then<br />
if not cfg.entity.sitelinks or not cfg.entity.sitelinks[cfg.siteID] or not cfg.entity.sitelinks[cfg.siteID].badges then<br />
return "" -- there is no use to continue without any badges<br />
end<br />
<br />
local badges = cfg.entity.sitelinks[cfg.siteID].badges<br />
<br />
cfg.inSitelinks = true<br />
<br />
-- parse the desired format, or parse the default aliases format<br />
if args["format"] then<br />
parsedFormat, formatParams = parseFormat(args["format"])<br />
else<br />
parsedFormat, formatParams = parseFormat(formats.badge)<br />
end<br />
<br />
-- process overridden separator values;<br />
-- must come AFTER tweaking the default separators<br />
cfg:processSeparators(args)<br />
<br />
-- define the hook that should be called (getBadge);<br />
-- only define the hook if the parameter ("%b") has been given<br />
if formatParams[parameters.badge] then<br />
hooks[parameters.badge] = getHookName(parameters.badge, 1)<br />
hooks.count = hooks.count + 1<br />
end<br />
<br />
-- set the parsed format and the separators (and optional punctuation mark)<br />
cfg:setFormatAndSeparators(cfg.curState, parsedFormat)<br />
<br />
-- iterate to collect values<br />
value = cfg:concatValues(cfg.curState:iterate(badges, hooks))<br />
end<br />
end<br />
<br />
value = value or ""<br />
<br />
if cfg.editable and value ~= "" then<br />
-- if desired, add a clickable icon that may be used to edit the returned value on Wikidata<br />
value = value .. cfg:getEditIcon()<br />
end<br />
<br />
return value<br />
end<br />
<br />
-- modules that include this module should call the functions with an underscore prepended, e.g.: p._property(args)<br />
local function establishCommands(commandList, commandFunc)<br />
for _, commandName in pairs(commandList) do<br />
local function wikitextWrapper(frame)<br />
local args = copyTable(frame.args)<br />
args.pointer = 1<br />
loadI18n(aliasesP, frame)<br />
return commandFunc(args, commandName)<br />
end<br />
p[commandName] = wikitextWrapper<br />
<br />
local function luaWrapper(args)<br />
args = copyTable(args)<br />
args.pointer = 1<br />
loadI18n(aliasesP)<br />
return commandFunc(args, commandName)<br />
end<br />
p["_" .. commandName] = luaWrapper<br />
end<br />
end<br />
<br />
establishCommands(p.claimCommands, claimCommand)<br />
establishCommands(p.generalCommands, generalCommand)<br />
<br />
-- main function that is supposed to be used by wrapper templates<br />
function p.main(frame)<br />
if not mw.wikibase then return nil end<br />
<br />
local f, args<br />
<br />
loadI18n(aliasesP, frame)<br />
<br />
-- get the parent frame to take the arguments that were passed to the wrapper template<br />
frame = frame:getParent() or frame<br />
<br />
if not frame.args[1] then<br />
throwError("no-function-specified")<br />
end<br />
<br />
f = mw.text.trim(frame.args[1])<br />
<br />
if f == "main" then<br />
throwError("main-called-twice")<br />
end<br />
<br />
assert(p["_"..f], errorText('no-such-function', f))<br />
<br />
-- copy arguments from immutable to mutable table<br />
args = copyTable(frame.args)<br />
<br />
-- remove the function name from the list<br />
table.remove(args, 1)<br />
<br />
return p["_"..f](args)<br />
end<br />
<br />
return p</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:String&diff=2280
モジュール:String
2021-02-21T14:49:40Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>--[[<br />
<br />
This module is intended to provide access to basic string functions.<br />
<br />
Most of the functions provided here can be invoked with named parameters,<br />
unnamed parameters, or a mixture. If named parameters are used, Mediawiki will<br />
automatically remove any leading or trailing whitespace from the parameter.<br />
Depending on the intended use, it may be advantageous to either preserve or<br />
remove such whitespace.<br />
<br />
Global options<br />
ignore_errors: If set to 'true' or 1, any error condition will result in<br />
an empty string being returned rather than an error message.<br />
<br />
error_category: If an error occurs, specifies the name of a category to<br />
include with the error message. The default category is<br />
[Category:Errors reported by Module String].<br />
<br />
no_category: If set to 'true' or 1, no category will be added if an error<br />
is generated.<br />
<br />
Unit tests for this module are available at Module:String/tests.<br />
]]<br />
<br />
local str = {}<br />
<br />
--[[<br />
len<br />
<br />
This function returns the length of the target string.<br />
<br />
Usage:<br />
{{#invoke:String|len|target_string|}}<br />
OR<br />
{{#invoke:String|len|s=target_string}}<br />
<br />
Parameters<br />
s: The string whose length to report<br />
<br />
If invoked using named parameters, Mediawiki will automatically remove any leading or<br />
trailing whitespace from the target string.<br />
]]<br />
function str.len( frame )<br />
local new_args = str._getParameters( frame.args, {'s'} )<br />
local s = new_args['s'] or ''<br />
return mw.ustring.len( s )<br />
end<br />
<br />
--[[<br />
sub<br />
<br />
This function returns a substring of the target string at specified indices.<br />
<br />
Usage:<br />
{{#invoke:String|sub|target_string|start_index|end_index}}<br />
OR<br />
{{#invoke:String|sub|s=target_string|i=start_index|j=end_index}}<br />
<br />
Parameters<br />
s: The string to return a subset of<br />
i: The fist index of the substring to return, defaults to 1.<br />
j: The last index of the string to return, defaults to the last character.<br />
<br />
The first character of the string is assigned an index of 1. If either i or j<br />
is a negative value, it is interpreted the same as selecting a character by<br />
counting from the end of the string. Hence, a value of -1 is the same as<br />
selecting the last character of the string.<br />
<br />
If the requested indices are out of range for the given string, an error is<br />
reported.<br />
]]<br />
function str.sub( frame )<br />
local new_args = str._getParameters( frame.args, { 's', 'i', 'j' } )<br />
local s = new_args['s'] or ''<br />
local i = tonumber( new_args['i'] ) or 1<br />
local j = tonumber( new_args['j'] ) or -1<br />
<br />
local len = mw.ustring.len( s )<br />
<br />
-- Convert negatives for range checking<br />
if i < 0 then<br />
i = len + i + 1<br />
end<br />
if j < 0 then<br />
j = len + j + 1<br />
end<br />
<br />
if i > len or j > len or i < 1 or j < 1 then<br />
return str._error( 'String subset index out of range' )<br />
end<br />
if j < i then<br />
return str._error( 'String subset indices out of order' )<br />
end<br />
<br />
return mw.ustring.sub( s, i, j )<br />
end<br />
<br />
--[[<br />
This function implements that features of {{str sub old}} and is kept in order<br />
to maintain these older templates.<br />
]]<br />
function str.sublength( frame )<br />
local i = tonumber( frame.args.i ) or 0<br />
local len = tonumber( frame.args.len )<br />
return mw.ustring.sub( frame.args.s, i + 1, len and ( i + len ) )<br />
end<br />
<br />
--[[<br />
_match<br />
<br />
This function returns a substring from the source string that matches a<br />
specified pattern. It is exported for use in other modules<br />
<br />
Usage:<br />
strmatch = require("Module:String")._match<br />
sresult = strmatch( s, pattern, start, match, plain, nomatch )<br />
<br />
Parameters<br />
s: The string to search<br />
pattern: The pattern or string to find within the string<br />
start: The index within the source string to start the search. The first<br />
character of the string has index 1. Defaults to 1.<br />
match: In some cases it may be possible to make multiple matches on a single<br />
string. This specifies which match to return, where the first match is<br />
match= 1. If a negative number is specified then a match is returned<br />
counting from the last match. Hence match = -1 is the same as requesting<br />
the last match. Defaults to 1.<br />
plain: A flag indicating that the pattern should be understood as plain<br />
text. Defaults to false.<br />
nomatch: If no match is found, output the "nomatch" value rather than an error.<br />
<br />
For information on constructing Lua patterns, a form of [regular expression], see:<br />
<br />
* http://www.lua.org/manual/5.1/manual.html#5.4.1<br />
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns<br />
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns<br />
<br />
]]<br />
-- This sub-routine is exported for use in other modules<br />
function str._match( s, pattern, start, match_index, plain_flag, nomatch )<br />
if s == '' then<br />
return str._error( 'Target string is empty' )<br />
end<br />
if pattern == '' then<br />
return str._error( 'Pattern string is empty' )<br />
end<br />
start = tonumber(start) or 1<br />
if math.abs(start) < 1 or math.abs(start) > mw.ustring.len( s ) then<br />
return str._error( 'Requested start is out of range' )<br />
end<br />
if match_index == 0 then<br />
return str._error( 'Match index is out of range' )<br />
end<br />
if plain_flag then<br />
pattern = str._escapePattern( pattern )<br />
end<br />
<br />
local result<br />
if match_index == 1 then<br />
-- Find first match is simple case<br />
result = mw.ustring.match( s, pattern, start )<br />
else<br />
if start > 1 then<br />
s = mw.ustring.sub( s, start )<br />
end<br />
<br />
local iterator = mw.ustring.gmatch(s, pattern)<br />
if match_index > 0 then<br />
-- Forward search<br />
for w in iterator do<br />
match_index = match_index - 1<br />
if match_index == 0 then<br />
result = w<br />
break<br />
end<br />
end<br />
else<br />
-- Reverse search<br />
local result_table = {}<br />
local count = 1<br />
for w in iterator do<br />
result_table[count] = w<br />
count = count + 1<br />
end<br />
<br />
result = result_table[ count + match_index ]<br />
end<br />
end<br />
<br />
if result == nil then<br />
if nomatch == nil then<br />
return str._error( 'Match not found' )<br />
else<br />
return nomatch<br />
end<br />
else<br />
return result<br />
end<br />
end<br />
<br />
--[[<br />
match<br />
<br />
This function returns a substring from the source string that matches a<br />
specified pattern.<br />
<br />
Usage:<br />
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}<br />
OR<br />
{{#invoke:String|match|s=source_string|pattern=pattern_string|start=start_index<br />
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}<br />
<br />
Parameters<br />
s: The string to search<br />
pattern: The pattern or string to find within the string<br />
start: The index within the source string to start the search. The first<br />
character of the string has index 1. Defaults to 1.<br />
match: In some cases it may be possible to make multiple matches on a single<br />
string. This specifies which match to return, where the first match is<br />
match= 1. If a negative number is specified then a match is returned<br />
counting from the last match. Hence match = -1 is the same as requesting<br />
the last match. Defaults to 1.<br />
plain: A flag indicating that the pattern should be understood as plain<br />
text. Defaults to false.<br />
nomatch: If no match is found, output the "nomatch" value rather than an error.<br />
<br />
If invoked using named parameters, Mediawiki will automatically remove any leading or<br />
trailing whitespace from each string. In some circumstances this is desirable, in<br />
other cases one may want to preserve the whitespace.<br />
<br />
If the match_number or start_index are out of range for the string being queried, then<br />
this function generates an error. An error is also generated if no match is found.<br />
If one adds the parameter ignore_errors=true, then the error will be suppressed and<br />
an empty string will be returned on any failure.<br />
<br />
For information on constructing Lua patterns, a form of [regular expression], see:<br />
<br />
* http://www.lua.org/manual/5.1/manual.html#5.4.1<br />
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns<br />
* http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Ustring_patterns<br />
<br />
]]<br />
-- This is the entry point for #invoke:String|match<br />
function str.match( frame )<br />
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} )<br />
local s = new_args['s'] or ''<br />
local start = tonumber( new_args['start'] ) or 1<br />
local plain_flag = str._getBoolean( new_args['plain'] or false )<br />
local pattern = new_args['pattern'] or ''<br />
local match_index = math.floor( tonumber(new_args['match']) or 1 )<br />
local nomatch = new_args['nomatch']<br />
<br />
return str._match( s, pattern, start, match_index, plain_flag, nomatch )<br />
end<br />
<br />
--[[<br />
pos<br />
<br />
This function returns a single character from the target string at position pos.<br />
<br />
Usage:<br />
{{#invoke:String|pos|target_string|index_value}}<br />
OR<br />
{{#invoke:String|pos|target=target_string|pos=index_value}}<br />
<br />
Parameters<br />
target: The string to search<br />
pos: The index for the character to return<br />
<br />
If invoked using named parameters, Mediawiki will automatically remove any leading or<br />
trailing whitespace from the target string. In some circumstances this is desirable, in<br />
other cases one may want to preserve the whitespace.<br />
<br />
The first character has an index value of 1.<br />
<br />
If one requests a negative value, this function will select a character by counting backwards<br />
from the end of the string. In other words pos = -1 is the same as asking for the last character.<br />
<br />
A requested value of zero, or a value greater than the length of the string returns an error.<br />
]]<br />
function str.pos( frame )<br />
local new_args = str._getParameters( frame.args, {'target', 'pos'} )<br />
local target_str = new_args['target'] or ''<br />
local pos = tonumber( new_args['pos'] ) or 0<br />
<br />
if pos == 0 or math.abs(pos) > mw.ustring.len( target_str ) then<br />
return str._error( 'String index out of range' )<br />
end<br />
<br />
return mw.ustring.sub( target_str, pos, pos )<br />
end<br />
<br />
--[[<br />
str_find<br />
<br />
This function duplicates the behavior of {{str_find}}, including all of its quirks.<br />
This is provided in order to support existing templates, but is NOT RECOMMENDED for<br />
new code and templates. New code is recommended to use the "find" function instead.<br />
<br />
Returns the first index in "source" that is a match to "target". Indexing is 1-based,<br />
and the function returns -1 if the "target" string is not present in "source".<br />
<br />
Important Note: If the "target" string is empty / missing, this function returns a<br />
value of "1", which is generally unexpected behavior, and must be accounted for<br />
separatetly.<br />
]]<br />
function str.str_find( frame )<br />
local new_args = str._getParameters( frame.args, {'source', 'target'} )<br />
local source_str = new_args['source'] or ''<br />
local target_str = new_args['target'] or ''<br />
<br />
if target_str == '' then<br />
return 1<br />
end<br />
<br />
local start = mw.ustring.find( source_str, target_str, 1, true )<br />
if start == nil then<br />
start = -1<br />
end<br />
<br />
return start<br />
end<br />
<br />
--[[<br />
find<br />
<br />
This function allows one to search for a target string or pattern within another<br />
string.<br />
<br />
Usage:<br />
{{#invoke:String|find|source_str|target_string|start_index|plain_flag}}<br />
OR<br />
{{#invoke:String|find|source=source_str|target=target_str|start=start_index|plain=plain_flag}}<br />
<br />
Parameters<br />
source: The string to search<br />
target: The string or pattern to find within source<br />
start: The index within the source string to start the search, defaults to 1<br />
plain: Boolean flag indicating that target should be understood as plain<br />
text and not as a Lua style regular expression, defaults to true<br />
<br />
If invoked using named parameters, Mediawiki will automatically remove any leading or<br />
trailing whitespace from the parameter. In some circumstances this is desirable, in<br />
other cases one may want to preserve the whitespace.<br />
<br />
This function returns the first index >= "start" where "target" can be found<br />
within "source". Indices are 1-based. If "target" is not found, then this<br />
function returns 0. If either "source" or "target" are missing / empty, this<br />
function also returns 0.<br />
<br />
This function should be safe for UTF-8 strings.<br />
]]<br />
function str.find( frame )<br />
local new_args = str._getParameters( frame.args, {'source', 'target', 'start', 'plain' } )<br />
local source_str = new_args['source'] or ''<br />
local pattern = new_args['target'] or ''<br />
local start_pos = tonumber(new_args['start']) or 1<br />
local plain = new_args['plain'] or true<br />
<br />
if source_str == '' or pattern == '' then<br />
return 0<br />
end<br />
<br />
plain = str._getBoolean( plain )<br />
<br />
local start = mw.ustring.find( source_str, pattern, start_pos, plain )<br />
if start == nil then<br />
start = 0<br />
end<br />
<br />
return start<br />
end<br />
<br />
--[[<br />
replace<br />
<br />
This function allows one to replace a target string or pattern within another<br />
string.<br />
<br />
Usage:<br />
{{#invoke:String|replace|source_str|pattern_string|replace_string|replacement_count|plain_flag}}<br />
OR<br />
{{#invoke:String|replace|source=source_string|pattern=pattern_string|replace=replace_string|<br />
count=replacement_count|plain=plain_flag}}<br />
<br />
Parameters<br />
source: The string to search<br />
pattern: The string or pattern to find within source<br />
replace: The replacement text<br />
count: The number of occurences to replace, defaults to all.<br />
plain: Boolean flag indicating that pattern should be understood as plain<br />
text and not as a Lua style regular expression, defaults to true<br />
]]<br />
function str.replace( frame )<br />
local new_args = str._getParameters( frame.args, {'source', 'pattern', 'replace', 'count', 'plain' } )<br />
local source_str = new_args['source'] or ''<br />
local pattern = new_args['pattern'] or ''<br />
local replace = new_args['replace'] or ''<br />
local count = tonumber( new_args['count'] )<br />
local plain = new_args['plain'] or true<br />
<br />
if source_str == '' or pattern == '' then<br />
return source_str<br />
end<br />
plain = str._getBoolean( plain )<br />
<br />
if plain then<br />
pattern = str._escapePattern( pattern )<br />
replace = mw.ustring.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences.<br />
end<br />
<br />
local result<br />
<br />
if count ~= nil then<br />
result = mw.ustring.gsub( source_str, pattern, replace, count )<br />
else<br />
result = mw.ustring.gsub( source_str, pattern, replace )<br />
end<br />
<br />
return result<br />
end<br />
<br />
--[[<br />
simple function to pipe string.rep to templates.<br />
]]<br />
function str.rep( frame )<br />
local repetitions = tonumber( frame.args[2] )<br />
if not repetitions then<br />
return str._error( 'function rep expects a number as second parameter, received "' .. ( frame.args[2] or '' ) .. '"' )<br />
end<br />
return string.rep( frame.args[1] or '', repetitions )<br />
end<br />
<br />
--[[<br />
escapePattern<br />
<br />
This function escapes special characters from a Lua string pattern. See [1]<br />
for details on how patterns work.<br />
<br />
[1] https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Patterns<br />
<br />
Usage:<br />
{{#invoke:String|escapePattern|pattern_string}}<br />
<br />
Parameters<br />
pattern_string: The pattern string to escape.<br />
]]<br />
function str.escapePattern( frame )<br />
local pattern_str = frame.args[1]<br />
if not pattern_str then<br />
return str._error( 'No pattern string specified' )<br />
end<br />
local result = str._escapePattern( pattern_str )<br />
return result<br />
end<br />
<br />
--[[<br />
count<br />
This function counts the number of occurrences of one string in another.<br />
]]<br />
function str.count(frame)<br />
local args = str._getParameters(frame.args, {'source', 'pattern', 'plain'})<br />
local source = args.source or ''<br />
local pattern = args.pattern or ''<br />
local plain = str._getBoolean(args.plain or true)<br />
if plain then<br />
pattern = str._escapePattern(pattern)<br />
end<br />
local _, count = mw.ustring.gsub(source, pattern, '')<br />
return count<br />
end<br />
<br />
--[[<br />
endswith<br />
This function determines whether a string ends with another string.<br />
]]<br />
function str.endswith(frame)<br />
local args = str._getParameters(frame.args, {'source', 'pattern'})<br />
local source = args.source or ''<br />
local pattern = args.pattern or ''<br />
if pattern == '' then<br />
-- All strings end with the empty string.<br />
return "yes"<br />
end<br />
if mw.ustring.sub(source, -mw.ustring.len(pattern), -1) == pattern then<br />
return "yes"<br />
else<br />
return ""<br />
end<br />
end<br />
<br />
--[[<br />
join<br />
<br />
Join all non empty arguments together; the first argument is the separator.<br />
Usage:<br />
{{#invoke:String|join|sep|one|two|three}}<br />
]]<br />
function str.join(frame)<br />
local args = {}<br />
local sep<br />
for _, v in ipairs( frame.args ) do<br />
if sep then<br />
if v ~= '' then<br />
table.insert(args, v)<br />
end<br />
else<br />
sep = v<br />
end<br />
end<br />
return table.concat( args, sep or '' )<br />
end<br />
<br />
--[[<br />
Helper function that populates the argument list given that user may need to use a mix of<br />
named and unnamed parameters. This is relevant because named parameters are not<br />
identical to unnamed parameters due to string trimming, and when dealing with strings<br />
we sometimes want to either preserve or remove that whitespace depending on the application.<br />
]]<br />
function str._getParameters( frame_args, arg_list )<br />
local new_args = {}<br />
local index = 1<br />
local value<br />
<br />
for _, arg in ipairs( arg_list ) do<br />
value = frame_args[arg]<br />
if value == nil then<br />
value = frame_args[index]<br />
index = index + 1<br />
end<br />
new_args[arg] = value<br />
end<br />
<br />
return new_args<br />
end<br />
<br />
--[[<br />
Helper function to handle error messages.<br />
]]<br />
function str._error( error_str )<br />
local frame = mw.getCurrentFrame()<br />
local error_category = frame.args.error_category or 'Errors reported by Module String'<br />
local ignore_errors = frame.args.ignore_errors or false<br />
local no_category = frame.args.no_category or false<br />
<br />
if str._getBoolean(ignore_errors) then<br />
return ''<br />
end<br />
<br />
local error_str = '<strong class="error">String Module Error: ' .. error_str .. '</strong>'<br />
if error_category ~= '' and not str._getBoolean( no_category ) then<br />
error_str = '[[Category:' .. error_category .. ']]' .. error_str<br />
end<br />
<br />
return error_str<br />
end<br />
<br />
--[[<br />
Helper Function to interpret boolean strings<br />
]]<br />
function str._getBoolean( boolean_str )<br />
local boolean_value<br />
<br />
if type( boolean_str ) == 'string' then<br />
boolean_str = boolean_str:lower()<br />
if boolean_str == 'false' or boolean_str == 'no' or boolean_str == '0'<br />
or boolean_str == '' then<br />
boolean_value = false<br />
else<br />
boolean_value = true<br />
end<br />
elseif type( boolean_str ) == 'boolean' then<br />
boolean_value = boolean_str<br />
else<br />
error( 'No boolean value found' )<br />
end<br />
return boolean_value<br />
end<br />
<br />
--[[<br />
Helper function that escapes all pattern characters so that they will be treated<br />
as plain text.<br />
]]<br />
function str._escapePattern( pattern_str )<br />
return mw.ustring.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" )<br />
end<br />
<br />
return str</div>
MasterWiki
https://hokudaiwiki.net/hokudaiwiki_main/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Side_box&diff=2278
モジュール:Side box
2021-02-21T14:49:40Z
<p>MasterWiki: 1版 をインポートしました</p>
<hr />
<div>-- This module implements {{side box}}.<br />
<br />
local yesno = require('Module:Yesno')<br />
<br />
local p = {}<br />
<br />
function p.main(frame)<br />
local origArgs = frame:getParent().args<br />
local args = {}<br />
for k, v in pairs(origArgs) do<br />
v = v:match('%s*(.-)%s*$')<br />
if v ~= '' then<br />
args[k] = v<br />
end<br />
end<br />
return p._main(args)<br />
end<br />
<br />
function p._main(args)<br />
local data = p.makeData(args)<br />
return p.renderSidebox(data)<br />
end<br />
<br />
function p.makeData(args)<br />
local data = {}<br />
<br />
-- Main table classes<br />
data.classes = {}<br />
if args.position and args.position:lower() == 'left' then<br />
table.insert(data.classes, 'mbox-small-left')<br />
else<br />
table.insert(data.classes, 'mbox-small')<br />
end<br />
table.insert(data.classes, args.class)<br />
<br />
-- Image<br />
if args.image and args.image ~= 'none' then<br />
data.image = args.image<br />
end<br />
<br />
-- Copy over data that doesn't need adjusting<br />
local argsToCopy = {<br />
-- Styles<br />
'style',<br />
'textstyle',<br />
<br />
-- Above row<br />
'above',<br />
'abovestyle',<br />
<br />
-- Body row<br />
'text',<br />
'imageright',<br />
<br />
-- Below row<br />
'below',<br />
}<br />
for i, key in ipairs(argsToCopy) do<br />
data[key] = args[key]<br />
end<br />
<br />
return data<br />
end<br />
<br />
function p.renderSidebox(data)<br />
-- Renders the sidebox HTML.<br />
<br />
-- Table root<br />
local root = mw.html.create('table')<br />
for i, class in ipairs(data.classes or {}) do<br />
root:addClass(class)<br />
end<br />
root:css{border = '1px solid #aaa', ['background-color'] = '#f9f9f9'}<br />
if data.style then<br />
root:cssText(data.style)<br />
end<br />
<br />
-- The "above" row<br />
if data.above then<br />
local aboveCell = root:newline():tag('tr'):tag('td')<br />
aboveCell<br />
:attr('colspan', data.imageright and 3 or 2)<br />
:addClass('mbox-text')<br />
if data.textstyle then<br />
aboveCell:cssText(data.textstyle)<br />
end<br />
if data.abovestyle then<br />
aboveCell:cssText(data.abovestyle)<br />
end<br />
aboveCell<br />
:newline()<br />
:wikitext(data.above)<br />
end<br />
<br />
-- The body row<br />
local bodyRow = root:newline():tag('tr'):newline()<br />
if data.image then<br />
bodyRow:tag('td')<br />
:addClass('mbox-image')<br />
:wikitext(data.image)<br />
else<br />
bodyRow:tag('td'):css('width', '1px')<br />
end<br />
local textCell = bodyRow:newline():tag('td')<br />
textCell:addClass('mbox-text plainlist')<br />
if data.textstyle then<br />
textCell:cssText(data.textstyle)<br />
end<br />
textCell:wikitext(data.text)<br />
if data.imageright then<br />
bodyRow:newline():tag('td')<br />
:addClass('mbox-imageright')<br />
:wikitext(data.imageright)<br />
end<br />
<br />
-- The below row<br />
if data.below then<br />
local belowCell = root:newline():tag('tr'):tag('td')<br />
belowCell<br />
:attr('colspan', data.imageright and 3 or 2)<br />
:addClass('mbox-text')<br />
if data.textstyle then<br />
belowCell:cssText(data.textstyle)<br />
end<br />
belowCell:wikitext(data.below)<br />
end<br />
<br />
return tostring(root)<br />
end<br />
<br />
return p</div>
MasterWiki