「ヘルプ:ListingEditor」の版間の差分

提供:ウィキボヤージュ
翻訳
タグ: モバイル編集 モバイルウェブ編集 改良版モバイル編集
Tmv がページ「利用者:Tmv/listing editor」を「ヘルプ:ListingEditor」に移動しました: スクリプトのガジェット化
(相違点なし)

2021年3月10日 (水) 07:17時点における版

フォームベースのlisting editorを使用すると、listingテンプレートの追加や編集が可能です。Wikivoyage:Listingも参照。

使用方法

各リストは、リストフォームに以下のように入力することで記述することができます。

  • Name/名前: 目的地の名前です。
  • Alt/別名: 目的地の別名。日本国外の目的地は現地の言葉の名前を書く。言語ラベルを使うと便利。
  • Website/WEB: 目的地の公式サイト。この値は設定しておくことが推奨されます。
  • Address/住所: 目的地の所在地。住所です。この値は設定しておくことが推奨されます。
  • Directions/アクセス: 近くの駅や高速道路の出口、港さらには空港などから目的地までのルート。東京などの大都市から目的地に着くまでの交通機関の案内も可。
  • Phone/電話: 目的地と連絡が取れる電話番号。
  • Tollfree/フリーダイヤル: 目的地にフリーダイアルがある場合、それを記入。
  • Fax: FAX。
  • Email/メール: 目的地と連絡が取れるメールアドレス。
  • Last Updated: 最終更新日時。無記入で可。
  • type/タイプ: listingテンプレートのタイプ。listingテンプレートには様々な種類がある。詳細はWikivoyage:Listing#サンプルを参照。
  • Latitude/緯度: 目的地の緯度。10進法で。値についてはWikivoyage:Listing#緯度経度の情報源も参照してください。この値は設定しておくことが推奨されます。
  • Longitude/経度: 目的地の経度。10進法で。値についてはWikivoyage:Listing#緯度経度の情報源も参照してください。この値は設定しておくことが推奨されます。
    •  : lat (Latitude/緯度) とlong (Longitude/経度) は小数点以下の値が同じでなくてはなりません. 座標取得にはGeoMapがオススメです。
  • Hours/時間: 目的地が営業している時間。
  • Price/値段: 入場料や宿泊料など、その目的地を利用するために必要なお金の値段。
  • Wikidata: その目的地がWikidataにおいて項目として存在するならば、その項目の項目名をつけるのが適切でしょう。Wikidataへのリンクがあれば記述されていない情報をWikidataから取得することも可能です (「ウィキデータとの共有フィールドの同期」機能) 。
  • Wikipedia: 目的地についてのWikipediaのページ名。これを指定するとWikidataの項目名をワンクリックで書くことができます (Wikidataのボックスの「WP」を押してみてください)。
  • Image/写真: 地図上の目的地のピンに表示される画像です。名前空間名 (File:image:など) は付けないでください。
  • この値で共有フィールドを更新しますか?: クリックすると、Wikidataのロゴがついているボックスの情報が全てWikidataのものに変わります。何も書いていなかった場合Wikidataの情報が追加されます。この機能はWikidataの項目が指定されている場合のみ利用可能です。
  • listを最新のものとしてマークする: このボックスにチェックをいれると、最終更新日が更新されます。情報を更新したときなどは忘れずにここにチェックを入れてください。
  • このlistingを削除: ここにチェックを入れて投稿ボタンを押すことで、listingテンプレートを削除することができます。
  • 編集の要約: 編集の要約です。ここに書いたものは、ページの履歴に「listingeditorでリストを更新 : (名前) - (要約)」のように表示されます。
  • 細部の編集: 細部の編集です。ここにチェックを入れると、編集が細部の編集としてマークされます。

他にもパラメータが存在し、Wikivoyage:Listingで解説されています。

機能

listing editorを開く前の画面
listing editorを開いた後の画面

Listing Editorはとても便利な機能で、特定のパラメータを表示したり非表示にしたり、ヘルプページへのリンクのような拡張機能を提供します。エディターはテンプレートを柔軟化し、<span class="vcard">と、対応する名前 (<span class="org">)・住所 (<span class="label">)・代替のニックネーム (<span class="nickname">) がついている項目ではHTMLではなくwikitextにとても依存しています。目的地のジオコーディングは、geoテンプレートの中に<span id="geodata">lat;long</span>を含めることで実現できます。

  • ガイドページの一部セクションに[リストを追加]ボタンを追加します (「観る」・「する」・「買う」・「食べる」・「泊まる」・「困ったときは」節に追加されます)。
  • 見出しの名前によってListingテンプレートのタイプを自動で選択します。
  • Listingテンプレートに小さな「編集」ボタンが追加されます。
  • {{Listing}}テンプレートの引数を一覧表示できるポップアップ状のエディターを開きます。
  • 編集の要約が自動で生成されます。

バグとフィードバック

Feel free to report bugs here. Try and describe the odd behaviour, and if possible, give an example listing or article where this occurs.

  • The "wrapContent" method can cause problems with complex HTML around headings. For an example see the "collapse" link at WV:Votes for deletion#Archving.
  • Wrong listing is selected when edit button is clicked on an old version of page: If I view an old copy of a page, which has subsequently had new listings added above the one I am trying to edit, the editor brings up the wrong listing. That is, if I select the nth listing on an old page, the editor selects the nth listing of the current page. Peter Chastain (talk) 13:36, 16 January 2016 (UTC)
A somewhat related issue: If I begin to edit a listing with the listing editor, and then someone else edits and saves the article, and I then save my changes, the other editor's changes are lost. Peter Chastain (talk) 20:02, 16 January 2016 (UTC)
  • Template:Go breaks the listing editor. See Cleveland#By plane for an example - the listing type is unrecognized and the editor does not open. -- Ryan • (talk) • 02:34, 26 January 2017 (UTC)
  • When clicking any following section other than listings under the first section, information for another listing that is further up will be displayed, rather than the one being selected. Results in "Error: An unknown error has been encountered while attempting to save the listing, please try again: invalidsection" when saving. – Craig Davison (talk) 08:27, 18 April 2018 (UTC)
  • The string literal "$&" in a listing causes the output to go replace it, rather than the entire listing, on save. See the series of edits after special:diff/3766113. ARR8 (トーク | 投稿記録) 03:53, 22 April 2019 (UTC)
  • Listing that has a template or an image between "*" and "{{" are not correctly deleted. See this change for further details.

要望

Please discuss feature requests at en:Wikivoyage talk:Listing editor prior to adding below so that others can provide feedback and suggestions.

  • Mobile support. Allow the listing editor to be used on mobile devices.
  • Better geocoding. Make it easier to integrate GeoMap and enter latitude/longitude, perhaps a single line rather than two text inputs, or even the ability to launch a small OpenStreetMap popup to click the point.
  • Loading times. The listing editor has the equivalent load time of editing a section plus additional time for creating and opening the form. The script runs sequentially, waiting for the API to return the section to be edited, then creates the form. Technically the form could be created during the wait instead of after (might reduce loading time by 20-30%).

インストール方法

英語版でデフォルトで有効のガジェットとして運用されています : JavaScript / CSS。英語版を導入するには以下のコードを指定されたページに入力します :

common.js :
mw.loader.load('//en.wikivoyage.org/w/index.php?title=MediaWiki:Gadget-ListingEditor.js&action=raw&ctype=text/javascript');

必要ならばcommon.cssに英語版のCSSをインポートしてください。

日本語版も存在しますが、個人により翻訳された利用者カスタムでありサイトによってサポートされているわけではありません。日本語版を導入したい場合は以下のコードを指定されたページに入力します :

common.js :
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=User:Tmv/listing_editor.js&action=raw&ctype=text/javascript');

バージョン

設定

The ListingEditor.Config module contains parameters that must be customized for each language.

TRANSLATIONS
Strings that must be translated into the local language.
MAX_DIALOG_WIDTH
Maximum allowed width of the listing editor (specified in pixels)
ALLOW_UNRECOGNIZED_PARAMETERS
Flag indicating whether or not the listing editor should automatically strip out template parameters that it does not recognize when a listing is saved. The list of "recognized" parameters are configured in the LISTING_TEMPLATES configuration array.
SECTION_TO_TEMPLATE_TYPE
Array that specifies what listing template should be used for each article section. Note that the array matches by section ID, so underscores are required instead of spaces.
DISALLOW_ADD_LISTING_IF_PRESENT
A list of JQuery selectors that, if matched, will prevent the listing editor from adding "add listing" links to any section on the page. Useful for preventing "add listing" links from being added to country or region articles.
DEFAULT_LISTING_TEMPLATE
The name of the default listing template. On English Wikivoyage the default listing template is Template:Listing.
LISTING_TYPE_PARAMETER
Listing template parameter indicating the template type. On English Wikivoyage this is the "type" parameter.
LISTING_CONTENT_PARAMETER
Listing template parameter indicating the template content. On English Wikivoyage this is the "content" parameter.
EDIT_LINK_CONTAINER
Template:Listing must be configured with an HTML element that will contain "edit listing" links, and this parameter specifies a JQuery selector that matches that HTML element.
LISTING_TEMPLATE_PARAMETERS
This configuration object links the listing editor HTML (as specified in the EDITOR_FORM configuration value) to the wiki syntax used as the template parameters. A single configuration array can be specified if all listing templates behave the same, or multiple arrays can be specified to support different behavior for different templates - for example, on English Wikivoyage a separate SLEEP_TEMPLATE_PARAMETERS array is configured to support the fact that the sleep template uses "checkin" and "checkout" instead of "hours.
LISTING_TEMPLATES
This array links each supported template type to its configuration object. For example, template "listing" uses LISTING_TEMPLATE_PARAMETERS.
EDITOR_FORM_SELECTOR
A JQuery selector that will match the listing editor UI specified in EDITOR_FORM.
EDITOR_CLOSED_SELECTOR
A JQuery selector that will match the listing editor UI specified in EDITOR_FORM corresponding to the input indicating that a listing should be removed from the site.
EDITOR_SUMMARY
A JQuery selector that will match the listing editor UI specified in EDITOR_FORM corresponding to the edit summary input field.
EDITOR_MINOR_EDIT
A JQuery selector that will match the listing editor UI specified in EDITOR_FORM corresponding to the checkbox indicating that an edit is a minor edit.
EDITOR_FORM
The HTML to use for the listing editor UI.

コールバック

Different language versions may wish to implement custom functionality, which is supported via the ListingEditor.Callbacks module. There are currently three types of callbacks supported:

CREATE_FORM_CALLBACKS
Called when the listing editor UI is created. The default configuration includes callbacks that initialize the geomap and currency symbol functionality.
SUBMIT_FORM_CALLBACKS
Called when the listing editor form is submitted but prior to validating the data. The default configuration includes callbacks that process the "last edit" date.
VALIDATE_FORM_CALLBACKS
Called when the listing editor form is submitted and after the submit form callbacks have been invoked. Validator functionality includes verifying that a listing is not empty, and that any entered email address is valid. If a validator returns a non-empty message string then that value will be displayed to the user and the form will not be submitted.