From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/mdn/tools/add-ons_and_plug-ins/index.html | 33 ++ files/ja/mdn/tools/content_kits/index.html | 67 +++ files/ja/mdn/tools/document_parameters/index.html | 95 +++++ files/ja/mdn/tools/feeds/index.html | 53 +++ files/ja/mdn/tools/index.html | 14 + files/ja/mdn/tools/kumascript/index.html | 471 +++++++++++++++++++++ .../tools/kumascript/troubleshooting/index.html | 65 +++ files/ja/mdn/tools/page_deletion/index.html | 61 +++ files/ja/mdn/tools/page_moving/index.html | 57 +++ files/ja/mdn/tools/page_regeneration/index.html | 34 ++ files/ja/mdn/tools/page_watching/index.html | 49 +++ files/ja/mdn/tools/put_api/index.html | 208 +++++++++ files/ja/mdn/tools/revision_dashboard/index.html | 117 +++++ files/ja/mdn/tools/sample_server/index.html | 107 +++++ files/ja/mdn/tools/search/index.html | 158 +++++++ files/ja/mdn/tools/template_editing/index.html | 38 ++ files/ja/mdn/tools/zones/index.html | 203 +++++++++ 17 files changed, 1830 insertions(+) create mode 100644 files/ja/mdn/tools/add-ons_and_plug-ins/index.html create mode 100644 files/ja/mdn/tools/content_kits/index.html create mode 100644 files/ja/mdn/tools/document_parameters/index.html create mode 100644 files/ja/mdn/tools/feeds/index.html create mode 100644 files/ja/mdn/tools/index.html create mode 100644 files/ja/mdn/tools/kumascript/index.html create mode 100644 files/ja/mdn/tools/kumascript/troubleshooting/index.html create mode 100644 files/ja/mdn/tools/page_deletion/index.html create mode 100644 files/ja/mdn/tools/page_moving/index.html create mode 100644 files/ja/mdn/tools/page_regeneration/index.html create mode 100644 files/ja/mdn/tools/page_watching/index.html create mode 100644 files/ja/mdn/tools/put_api/index.html create mode 100644 files/ja/mdn/tools/revision_dashboard/index.html create mode 100644 files/ja/mdn/tools/sample_server/index.html create mode 100644 files/ja/mdn/tools/search/index.html create mode 100644 files/ja/mdn/tools/template_editing/index.html create mode 100644 files/ja/mdn/tools/zones/index.html (limited to 'files/ja/mdn/tools') diff --git a/files/ja/mdn/tools/add-ons_and_plug-ins/index.html b/files/ja/mdn/tools/add-ons_and_plug-ins/index.html new file mode 100644 index 0000000000..d89e8efbdb --- /dev/null +++ b/files/ja/mdn/tools/add-ons_and_plug-ins/index.html @@ -0,0 +1,33 @@ +--- +title: MDN に関連するアドオンとプラグイン +slug: MDN/Tools/Add-ons_and_plug-ins +tags: + - Landing + - MDN Meta + - Site-wide + - Tools +translation_of: MDN/Tools/Add-ons_and_plug-ins +--- +
{{MDNSidebar}}

MDN コミュニティのメンバーは多くの楽しく、便利なプロジェクトを立ち上げています。 MDN の利用や、内容への貢献を簡単にする、ツール、アドオン、ユーテリティを作成するものがあります。

+ +

こうした数々のプロジェクトのリンクがここにあります。これらの多くは完成まで手助けも要るため、あなたが助けるものを探しているコーダーである場合、ここに機会が見つかるかもしれません!

+ +
+
+
MDN doc tests add-on
+
MDNの編集中に表示されるサイドバーを作成する Firefox アドオンで、コンテンツのテストと妥当性チェックを提供します。これは作業途中なので、より多くのテストを歓迎します!
+
MDN automatic translation
+
{{Glossary("Regular_expression", "正規表現")}}ベースのルールを使って、自動的によくある用語を翻訳された形に置き換える。
+
MDN Search
+
URLバーで "mdn <searchterm>" とタイプすることですばやくMDN のリファレンス素材を検索することができる WebExtension。 組み込みのMDN 検索をベースにしているが、より良い結果を出すようにロジックが追加されている。JavaScript と CSS リファレンスを探すのに最適化されている。
+
MDN Interface Documentation Generator
+
この Firefox アドオンは、XPCOM インターフェイス用に、適切にフォーマットされたスケルトン生成に役立ちます。しばらく更新されてないので、バージョン互換性の情報を正しく表示しませんが、いろいろと便利です。いくつか更新されたら、またかけがえないものに戻るでしょう。
+
 
+
Save with comment hotkey addon
+
MDNエディタのリビジョンコメント欄にすぐにスクロールさせる Firefox アドオン。つまりこれによって、あなたが編集したことに対する、小さな情報を簡単に追加できます。
+
Sublime Text MDN search plug-in
+
コーディング中にドキュメントを得るのに、MDNをすぐに検索できる Sublime Text のプラグイン。
+
Lazarus
+
定期的にフォームデータをlocal storageに自動保存する Firefox 拡張機能で、すべてのデータをクラッシュやエラーから保護します。これは MDN で作業する時に便利で、なぜなら MDN エディターのコンテンツも保存し、成果を保存する前に何か失敗した場合に戻すことができるためです。
+
+
diff --git a/files/ja/mdn/tools/content_kits/index.html b/files/ja/mdn/tools/content_kits/index.html new file mode 100644 index 0000000000..b10f0bb06d --- /dev/null +++ b/files/ja/mdn/tools/content_kits/index.html @@ -0,0 +1,67 @@ +--- +title: コンテンツキット +slug: MDN/Tools/Content_kits +translation_of: Archive/MDN/Content_kits +--- +
{{MDNSidebar}}
+

MDN コンテンツキットはある題材について技術リソースを集めたもので、 地域の技術者の会合を開いたり、 イベント、会議、ワークショップなどで技術的なプレゼンテーションを行う時に役に立ちます。

+
+ +

Each MDN Content Kit offers relevant, up-to-date technical information for presenters and teachers on a particular topic related to web development or web app development, such as Web APIs, useful libraries, or developer tools. Content Kits may also be focused on Mozilla products, tools, or technologies such as Firefox Developer Tools or Mozilla Research projects. Resources may include slides, demos, code samples, screencasts, video, exercises, etc.

+ +

By providing MDN Content Kits, MDN aims to grow developer engagement with Mozilla in regional communities, and increase standards-based web development globally.

+ +

MDN コンテンツキットを作成する または 寄贈する

+ +

Kits can be built by anyone, and we encourage people to suggest and build kits! Individuals may also contribute to existing content kits by submitting a pull request on Github.  Get started with the MDN Content Kit Template on Github or read about the project on the MDN wiki.

+ +
+

Note: There is also a Content Kit Guide available, to give you more guidance in creating content kits.

+
+ +

現在のコンテンツキット

+ + + +

MDN コンテンツキットを利用する

+ +

Hints on using Content Kits before, during, and after a meetup. Note that these points are representative of a general Content Kit — not all points will necessarily apply to all kits.

+ +

会合の前に

+ +
    +
  1. Review the content kit and all supporting materials, including relevant MDN articles.
  2. +
  3. Download the demo project and play with it until you feel comfortable demoing it.
  4. +
  5. Download the video, so you can play it locally if all else fails.
  6. +
+ +

会合の中で

+ +
    +
  1. Present the topic, including a live demo (or recorded, if necessary.)
  2. +
  3. Lead the group in a discussion of the topic, or an activity with the demo project.
  4. +
+ +

会合の後で

+ +
    +
  1. Submit issues for any problems you encountered with the kit.
  2. +
  3. Submit pull requests for any changes you made to the kit.
  4. +
+ +

新しい MDN コンテンツキットを提案する

+ +

If you would like to propose a new topic for an MDN Content Kit, please add your topic to this etherpad as well as on the MDN mailing list.

+ +

If you propose a new Content Kit topic, please let us know how you will use the new MDN Content Kit and whether you will provide us feedback. We are looking for proposals for topics that will be used by groups that can provide us with feedback so that we can continue to improve and grow the collection of MDN Content Kits.

diff --git a/files/ja/mdn/tools/document_parameters/index.html b/files/ja/mdn/tools/document_parameters/index.html new file mode 100644 index 0000000000..6198f8ea7b --- /dev/null +++ b/files/ja/mdn/tools/document_parameters/index.html @@ -0,0 +1,95 @@ +--- +title: URL 引数と文書メタデータ +slug: MDN/Tools/Document_parameters +tags: + - Documentation + - Kuma + - MDN Meta + - Page-level + - Reference + - Tools +translation_of: MDN/Tools/Document_parameters +--- +
{{MDNSidebar}}
+ +
+

MDN の Kuma Wiki プラットホームには、外からアクセスする API がありません。代わりに、人間がアクセスできるリソースを機械的に扱いやすいデータに変換する手段を提供するというのが私たちのアプローチです。

+
+ +
+

URL の GET 引数

+ +

すべての Kuma wiki 文書の URL が HTTP GET で取得されたりブラウザーで見られる時に役立つクエリ引数オプションをサポートしています。

+ +

複数のクエリ引数は最初の ? の代わりに & で区切られます (マクロの例を見てください)。

+ +
+
summary
+
+

Kuma にページの概要のみを返すよう指示します。 "SEO summary" クラスでマークされたコンテンツがある場合、そのコンテンツが返されます。そのようなコンテンツがない場合、 "Summary" というタイトルのあるコンテンツが返されます。そうならない場合、最初のブロックのコンテンツが返されます。

+ +
バグのお知らせ: 現在、 summary 引数は raw 引数も指定しないと文書全体を返すというバグがあります。なお、 $json 代替ビューを使用して返される JSON から概要を取得することもできます。
+
+
raw
+
Kuma に、ヘッダーやフッターなどのスキン素材のない、ページの生コンテンツを返すよう指示します。これはエディターを手軽に構築するテンプレートやスクリプトを実行しません。
+
例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5?raw
+
macros
+
Kuma にページ内のすべてのテンプレートを実行するよう指示します。 ?raw と組み合わせると、これはサイトラッパーを除くすべてをレンダリングした MDN コンテンツを提供します。既定では ?raw なしです (つまり、通常のサイト表示です) ?raw がある時は既定でオフです。
+
例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5?raw&macros
+
nomacros
+
Kuma にページ内の KumaScript テンプレートを実行しないよう指示します。通常のサイト表示では ?macros が既定で「オン」になっていますが、このオプションはオフにします。
+
例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5?nomacros
+
include
+
Kuma に noinclude クラスを持つブロックを除くように命じます。これは単体のページではなく、他のページに含まれた場合のような出力を得るのに便利です。よくサンプルコードなどを除きます (いつもではありませんが)。
+
例: https://developer.mozilla.org/ja/docs/XUL/Attribute/align?raw&macros&include
+
section=id
+
Kuma に指定したアンカー名を持つセクションのみのコンテンツを返すように指示します。
+
例: + + +
バグのお知らせ: 現在、 section 引数は raw 引数も使用しないと文書全体を返すというバグがあります。
+
+
expand
+
+

$children ビューと連結して、サブページごとの詳細情報つきの JSON レスポンスを展開します。これは各サブページごとの $children$json の連結のように動作します。この方法は、サブページのタグについて学べます。

+ +

例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5$children?expand

+
+
+
+ +
+

文書のメタデータリソース

+ +

文書の URL のレスポンスを微調整するための引数と一緒に、 URL 接尾辞で指定される文書の代替ビューもいくつかあります。

+ +
+
$toc
+
Kuma に HTML のページの目次のみを返すよう命じます。順序付きリスト (つまり {{HTMLElement("ol")}}) として返されます。
+
例: https://developer.mozilla.org/ja/docs/MDN/Contribute/Tools/Document_parameters$toc
+
$json
+
Kuma に JSON オブジェクトでページを記述するよう命じます。このオブジェクトは基本的に、 KumaScript の処理 wiki.getPage() を使用して得られるものと同じです。
+
例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5$json
+
$children
+
Kuma にページのトピックの子を JSON で列挙するよう命じます。このオブジェクトは基本的に、 KumaScript の処理 pages.subpages() を使用して得られるものと同じです。
+
例: https://developer.mozilla.org/ja/docs/Web/Guide/HTML/HTML5$children
+
(これは ?expand 引数と共に使用して、もっと詳細のレスポンスを得ることもできます。)
+
$compare
+
必須のクエリ引数 ?from および ?toで指定されたリビジョン間のソーステキスト行の違いを表示します。
+
例: https://developer.mozilla.org/ja/docs/MDN/Contribute/Tools/Document_parameters$compare?to=911697&from=911067
+
$edit
+
指定された文書の現在のリビジョンを、表示する代わりに編集します。
+
例: https://developer.mozilla.org/ja/docs/MDN/Contribute/Tools/Document_parameters$edit
+
$history
+
指定された文書の内容を表示する代わりに、最新の10リビジョンのリビジョン履歴を表示します。履歴全体は、クエリ引数の値に ?limit=all を付けることで要求できます。
+
例: https://developer.mozilla.org/ja/docs/MDN/Contribute/Tools/Document_parameters$history?limit=all
+
$revision
+
文書の "/" の後に指定された番号のリビジョンを表示します。
+
例: https://developer.mozilla.org/ja/docs/MDN/Contribute/Tools/Document_parameters$revision/915141
+
+
diff --git a/files/ja/mdn/tools/feeds/index.html b/files/ja/mdn/tools/feeds/index.html new file mode 100644 index 0000000000..6d30d1a342 --- /dev/null +++ b/files/ja/mdn/tools/feeds/index.html @@ -0,0 +1,53 @@ +--- +title: MDN の Feeds API について +slug: MDN/Tools/Feeds +tags: + - Kuma + - MDN Meta + - Site-wide + - ツール + - リファレンス +translation_of: MDN/Tools/Feeds +--- +
{{MDNSidebar}}

MDN の wiki では、サイトの更新内容を追跡する為にフィード API が提供されています。この API はまだ作成中であるかもしれませんが、この情報は役立つかもしれません。

+ +

フィードへのアクセス

+ +

フィードは次の様な形式の ベース URL から始まります。

+ +
https://developer.mozilla.org/<locale>/docs/feeds/<format>/
+ +

ベース URL 内の各プレースホルダーはそれぞれ次の意味を持ちます。

+ + + +

json 形式を使用する場合、オプションとして the JSONP convention で JavaScript としてデータを読み込むための ?callback=<callback name> クエリパラメーターが指定可能です。

+ +

購読可能フィード

+ +
+
all
+
最近の記事の変更すべてを編集日付順で。新規に作成された記事も含む。すべての変更は各記事のフィードのエントリーに結ばれています。例えば: https://developer.mozilla.org/ja/docs/feeds/rss/all
+
revisions
+
特定の記事のリビジョンを編集日付順で。新規作成も含む。各リビジョンはフィードの別々のエントリーを持ちます。例えば: https://developer.mozilla.org/ja/docs/feeds/atom/revisions
+
tag/<tagname>
+
フィードの指定タグの付いた記事の更新情報のみを編集日付順で取得。例えば: https://developer.mozilla.org/ja/docs/feeds/json/tag/CSS?callback=loadFeed
+
files
+
最近のファイルのアップロードまたは変更。例えば: https://developer.mozilla.org/ja/docs/feeds/atom/files
+
l10n-updates
+
翻訳ページの最終更新時以降に翻訳の元となる言語の記事が変更された記事のリスト (つまり、他の言語から翻訳された記事で、元の言語の記事が変更された場合)。例えば: https://developer.mozilla.org/fr/docs/feeds/atom/l10n-updates
+
needs-review[/<reviewtype>]
+
要レビューとされた記事のリスト。technicaleditorialkumascript の何れかに絞って取得する事も可能。 + +
+
+ +

 

diff --git a/files/ja/mdn/tools/index.html b/files/ja/mdn/tools/index.html new file mode 100644 index 0000000000..19f4f4ba50 --- /dev/null +++ b/files/ja/mdn/tools/index.html @@ -0,0 +1,14 @@ +--- +title: MDN のツール +slug: MDN/Tools +tags: + - Landing + - MDN Meta + - Tools +translation_of: MDN/Tools +--- +
{{MDNSidebar}}{{IncludeSubnav("/ja/docs/MDN")}}
+ +

MDN は数々の機能を提供して、進行を追跡すること、内容を管理すること、最新の変更をサイトへ反映することを容易にしようと努めています。

+ +

{{LandingPageListSubpages}}

diff --git a/files/ja/mdn/tools/kumascript/index.html b/files/ja/mdn/tools/kumascript/index.html new file mode 100644 index 0000000000..2a2a5132d2 --- /dev/null +++ b/files/ja/mdn/tools/kumascript/index.html @@ -0,0 +1,471 @@ +--- +title: KumaScript +slug: MDN/Tools/KumaScript +tags: + - Kuma + - KumaScript + - MDN Meta + - NeedsContent + - Site-wide + - ガイド + - ツール +translation_of: MDN/Tools/KumaScript +--- +
{{MDNSidebar}}
+ +

MDN を構築している Kuma プラットフォームにおいて、 wiki 上のコンテンツを自動化するテンプレートシステムは KumaScript と呼ばれています。 KumaScript はサーバー側 JavaScript で実行されており、 Node.js を使用して実装されています。この記事は、 KumaScript の使い方について基本的な情報を提供するものです。

+ +

詳細な概要や KumaScript の Q&A については、 MDN 開発チームの KumaScript Fireside Chat を見ていてください (ミーティングはビデオで10分で開始します)。 KumaScript は、以前の MDN で使われていたプラットフォームであり、 MindTouch のためのテンプレート言語であった DekiScript を置き換えました。

+ +

KumaScript とは

+ + + +

KumaScript にはないもの

+ + + +

基本

+ +

KumaScript は MDN で埋め込み JavaScript テンプレートに利用されています。これらのテンプレートは MDN の筆者ならば誰でも文書内で、マクロを使用して呼び出すことができます。

+ +

KumaScript のスクリプトはテンプレートであり、それぞれのテンプレートは Github の KumaScript リポジトリの macros ディレクトリに格納されているファイルです。テンプレートは以下のようなものです。

+ +
<% for (var i = 0; i < $0; i++) { %>
+  Hello #<%= i %>
+<% } %>
+ +

テンプレートは wiki コンテンツのどこからでもマクロで呼び出すことができます。マクロは次のようなものです。

+ +
\{{hello(3)}}
+ +

マクロの出力は以下のようなものです。

+ +
Hello #0
+Hello #1
+Hello #2
+ +

マクロの構文

+ +

KumaScript のテンプレートは、以下のようにドキュメントのコンテンツの中でマクロとして呼び出すことができます。

+ +
\{{templateName("arg0", "arg1", ..., "argN")}}
+ +

マクロの構文は、以下の規則に基づいて構成されます。

+ + + +

マクロの引数に JSON を用いる

+ +

半実験的な機能 (動作保証なし) として、以下のように引数が一つだけの場合は、引数に JSON オブジェクトを指定できます。

+ +
\{{templateName({ "Alpha": "one", "Beta": ["a", "b", "c"], "Foo": "https:\/\/mozilla.org\/" })}}
+ +

このマクロからのデータは、テンプレートコード内で $0 引数のオブジェクトとして利用できます (例えば、 $0.Alpha, $0.Beta, $0.Foo)。これにより、引数の単純なリストで実現することが難しい又は不可能な複雑なデータ構造を、マクロ引数で表すことができます。

+ +

なお、この引数の形はとても繊細です。 — 正確に JSON の構文に従っていなければならず、間違いを犯しやすいエスケープ文字の要件が求められます (例えば、すべてのスラッシュをエスケープするなど)。疑わしい場合は、 JSON をバリデーターに掛けてみてください

+ +

「\{{」を記述する方法

+ +

"\{{" という文字の並びはマクロの開始を示すため、実際にページ内で "\{{" および "}}" を使用したい場合は問題になります。おそらく DocumentParsingError メッセージが発生するでしょう。

+ +

この場合、 \\{ のように最初の中括弧をバックスラッシュでエスケープすることができます。

+ +

テンプレートの構文

+ +

それぞれの KumaScript テンプレートは、 KumaScript の macros ディレクトリに格納されているファイルです。これらのファイルは GitHub 上の何らかのオープンソースプロジェクトのファイルとして作成したり編集したりします (詳しくは the KumaScript README をご覧ください)。

+ +

KumaScript テンプレートは、いくつかの簡単な規則で、組込み JavaScript テンプレートエンジンによって処理されます。

+ + + +

Tips

+ +

マクロのリストと、マクロが MDN でどの様に使用されているかマクロダッシュボードで確認することができます。

+ +

より高度な機能

+ +

KumaScript には前章までに紹介したもの以外に、より高度な機能もあります。

+ +

環境変数

+ +

When the wiki makes a call to the KumaScript service, it passes along some context on the current document that KumaScript makes available to templates as variables:

+ +
+
env.path
+
現在の wiki 文書へのパス
+
env.url
+
現在の wiki 文書への 絶対 URL
+
env.id
+
現在の wiki 文書のユニーク ID
+
env.files
+
An array of the files attached to the current wiki document; each object in the array is as described under {{ anch("File objects") }} below
+
env.review_tags
+
記事のレビュータグ配列 ("technical"、 "editorial"など。)
+
env.locale
+
現在の wiki 文書のロケール
+
env.title
+
現在の wiki 文書のタイトル
+
env.slug
+
現在の wiki 文書の URL スラッグ
+
env.tags
+
現在の wiki 文書に付与されたタグの名称のリスト
+
env.modified
+
現在の wiki 文書の最終更新日を示すタイムスタンプ
+
env.cache_control
+
Cache-Control header sent in the request for the current wiki document, useful in deciding whether to invalidate caches
+
+ +

File オブジェクト

+ +

個々の file オブジェクトは以下の様なフィールドを持ちます。

+ +
+
title
+
添付ファイルのタイトル
+
description
+
現行版の添付ファイルに関する説明
+
filename
+
添付ファイルのファイル名
+
size
+
添付ファイルのサイズ(※単位 = bytes )
+
author
+
添付ファイルをアップロードした人のユーザ名
+
mime
+
添付ファイルの MIME type
+
url
+
添付ファイルの URL
+
+ +

タグリストでの作業

+ +

The env.tags and env.review_tags variables return arrays of tags. You can work with these in many ways, of course, but here are a couple of suggestions.

+ +
Looking to see if a specific tag is set
+ +

You can look to see if a specific tag exists on a page like this:

+ +
if (env.tags.indexOf("tag") != −1) {
+  // The page has the tag "tag"
+}
+
+ +
Iterating over all the tags on a page
+ +

You can also iterate over all the tags on a page, like this:

+ +
env.tag.forEach(function(tag) {
+  // do whatever you need to do, such as:
+  if (tag.indexOf("a") == 0) {
+    // this tag starts with "a" - woohoo!
+  }
+});
+ +

API とモジュール

+ +

KumaScript offers some built-in methods and APIs for KumaScript macros. Macros can also use module.exports to export new API methods.

+ +

KumaScript では、ビルトインのユーティリティ API だけでなく、wiki 文書として編集可能なモジュール内で新規の API を定義する機能も提供されています。

+ +

ビルトインメソッド

+ +

This manually-maintained documentation is likely to fall out of date with the code. With that in mind, you can always check out the latest state of built-in APIs in the KumaScript source. But here is a selection of useful methods exposed to templates:

+ +
+
md5(string)
+
与えられた文字列の MD5 16 進ダイジェストを返す
+
template("name", ["arg0", "arg1", ..., "argN"])
+
+

Executes and returns the result of the named template with the given list of parameters.

+ +

Example: <%- template("warning", ["foo", "bar", "baz"]) %>.

+ +

Example using the DOMxRef macro: <%- template("DOMxRef", ["Event.bubbles", "bubbles"]) %>.

+ +

This is a JavaScript function. So, if one of the parameters is an arg variable like $2, do not put it in quotes. Like this: <%- template("warning", [$1, $2, "baz"]) %>. If you need to call another template from within a block of code, do not use <% ... %>. Example: myvar = "<li>" + template("LXRSearch", ["ident", "i", $1]) + "</li>";

+
+
require(name)
+
Loads another template as a module; any output is ignored. Anything assigned to module.exports in the template is returned.
+
Used in templates like so: <% const my_module = require('MyModule'); %>.
+
cacheFn(key, timeout, function_to_cache)
+
Using the given key and cache entry lifetime, cache the results of the given function. Honors the value of env.cache_control to invalidate cache on no-cache, which can be sent by a logged-in user hitting shift-refresh.
+
request
+
Access to mikeal/request, a library for making HTTP requests. Using this module in KumaScript templates is not yet very friendly, so you may want to wrap usage in module APIs that simplify things.
+
log.debug(string)
+
Outputs a debug message into the script log on the page (i.e. the big red box that usually displays errors).
+
+ +

組込み API モジュール

+ +

There are a set of built in API that are automatically loaded and made available to every template by the environment script.

+ +

For the most part, these attempt to provide stand-ins for legacy DekiScript features to ease template migration. But, going forward, these can be used to share common variables and methods between templates:

+ + + +

You can see the most up to date list of methods under kuma from the KumaScript source code, but here are a few:

+ +
+
kuma.inspect(object)
+
Renders any JS object as a string, handy for use with log.debug(). See also: node.js util.inspect().
+
kuma.htmlEscape(string)
+
Escapes the characters &, <, >, " to &amp, &lt;, &gt;, &quot;, respectively.
+
kuma.url
+
See also: node.js url module.
+
kuma.fetchFeed(url)
+
Fetch an RSS feed and parse it into a JS object. See also: InsertFeedLinkList
+
+ +

モジュールの作成

+ +

Using the built-in require() method, you can load a template as a module to share common variables and methods between templates. A module can be defined in a template like this:

+ +
<%
+module.exports = {
+    add: function (a, b) {
+        return a + b;
+    }
+}
+%>
+ +

Assuming this template is saved under https://github.com/mdn/kumascript/tree/master/macros as MathLib.ejs, you can use it in another template like so:

+ +
<%
+var math_lib = require("MathLib");
+%>
+The result of 2 + 2 = <%= math_lib.add(2, 2) %>
+ +

このテンプレートの出力は以下の様になるでしょう。

+ +
The result of 2 + 2 = 4
+ +

Tips and caveats

+ +

デバッグ

+ +

A useful tip when debugging. You can use the log.debug() method to output text to the scripting messages area at the top of the page that's running your template. Note that you need to be really sure to remove these when you're done debugging, as they're visible to all users! To use it, just do something like this:

+ +
<%- log.debug("Some text goes here"); %>
+ +

You can, of course, create more complex output using script code if it's helpful.

+ +

キャッシュ

+ +

KumaScript templates are heavily cached to improve performance. For the most part, this works great to serve up content that doesn't change very often. But, as a logged-in user, you have two options to force a page to be regenerated, in case you notice issues with scripting:

+ + + +

検索キーワードを使用してテンプレートページを開く

+ +

When using templates, it's common to open the template's code in a browser window to review the comments at the top, which are used to document the template, its parameters, and how to use it properly. To quickly access templates, you can create a Firefox search keyword, which gives you a shortcut you can type in the URL box to get to a template more easily.

+ +

To create a search keyword, open the bookmarks window by choosing "Show all bookmarks" in the Bookmarks menu, or by pressing Control+Shift+B (Command+Shift+B on Mac). Then from the utility ("Gear") menu in the Library window that appears, choose "New Bookmark...".

+ +

This causes the bookmark editing dialog to appear. Fill that out as follows:

+ +
+
Name
+
A suitable name for your search keyword; "Open MDN Template" is a good one.
+
Location
+
https://github.com/mdn/kumascript/blob/master/macros/%s
+
Tags{{Optional_Inline}}
+
A list of tags used to organize your bookmarks; these are entirely optional and what (if any) tags you use is up to you.
+
Keyword
+
The shortcut text you wish to use to access the template. Ideally, this should be something short and quick to type, such as simply "t" or "mdnt".
+
Description{{Optional_Inline}}
+
A suitable description explaining what the search keyword does.
+
+ +

The resulting dialog looks something like this:

+ +

+ +

Then click the "Add" button to save your new search keyword. From then on, typing your keyword, then a space, then the name of a macro will open that macro in your current tab. So if you used "t" as the keyword, typing t ListSubpages will show you the page at {{TemplateLink("ListSubpages")}}.

+ +

クックブック

+ +

This section will list examples of common patterns for templates used on MDN, including samples of legacy DekiScript templates and their new KumaScript equivalents.

+ +

Force templates used on a page to be reloaded

+ +

It bears repeating: To force templates used on a page to be reloaded after editing, hit Shift-Reload. Just using Reload by itself will cause the page contents to be regenerated, but using cached templates and included content. A Shift-Reload is necessary to invalidate caches beyond just the content of the page itself.

+ +

「不明なエラー」からの回復

+ +

ページ読込時に、時折、このようなスクリプティング・メッセージが表示される事があります。

+ +
Kumascript service failed unexpectedly: <class 'httplib.BadStatusLine'>
+ +

これはおそらく、 KumaScript サービスの一時的な障害です。ページの再読込みでこの問題が解決する事があります。これで問題が解決しない場合はスーパーリロード(shift + F5)を試してみて下さい。これらの試みの後もエラーが解消されない場合は、file an IT bug for Mozilla Developer Network to ask for an investigation.

+ +

Broken wiki.languages() マクロ

+ +

幾つかのページで、以下の様なスクリプトエラーメッセージを見かける場合があるでしょう。

+ +
Syntax error at line 436, column 461: Expected valid JSON object as the parameter of the preceding macro but...
+ +

その様なページを編集状態にした場合、ページ下部に以下の様なマクロが見つかるかもしれません。

+ +
\{{ wiki.languages({ "zh-tw": "zh_tw/Core_JavaScript_1.5_教學/JavaScript_概要", ... }) }}
+ +

To fix the problem, just delete the macro. Or, replace the curly braces on either side with HTML comments <!-- --> to preserve the information, like so:

+ +
<!-- wiki.languages({ "zh-tw": "zh_tw/Core_JavaScript_1.5_教學/JavaScript_概要", ... }) -->
+ +

Because Kuma supports localization differently, these macros aren't actually needed any more. But, they've been left intact in case we need to revisit the relationships between localized pages. Unfortunately, it seems like migration has failed to convert some of them properly.

+ +

ページの言語の取得

+ +

In KumaScript, the locale of the current document is exposed as an environment variable:

+ +
const lang = env.locale;
+ +

The env.locale variable should be reliable and defined for every document.

+ +

Reading the contents of a page attachment

+ +

You can read the contents of an attached file by using the mdn.getFileContent() function, like this:

+ +
<%
+  let contents = mdn.getFileContent(fileUrl);
+  // ... do stuff with the contents ...
+%>
+
+ +

or

+ +
<%- mdn.getFileContent(fileObject); %>
+
+ +

In other words, you may specify either the URL of the file to read or as a file object. The file objects for a page can be accessed through the array env.files. So, for example, to embed the contents of the first file attached to the article, you can do this:

+ +
<%- mdn.getFileContent(env.files[0]); %>
+
+ +
+

Note: You probably don't want to try to embed the contents of a non-text file this way, as the raw contents would be injected as text. This is meant to let you access the contents of text attachments.

+
+ +

If the file isn't found, an empty string is returned. There is currently no way to tell the difference between an empty file and a nonexistent one. But if you're putting empty files on the wiki, you're doing it wrong.

+ +

テンプレートのローカライズ

+ +

Templates are not translated like wiki pages, rather any single template might be used for any number of locales.

+ +

So the main way to output content tailored to the current document locale is to pivot on the value of env.locale. There are many ways to do this, but a few patterns are common in the conversion of legacy DekiScript templates:

+ +

If/else ブロックを用いる例

+ +

The KumaScript equivalent of this can be achieved with simple if/else blocks, like so:

+ +
<% if ("fr" == env.locale) { %>
+<%- template("CSSRef") %> « <a href="/fr/docs/Référence_CSS/Extensions_Mozilla">Référence CSS: Extensions Mozilla</a>
+<% } else if ("ja" == env.locale) { %>
+<%- template("CSSRef") %> « <a href="/ja/docs/CSS_Reference/Mozilla_Extensions">CSS リファレンス: Mozilla 拡張仕様</a>
+<% } else if ("pl" == env.locale) { %>
+<%- template("CSSRef") %> « <a href="/pl/docs/Dokumentacja_CSS/Rozszerzenia_Mozilli">Dokumentacja CSS: Rozszerzenia Mozilli</a>
+<% } else if ("de" == env.locale) { %>
+<%- template("CSSRef") %> « <a href="/de/docs/CSS_Referenz/Mozilla_CSS_Erweiterungen">CSS Referenz: Mozilla Erweiterungen</a>
+<% } else { %>
+<%- template("CSSRef") %> « <a href="/en-US/docs/CSS_Reference/Mozilla_Extensions">CSS Reference: Mozilla Extensions</a>
+<% } %>
+ +

Depending on what text editor is your favorite, you may be able to copy & paste from the browser-based editor and attack this pattern with a series of search/replace regexes to get you most of the way there.

+ +

My favorite editor is MacVim, and a series of regexes like this does the bulk of the work with just a little manual clean up following:

+ +
%s#<span#^M<span#g
+%s#<span lang="\(.*\)" .*>#<% } else if ("\1" == env.locale) { %>#g
+%s#<span class="script">template.CSSxRef(#<%- template("CSSxRef", [#
+%s#)</span> </span>#]) %>
+
+ +

Your mileage may vary, and patterns change slightly from template to template. That's why the migration script was unable to just handle this automatically, after all.

+ +

文字列値と switch

+ +

Rather than switch between full chunks of markup, you can define a set of strings, switch them based on locale, and then use them to fill in placeholders in a single chunk of markup:

+ +
<%
+var s_title = 'Firefox for Developers';
+switch (env.locale) {
+    case 'de':
+        s_title = "Firefox für Entwickler";
+        break;
+    case 'fr':
+        s_title = "Firefox pour les développeurs";
+        break;
+    case 'es':
+        s_title = "Firefox para desarrolladores";
+        break;
+};
+%>
+<span class="title"><%= s_title %></span>
+ +

Use mdn.localString()

+ +

A recent addition to the MDN:Common module is mdn.localString(), used like this:

+ +
<%
+var s_title = mdn.localString({
+  "en-US": "Firefox for Developers",
+  "de": "Firefox für Entwickler",
+  "es": "Firefox para desarrolladores"
+});
+%>
+<span class="title"><%= s_title %></span>
+ +

これは switch 文による分岐よりも簡潔であり、テンプレート内で一種類や二種類程度の文字列のみの翻訳が必要なケースなどでは、switch 文より良い選択となるかもしれません。ロケールにより多くの文字列を切り替える必要がある場合(※例: Template:CSSRef | MDN)は、switch 文 を用いた方が良いでしょう。 if 文を用いた場合が良い場合もあります。適切なものを選択して御利用下さい。

+ +

オブジェクトに適切なロケールが無い場合、 "en-US" の値が初期値として使用されます。

+ +

関連情報

+ + diff --git a/files/ja/mdn/tools/kumascript/troubleshooting/index.html b/files/ja/mdn/tools/kumascript/troubleshooting/index.html new file mode 100644 index 0000000000..c7c6a3a8a3 --- /dev/null +++ b/files/ja/mdn/tools/kumascript/troubleshooting/index.html @@ -0,0 +1,65 @@ +--- +title: KumaScript エラーのトラブルシューティング +slug: MDN/Tools/KumaScript/Troubleshooting +tags: + - KumaScript + - MDN Meta + - Tools + - エラー + - ガイド +translation_of: MDN/Tools/KumaScript/Troubleshooting +--- +
{{MDNSidebar}}
+ +
+

ページに出てくる KumaScript エラーは読み手にとって不快なもので、大きく赤い恐ろしげなボックスですが、幸運なことに MDN アカウントを持つユーザーは誰でも、ドキュメントを直してこうしたエラーを修正できます。ページがエラーを起こしたとき、エラーのあるドキュメントリストに追加されます。サイト編集者は通常このリストを検査して、エラーを発見、修正します。この記事では4種類の KumaScript エラーと、修正するための対策について詳しく見ます。

+
+ +

DocumentParsingError

+ +

DocumentParsingError のエラーは KumaScript がドキュメント自体を理解できないときに表示されます。最もよくある原因は macro 内の文法エラーです。

+ +

以下をチェックします:

+ +
+
マクロ呼出しのつもりではない場合に中括弧を使った。
+
If you need to write  \{ in a document without calling a macro you can escape it with a \ like this: \\{
+
マクロパラメーターに特殊な文字を使った。
+
If you need to use a " or a \  inside of a macro parameter they can be escaped with a \ like this: \\ or \"
+
マクロパラメーター間にカンマがない。
+
Macro parameters need to be delimited by a comma (,) but not at the end of the list of parameters; for example \{\{anch("top", "Back to top")}}.
+
マクロ呼び出し内に HTML タグがある
+
If you apply styling to a macro, it will often break because, for example, a </code> tag may have appeared inside the macro code in the source code. Check the source view to see what's there, and remove any unnecessary styling.
+
+ + + +

TemplateLoadingError

+ +

TemplateLoadingError のエラーは KumaScript がページにどの macro を取り込むか探せないときに表示されます。

+ +

以下をチェックします:

+ +
+
マクロ名を誤ったり、マクロがリネームされた。
+
GitHub repo で既知のマクロのリストを確認できます。
+
+ +
+

Tip: You can make it quick and easy to jump to a specific macro by adding a search keyword to Firefox. See {{SectionOnPage("/en-US/docs/MDN/Contribute/Tools/KumaScript", "Using search keywords to open template pages")}} for a step-by-step guide to creating the search keyword for this.

+
+ +

TemplateExecutionError

+ +

TemplateExecutionError のエラーは KumaScript が macro 内のエラーに遭遇したときに表示されます。このエラーは管理者のみが修正できて、バグとして報告が必要となります。

+ +

エラーを報告する前に、これが修正済みでないことを確認します。KumaScript を強制的にページのフレッシュコピーを読み込ませることでできます。これには Shift  を押しっぱなしでページ再読み込みします (Windows/Linux では Shift + Ctrl + R 、Mac では Shift + Cmd + R )。

+ +

エラーが続く場合、ページの URL とエラーのテキストをつけてbug 報告します

+ +

Error & Unknown

+ +

これは、エラーがこれ以外の種類にない場合のカテゴリーです。

+ +

修正をチェックして、TemplateExecutionError に記述されるようなしつこいバグとして報告します。

diff --git a/files/ja/mdn/tools/page_deletion/index.html b/files/ja/mdn/tools/page_deletion/index.html new file mode 100644 index 0000000000..e6ebdd1910 --- /dev/null +++ b/files/ja/mdn/tools/page_deletion/index.html @@ -0,0 +1,61 @@ +--- +title: ページの削除 +slug: MDN/Tools/Page_deletion +tags: + - Guide + - MDN + - MDN Project + - Page-level +translation_of: MDN/Tools/Page_deletion +--- +
{{MDNSidebar}}
+ +

MDN からページを完全に削除することは滅多にありません。もっともよくある理由は、ページがスパムによって作成された、または間違って作成された場合です。かつては有用であったページが時代遅れの技術の記述となった場合には、削除するのではなく MDN の /Archive セクションに移動することでアーカイブされます。

+ +

ページの削除の申請

+ +

MDN の管理者だけがページを削除することができます。管理者以外のユーザーは、ページの削除をリクエストすることができます。

+ +

ページを削除するには次のようにしてください。

+ +
    +
  1. ページコンテンツの削除や変更はしないでください。ページ削除時にはその時点のコンテンツを記録しておきます。
  2. +
  3. ページに "Junk" タグを追加してください。他のタグは削除しないでください。
  4. +
  5. ページの削除に緊急を要する場合 (例えばコンテンツが不適切、攻撃的、あるいは技術的に危険なものである場合など) は、 MDN 管理者にお知らせください
  6. +
+ +

管理者は削除が適切かどうか判断した上で、随時ページを削除していきます。

+ +

ページを削除するには

+ +

ページを削除すると決めた管理者は、以下のようにしてください。

+ +
    +
  1. 削除したいページの右上隅付近にある詳細メニューを開いてください。
  2. +
  3. このページを削除をクリックしてください。「ページの削除」画面が次のように現れます。
    +
    + 削除しようと選択したページのタイトルと、関連する一部のメタデータが表示されます。
  4. +
  5. 理由欄に "Spam" や "Junk" や "Created by mistake" など、適切な理由を入力してください。
  6. +
  7. 削除ボタンをクリックしてください。「文書が削除されました」画面が表示され、このページへのリンクがあれば表示されます。 (権限のないユーザーには、この文書を復元ボタンが表示されません。)
  8. +
+ +

アクセス制限

+ +

ページ削除ツールには文書の構造を破壊する可能性が存在するため、アクセスには上位の権限を必要とします。

+ +

この権限を持つロール

+ + + +

この権限を得るための条件

+ +

このツールにアクセスする権限を得るための条件は以下のとおりです。

+ + + +

この権限を取得する手続については、上位権限の申請を参照してください。

diff --git a/files/ja/mdn/tools/page_moving/index.html b/files/ja/mdn/tools/page_moving/index.html new file mode 100644 index 0000000000..920c6f299c --- /dev/null +++ b/files/ja/mdn/tools/page_moving/index.html @@ -0,0 +1,57 @@ +--- +title: ページの移動 +slug: MDN/Tools/Page_moving +tags: + - Guide + - MDN Meta + - Page-level + - Tools +translation_of: MDN/Tools/Page_moving +--- +
{{MDNSidebar}}
+ +

なぜページ (またはページのツリー) を移動するのでしょう。サイトの階層の適切な場所ではなく、サイトの最上位に作成してしまったのかもしれません。あるいは既存の文書を整頓しているのかもしれませんね。古い内容をアーカイブする必要があるのかもしれません。このような理由で MDN はページを移動する機能を持っており、1つのページを移動するだけではなく、その下位のページをまとめて移動することもできます。

+ +

ページ移動ツールにより、編集者は MDN ツリー内の文書およびそのすべてのサブページの URL またはスラッグを変更することができます。ページを整頓したり、間違った位置にあるページを修正したりするときに、とても手軽で強力なツールです。

+ +
+

メモ: 特別な権限を持つユーザーだけが MDN でページを移動することができます。この記事を移動という選択肢が詳細 メニューに表示されない場合、使用するのに権限が必要です。この権限を得る方法については、下にあるアクセス制限 を見てください。

+
+ +

ページを移動するには

+ +

ページまたはページのツリーを移動するには、以下のようにします。

+ +
    +
  1. MDN で移動したいページの右上の角にある詳細 メニューを開いてください。
    +
  2. +
  3. この記事を移動 をクリックしてください。下のような「ページの移動」画面が表示されます。
    +
    + 一番上には、すべて (アルファベットが) 大文字で、移動しようとしているページのタイトルが表示され、続いてページを移動するためのフォームを正しく記入する方法についての注意書きの一覧が表示されます。ページタイトルは編集可能となっていますが、ここで変更しても反映されません。この問題の状態については、 {{bug(828533)}} を参照してください。
  4. +
  5. 新しい URL スラグの隣の枠に、ページの移動先としたいスラグを入力してください。この行の上にあるのは URL のプレビューで、ここに、新しい URL スラグの値を反映した、ページ移動後のフルパスの URL が表示されます。
  6. +
  7. この移動操作によって影響を受ける全てのサブページの一覧が表示されます。N ページを移動ボタンとキャンセルボタンの下にあります。サブページがなければ、その旨が表示されます。この一覧は、ページの移動が予測しなかった副作用を与えるのか判断するのに役立つかもしれません。閲覧の多いコンテンツの移動や、一度に大量のページを移動するのには注意を払ってください。
  8. +
  9. すべてが望み通り設定されていると分かったら、 N ページを移動するボタンをクリックします。非同期のバックグラウンドプロセスが始まり、各ページを移動してかつ元のページにリダイレクトを設置します。ですので、古い URL もリダイレクトによって動作し続けます。移動のプロセスが完了したらメールが届きます。そのメールには、ページの新しい場所にクリックして移動できるリンクが含まれています。
  10. +
+ +

アクセス制限

+ +

内容をおかしな場所に移動することで害となる明らかな可能性が存在するため、このツールは誰もが使えるようにはなっていません。

+ +

この権限を持つロール

+ + + +

この権限を得るための条件

+ +

このツールにアクセスする権限を得るための条件は以下のとおりです。

+ + + +

この権限を取得する手続については、上位権限の申請を参照してください。

diff --git a/files/ja/mdn/tools/page_regeneration/index.html b/files/ja/mdn/tools/page_regeneration/index.html new file mode 100644 index 0000000000..590eda0260 --- /dev/null +++ b/files/ja/mdn/tools/page_regeneration/index.html @@ -0,0 +1,34 @@ +--- +title: MDN 上のページのレンダリング +slug: MDN/Tools/Page_regeneration +tags: + - Guide + - MDN Meta + - Page-level + - Tools +translation_of: MDN/Tools/Page_regeneration +--- +
{{MDNSidebar}}
+ +

MDN サイトは性能上の理由でページをキャッシュしています。 この結果、ページに対する保存済みの変更が、次回リロード時に反映されない場合があります。常にではないがしばしば、ページがの更新が処理中であることを示すバナーが表示されます。ブラウザーで強制リフレッシュしてサーバーからページをリロードできますが、サーバー上の更新が完了しないと効果がないことがあります。

+ +

いくつかのページ (特に Landing ページ【訳注: 階層下のページの一覧を列挙するページ】) では、マクロを使って自動的に内容の生成と更新を行っています。Landing ページのためにこれを行うことで、作者が手動で更新しなくても、新しい記事が自動的にページに載ることが保証されます。これは長期間の貢献者には便利であり、新参者にはサイトの階層のどこにリンクすべきか分からずに成果を見失うことを避けるのに役立ちます。

+ +

またあるページを別のページにトランスクルージョンする(例えば {{TemplateLink("Page")}} マクロを使って)のにも使います。

+ +

MDN は性能上の理由でレンダリングしたコンテンツをキャッシュしているため、元の素材(たとえばマクロの出力や引用されるページ)に加わった変更は自動的にはページに反映されません。そのような元の素材に頻繁に変更が加わることがわかっているならば、ページの自動生成を有効にすることを検討したくなるかもしれません。

+ +

自動生成を有効にするには: 【訳注: この機能は現在、英語版のページでのみ設定できます】

+ +
    +
  1. EDIT ボタンをクリックし、編集モードに入ります。
  2. +
  3. ページタイトルの下にある  Edit page title and properties をクリックします。ページのメタデータフィールドが現れます。
  4. +
  5. Rendering max age に値を設定します。この値が、キャッシュされたページが(マクロの再実行も含めて)再生成されるスケジュールを決定します。普通は 4 または 8 Hours を指定します。 文書が頻繁に変更される技術に関しては、より少ない数値を指定しても良いでしょう。
  6. +
  7. 変更を保存します。リビジョンコメントに、設定内容を記録しておくのは良い習慣です。例: "Rendering max age を 4 Hours に設定"
  8. +
+ +

ページは指定したスケジュールに従って再生成されます。

+ +
+

注: "Edit page title and properties" オプションは、文書の作成時には現れませんので、一度保存してから開き直す必要があります。

+
diff --git a/files/ja/mdn/tools/page_watching/index.html b/files/ja/mdn/tools/page_watching/index.html new file mode 100644 index 0000000000..fe7b3a7f45 --- /dev/null +++ b/files/ja/mdn/tools/page_watching/index.html @@ -0,0 +1,49 @@ +--- +title: ページやページ群を監視・購読する +slug: MDN/Tools/Page_watching +tags: + - Guide + - MDN Meta + - Page-level + - Tools +translation_of: MDN/Tools/Page_watching +--- +
{{MDNSidebar}}
+ +

MDN ページを購読することで、そのページが更新・変更された時はいつでもメールで通知を受け取ることができます。すべての MDN ページの右上の隅に、監視ボタンがあります。購読のオプションにアクセスするには、監視ボタンの上にポインターを動かして監視メニューを開くいてください。

+ +

MDN の監視メニューのスクリーンショット

+ +

そのページだけを購読するか、サブページも一緒に購読するかをオプションで選択してください。

+ +

ページを購読する

+ +

ユーザーがそのページを編集するたびにメール通知を受け取るには、ページの上部にある詳細メニューの最初のオプション「この記事を購読」をクリックします。

+ +

ページとすべてのサブページを購読する

+ +

2つ目のオプション「この記事と全サブ記事を購読」をクリックすると、ユーザーがそのページとすべてのサブページを編集するたびにメール通知を受け取るようになります。これは購読を要求した後に追加されたサブページも含むため、将来多くのサブページが作られた場合、その通知も同様に受け取ります。

+ +

ページの購読解除

+ +

購読を解除してページの監視をやめる場合は、再び監視メニューを開いて「この記事の購読を中止」をクリックしてください。ページを購読していると「この記事の購読を中止」とだけ表示されています。ページが変更されるたびにメール通知を受けることはなくなります。

+ +

ページ変更のメール

+ +

ページを購読すると、ページが保存されるたびにメールを受け取ります。このメールは notifications@developer.mozilla.org から MDN アカウントに登録されたメールアドレスに送信されます。各メッセージにはこの形のタイトルがあります:

+ +
[MDN] ページ "ページタイトル" が ユーザー名 によって変更されました
+ +

メッセージはタイトル情報の繰り返しで始まり、つぎにコンテンツの標準差分を表示して、正確に何が変更されたかを示します。変更は HTML ソースコードで表示され、 MDN のコンテンツに慣れていない場合少し読みにくいかもしれません。

+ +

差分の下には、変更に対応するのに役立つ、次のようなリンクの一覧があります:

+ + + +

メールの最後には、"HTML element reference とその全サブ記事に対する編集の購読を開始しました" といった、どんな購読でメールが生成されたかの通知や、購読をやめるためのリンクがあります。購読をやめるリンクをクリックすると、その監視リクエストのメッセージを受け取らなくなります。

diff --git a/files/ja/mdn/tools/put_api/index.html b/files/ja/mdn/tools/put_api/index.html new file mode 100644 index 0000000000..6e05522016 --- /dev/null +++ b/files/ja/mdn/tools/put_api/index.html @@ -0,0 +1,208 @@ +--- +title: PUT API +slug: MDN/Tools/PUT_API +tags: + - Advanced + - Automation + - Documentation + - Draft + - Guide + - MDN Meta + - PUT API + - Page-level + - Tools +translation_of: MDN/Tools/PUT_API +--- +
{{MDNSidebar}}
+ +
 {{draft}}
+ +

MDN Wiki はページの全体、または一部の更新のための実験的な HTTP PUT API を提供しています。この機能は、次のような時に便利です:

+ + + +

アプリケーションをテストする

+ +

MDN を実行するソフトウェアを開発する中で、次のようにいろいろなステージ上のサイトインスタンスをホストしています:

+ + + +

プロダクションサイトを無駄にしないようにするには、まずステージングに対してアプリケーションを開発する必要があります。それから、あなたが望むことを合理的に実行することができたら、それをプロダクションに反映するように再構成します。また、開発に取り組むこともできますが、問題が発生する可能性があります。

+ +

API キーを作成する

+ +

APIキーを使うと、毎回 Persona ログインするような介入を要求せずに、アプリケーションを代理人として動作させることができます。SSL 上の HTTP ベーシック認証を使ってユーザー名とパスワードを提供します。基本的な使用のトラッキングを集めて、どのように使われているかがわかるようにします。そして、たまたま持つべきでない人々に渡った場合は、アクセスを無効にするよう API キーを削除できます。

+ +

If you have the correct privileges to do so, to create an API key, sign into MDN and visit the API keys management page. This page lets you create and delete API keys, as well as inspect recent usage history.  Only Mozillians in good standing can currently get API keys, since they grant abilities to automate changes to content rapidly, so unprivileged users must request the ability by filing a bug.

+ +

{{NoteStart}}The above link goes to the Production site, and the same keys do not work between Production and Staging. You can also get to this page by visiting your profile on the respective site: Click on your username in the upper right of the site. On your profile page, you should see a "Manage API Keys" button.{{NoteEnd}}

+ +

From there, clicking on the "Create a new API key" button should take you to an entry form so you can submit a request for an API key.

+ +

After filling out and submitting the form, you will receive a key ID and secret. These are your username and password, respectively. Copy these down somewhere safe (eg. to your application's configuration settings); the site will never display them again, and there is no recovery method. If you lose them, simply delete the API key and create another.

+ +

PUT リクエストを作成する

+ +

Since the PUT API works by way of HTTP, it should be compatible with the application environment and libraries of your choice. This first example uses the command-line tool cURL and a UNIX shell to demonstrate how to issue a simple PUT request to MDN.

+ +

リクエスト

+ +
# Base URL and API key from staging (example only; substitute your own)
+MDN_BASE_URL="https://developer.allizom.org"
+MDN_KEY_ID="frsNFFR3w0yEALRE9IA9oN1KwoDno8vVGrzsBNvCofI"
+MDN_SECRET="423PdCvnvraH0FkCDTKnizTmKGNkEdgQTi6RlEFTiWs"
+
+# Document-specific details
+DOC_USERNAME="lmorchard"  # Change this to your name
+DOC_PATH=/ja//docs/User:$DOC_USERNAME/PutExample"
+DOC_TYPE="text/html"
+DOC_DATA="<b>HELLO WORLD</b>"
+
+# Putting it all together...
+curl -si -X PUT -H"Content-Type: $DOC_TYPE" -d"$DOC_DATA" -u"$MDN_KEY_ID:$MDN_SECRET" "$MDN_BASE_URL$DOC_PATH"
+ +

Since there's a lot going on in this cURL invocation, the example is broken into variables:

+ + + +

So, along with the variables, here are some general notes on the example and its use of the PUT API:

+ + + +

レスポンス

+ +

There are several responses you may see if you try this example: 403, 404, 201, or 205. (You may see others, but those suggest something has gone wrong with the site. That will, hopefully, be rare.)

+ +

403 Forbidden

+ +

If either the key ID or secret are incorrect, you'll see a 403 Forbidden response. Double check your key details and that you're using the right pair for the right server. Create a new API key, if necessary.

+ +

404 Not Found

+ +

If you've never created a document at the URL path /en-US/docs/User:$MDN_USERNAME, you'll see a 404 Not Found response.

+ +

{{NoteStart}}The PUT API will not automatically create parent documents. If you're creating a number of documents intended to comprise a subsection of MDN, make sure to create parent documents first from the top down in the hierarchy.{{NoteEnd}}

+ +

201 Created

+ +

If the parent document exists, but the path itself doesn't, you should see a 201 Created response. This signifies that a new document was created, as opposed to an existing one having been updated.

+ +

205 Reset Content

+ +

In the case of an updated document, you'll see a 205 Reset Content response. This means that the document content has been updated, and that you should reload the document if you happen to need to see the results.

+ +

{{NoteStart}}MDN performs certain filtering and processing steps on content, so what you put in may not be exactly what gets served back.{{NoteEnd}}

+ +

サポートされるコンテンツのタイプ

+ +

The PUT API accepts one of several content types in the request body.

+ +

text/html

+ +

There are actually two forms of text/html accepted: fragment and document.

+ +

Fragment

+ +

An HTML fragment is just an arbitrary chunk of markup, and is used as-is to revise document content. This is the simplest way to update documents.

+ +

Document

+ +

However, if the request body consists of an <html> element containing <head> and <body> elements, it's treated as a full HTML document. In this case, the following processing happens:

+ + + +

This is a more complex way to update documents, but is intended as a convenience to accomodate submission of existing HTML pages.

+ +

application/json

+ +

Although the text/html content type is handy, there are more fields belonging to documents that are useful to manage. These include the following:

+ + + +

These fields can be supplied as string values in a JSON-encoded object with the application/json content-type in a PUT request.

+ +
# Auth Stuff
+DOC_USERNAME="lmorchard"  # Change this to your name
+MDN_KEY_ID="frsNFFR3w0yEALRE9IA9oN1KwoDno8vVGrzsBNvCofI"
+MDN_SECRET="423PdCvnvraH0FkCDTKnizTmKGNkEdgQTi6RlEFTiWs"
+
+# Base Settings (for Staging Env)
+MDN_BASE_URL="https://developer.allizom.org"
+DOC_PATH=/ja//docs/User:$DOC_USERNAME/PutExample"
+DOC_TYPE="application/json"
+
+# Doc Content
+echo '{"content": "<b>Hello World</b>", "title": "New Sample Title", "show_toc": 1, "tags": "Beginner, Tutorial", "review_tags": "editorial, technical", "summary": "Sample JSON update from the API"}' > /tmp/mdn.json
+
+# Submitting Content
+curl -X PUT -H "Content-Type: $DOC_TYPE" -d @/tmp/mdn.json -u"$MDN_KEY_ID:$MDN_SECRET" "$MDN_BASE_URL$DOC_PATH"
+
+ +

multipart/form-data

+ +

This content type is handled basically like application/json - the same fields are accepted. But, it might be less useful than JSON and is supported mainly for testing purposes.

+ +

1 つのセクションを更新する

+ +

Normally, an HTTP PUT request replaces the entirety of a document with the submitted content in a new revision. However, you can use the query parameter ?section to constrain revision to a single section of the document and leave the rest of the content as-is. This is handy for automating changes to one part of a document that is otherwise managed by hand, or even for aggregating changes from many sources or scripts into one document.

+ +

文書のセクションを作成する

+ +

Documents on MDN can be broken up into sections. These sections are useful for building a table of contents, linking to specific parts, and editing subsets of document content.

+ +

Using headers

+ +

Headers (ie. <h2> .. <h6>) make sections in MDN documents. The text of each header is transformed automatically into an ID, and that's used for anchor links in the table of contents sidebar on most documents. Those auto-generated IDs can be overriden with the name attribute on headers. Either way, looking at the table of contents is the easiest way to see how a document is broken up into sections, and to discover the IDs for those sections.

+ +

The contents of a section include its header and everything following the header up to (but not including) another header of the same or higher level. So, a section that starts with an <h2> continues until the next <h2>, including any subsections started by <h3> .. <h6>. That also means sections can be nested: An <h3> appearing after an <h2> creates a subsection, including any further nested subsections started by <h4> .. <h6>, up to the next <h3> or <h2>.

+ +

@@TODO: Show an HTML example with headers, here. This is a bit confusing.

+ +

Using container elements

+ +

Setting an id attribute on a container element (eg. a <div> or <span> or <section>) in the source editor also creates a section, at least with respect to the PUT API. This is a bit more advanced and requires manual changes to raw HTML, rather than using the WYSIWYG editor. But, if you want to update a chunk of the page without the need for headers, this is how to do it.

+ +

セクションを指定する

+ + diff --git a/files/ja/mdn/tools/revision_dashboard/index.html b/files/ja/mdn/tools/revision_dashboard/index.html new file mode 100644 index 0000000000..10c96bfa07 --- /dev/null +++ b/files/ja/mdn/tools/revision_dashboard/index.html @@ -0,0 +1,117 @@ +--- +title: リビジョンダッシュボード +slug: MDN/Tools/Revision_dashboard +tags: + - Guide + - MDN Meta + - Site-wide + - Tools +translation_of: MDN/Tools/Revision_dashboard +--- +
{{MDNSidebar}}
+ +

リビジョンダッシュボード は MDN Web Docs Wiki の機能で MDN での最近の更新と追加を見たり、何が変更されたのか詳細を確認したり、それらの更新に対して様々な方法で行動することができます。 この記事では、リビジョンダッシュボードの使い方を説明します。

+ +

外観

+ +

リビジョンダッシュボードのインターフェイスは多くの要素を持ち、便利な機能が満載です。まずはインターフェイスの主要な部分の概観から始めましょう。

+ +

Annotated screenshot of main revision dashboard view

+ +

ここで注意すべき最も大事なことは履歴のリストで、ここでフィルターにマッチする履歴や、履歴の差分 (クリックした履歴で変更された内容が見られます) を一通り見ることができます。

+ +

リビジョン一覧

+ +

リビジョンダッシュボードウィンドウの中ほどにあるリビジョン一覧は、最近なされた変更を提供します。この一覧は、最近変更された記事が最初に来るように順序付けられていて、先に進むともっと古い履歴になります。

+ +

リビジョン一覧のすぐ下にあるのは、検索クエリーにマッチしたページがどれくらいあり、そのうちのどこを見ているのかを示すインジゲーターです。何もフィルターをかけていない場合、MDN wiki になされたすべての履歴のページ数が見えます。

+ +

一覧の各行は wiki への 1 つの変更に対応しています。"変更" とは次のいずれかからなっています:

+ + + +

各行は 4 つの列からなります: リビジョン、タイトル、コメント、著者です。

+ +

リビジョン列

+ +

リビジョン列はなされた変更の情報が与えられます。この列ではいくつかの情報が提供されます:

+ +
+
タイムスタンプ
+
リビジョンが保存された正確な日付と時間。これはリビジョン詳細ページへのリンクで、そこではリビジョンのメタデータとコンテンツが表示されます。
+
ロケール
+
記事のロケールが列のタグとして示されます。これは言語の省略コードで表示され、例えば英語では "en-US" です。
+
ファイル変更インジゲーター
+
これまで存在しない新しい記事には new のタグが表示されます。ページが削除されたことを示す場合は、deleted タグが出てきます。ページが 1 回の改訂だけで削除された場合、newdeleted タグの両方が表示されることもありえます。
+
+

タイトル列

+
+
+ +
+
記事のタイトル
+
記事のタイトルは、ページにセットされているため、列に表示されます。タイトルは、直接移動して素早く簡単に見られるような、wiki 記事へのリンクでもあります。
+
記事のパス
+
記事のタイトルの下に、記事のパスが表示されます。これは記事の URL の一部分で、http://developer.mozilla.org/<locale>/docs/ の後に来るものです。
+
+

コメント列

+
+
+ +
+
リビジョンコメント
+
変更の著者がリビジョンコメントを変更の保存時に追加していた場合、そこにあります。これは小さめのイタリックなテキストで表示されます。
+
移動の情報
+
リビジョンがページの移動を表す場合、wiki 上の移動元と行き先のパスが表示されます。
+
+

著者列

+
+
+ +

著者の列はそのリビジョンを保存した人のユーザー名が表示されます。それをクリックしてユーザーのプロフィールページをすぐに見ることができます。

+ +
+

管理者のみ: 管理者権限を持つ MDN ユーザーは著者列の見出しに Toggle IPs ボタンもあります。これをクリックするとそれぞれの著者の IP アドレスが表示され、不正なユーザーを IP アドレスによって禁止することができます。ユーザーが禁止されたら、ユーザー名の下に印が出ますが、これは管理者のみに見えます。

+
+ +

フィルター

+ +

MDN はいくつかの便利なフィルターオプションを提供しており、あなたのニーズに応じてリビジョンの「物」の量を削減できます。フィルターを調整して、絞り込み ボタンを押して適用します。しばらくすると、ディスプレイはフィルター結果を更新します。いくつかのフィルターを利用できます:

+ +
+
ロケール
+
You may filter so that you only see changes in a specific locale. 既定では, you see changes across all locales, but this may not be useful to you. Indeed, if you're a member of a localization team, 例えば、the only locales you're likely to care about are your own and English. You can specify the locale to filter by in the URL when going to the revision dashboard by adding "locale=<localename>" to the query string. 例えば、: https://developer.mozilla.org/ja/dashboards/revisions?locale=en-US filters to show only changes to English documents.
+
ユーザー
+
Interested in what a specific user has been up to? You can look at the revisions submitted by a single user by entering it in this field. You can specify a user in the URL when going to the revision dashboard by adding "user=<username>" to the query string. 例えば、you can see changes by the user Sheppy with https://developer.mozilla.org/ja/dashboards/revisions?user=Sheppy. This box will offer suggestions as you type, to help you find exactly the person you're looking for.
+
トピック
+
If you'd like to see changes only about a given topic area, you can specify a topic string. This will be matched against the URLs of articles that have been changed and show only those whose titles include this string. You can specify the parameter "topic=<topic>" in the URL's query string to filter on this, as well. 例えば、if you'd like to see only JavaScript-related changes: https://developer.mozilla.org/ja/dashboards/revisions?topic=JavaScript.
+
開始日と終了日
+
You can specify that you want to see only revisions in a certain range of dates, or with a certain starting or ending date. The dashboard UI provides date selection widgets for these fields. You can specify these parameters in the URL's query string, but you must use your system locale's version of the date string. 例えば、: https://developer.mozilla.org/ja/dashboards/revisions?start_date=09%2F01%2F2015 for revisions starting with September 2, 2015 in the en-US locale.
+
先行期間
+
Rather than typing or selecting start or end dates, you can specify that you want to see revisions from a selected period prior to the present time, such as the last hour, day, week, or 30 days.
+
+ +

フィルターを組み合わせて使うのにも注目すぺきで、ユーザーインターフェイスや URL のクエリーストリングの両方でそれは言えます。かなり複雑な検索も実効できます。例えば、ユーザー{{UserLink("evilpie")}} が書いた英語の JavaScript 記事を見つけるには、このようにします https://developer.mozilla.org/ja/dashboards/revisions?locale=en-US&user=evilpie&topic=JavaScript.

+ + + +

更新の差分

+ +

ページのあるリビジョンと前のリビジョンの違いを表示する「差分」を見ることができます。あるリビジョンの差分を見るには、リンクではない行のいずれかをクリックします (つまり、タイムスタンプ、記事のタイトル、著者のユーザー名以外)。この行はリビジョンの差分とリビジョンコントロールを説明します。

+ +

Annotated screenshot of revision dashboard view

+ +

リビジョンコントロールは次の記事操作を許可します:

+ + diff --git a/files/ja/mdn/tools/sample_server/index.html b/files/ja/mdn/tools/sample_server/index.html new file mode 100644 index 0000000000..6f8af2e0f5 --- /dev/null +++ b/files/ja/mdn/tools/sample_server/index.html @@ -0,0 +1,107 @@ +--- +title: MDN サンプルサーバ +slug: MDN/Tools/Sample_server +tags: + - Advanced + - Draft + - Guide + - MDN Meta + - Site-wide + - Tools +translation_of: MDN/Tools/Sample_server +--- +
{{MDNSidebar}}
{{IncludeSubnav("/ja/docs/MDN")}}
+ +

MDN の Kuma プラットフォームは内蔵のライブサンプルシステムを提供して単純な(時にはそう単純でない)コードのサンプルをその出力と共にページの中で表示する機能を提供していますが、この機能では許可されていないことがあり、またサーバへの通信を必要とするサンプルもあります。私たちは MDN サンプルサーバを用意し、このような、またその他の問題も合わせて、解決することにしました。 この記事は、そのサンプルサーバを利用するためのガイドです。

+ +

想定するユースケース

+ +

たいていのサンプルは組み込みの live sample system で表現できますが、例外もあります。サンプルサーバーの利用が必要となる理由は下記の通りです:

+ + + +

サンプルへの参照を追加する

+ +

各サンプルのコードは GitHub で管理されており、そのすべてのサンプルの実行可能/使用可能なインストールアクセスを提供するサーバーを持っています。各サンプルには固有の名前があり、リンクされる際には常にその名前のみで参照されます。以下のマクロの1つを使います。

+ + + +

{{TemplateLink("GithubSampleLink")}} は Github にある与えられた名前を持つサンプルのサンプルコードへのリンクを作成します。リンクのテキストとして使用する文字列をオプションで変更することもできます。

+ + + +

{{TemplateLink("GithubSampleFileLink")}} は Github にあるサンプルコードの中の指定された名前のファイルへのリンクを作成します。引数として、サンプルの名前、 リンクしたいファイルへのサンプルコード内での相対パスがあり、オプションでリンクのテキストを指定することもできます。

+ + + +

{{TemplateLink("SampleServerLink")}} はサンプルサーバー上のユーザーインタラクティブなサンプルへのリンクを挿入します。これはユーザーにサンプルへ移動してブラウザー内で遊ぶことができるように使います; これはサンプルがサーバーのみで作られてクライアント側のコードから別の場所から参照する場合には使いません。サンプルの名前と、オプションでリンクの代替テキストを入力として受けます。

+ +

高度なサンプルに貢献する

+ +

サンプルサーバーに置かれたサンプルに貢献するには、GitHub の MDN サンプルサーバーリポジトリをフォークする必要があります。現在、すべてのサンプルは GitHub の同じリポジトリにあります。

+ +

それぞれのサンプルは s/ ディレクトリーの下に自身のディレクトリーを持っています。新しいサンプルを作るには、そこに適切な名前のディレクトリーを追加します。例えば、ちょっとしたゲームを実装するための Fetch API の使い方を示す例であれぱ、s/fetch-trivia にサンプルを置いても良いでしょう。

+ +

高度なサンプルの構造

+ +

それぞれのサンプルに一つの必須ファイルがあります (これは皮肉にもまだ使われていませんが、すぐ使われるため入れておいてください): manifest.json というマニフェストファイルで、これはサンプルを説明し、サンプルサーバー自体からと、これをメンテ・使用するツールから使われるメタデータを提供します。その他のすべてはオプションです。もっと詳しく見ていきましょう。

+ +

マニフェストファイル: manifest.json

+ +

マニフェストファイルは第一に、サンプルのリストをビルドするのに使われますが、最終的には各サンプルのスタートアップとシャットダウンプロセスを改良することに使われるでしょう。これは次のような JSON オブジェクトです:

+ +
{
+  "name": "WebSocket based chat server with WebRTC video chat support",
+  "docsUrl": "https://developer.mozilla.org/ja/docs/Web/API/WebRTC_API/Signaling_and_video_calling",
+  "description": "Uses Node.js to set up a WebSocket-based chat server, and provides a web page you can use to join the chat. Adds a feature to start a video call with another chat participant."
+}
+ +

現在オブジェクトには3つの項目があり、すべてが必須です (まだ使用してないですが、すぐ使います):

+ +
+
name
+
実例の名前です。例の比較的短い名前であるべきです。
+
docsUrl
+
この例を詳しく扱っている MDN の主なページの URL です。例が複数のページから参照されている場合、「メイン」ページ (または存在するならランディングページ) のアドレスであるべきです。
+
description
+
実例を説明する長めの文で、これがデモする技術についての情報を含みます。
+
+ +

スタートアップ時にサンプルを動かす: startup.sh

+ +

When the sample server starts up or samples are restarted, each sample's base directory is scanned to see if there's a shell script file named startup.sh. If the file exists, it is executed, so that the sample has the opportunity to install support files, run any scripts, and start up any server processes that are needed to support the sample. For example, the WebSocket chat sample's startup.sh script looks like this:

+ +
npm install websocket
+node chatserver.js
+ +

The first line uses the Node package manager, npm, to install the module named websocket, which provides support for creating and/or talking to WebSocket servers.

+ +

The second line actually starts up the server process, which is implemented as a JavaScript script which is started up and run in the background.

+ +

Node.js モジュールを使う: package.json

+ +

To use Node modules in your project, you'll need to add a package.json file, which lists information about your sample but also includes a list of dependencies, so that those dependencies can be installed for you by the Node package manager (npm).

+ +

オプションのファイル

+ +

You may of course have other files. Obvious candidates are an index.html file so that users that browse to your sample see some content, style sheets, support HTML and JavaScript files, images and other media, and so forth.

+ +

サンプルを投稿する

+ +

Once you've finished and tested your sample, you will want to submit it so that it can be tested and eventually installed onto the production sample server. This is done using the standard Github pull request process.

+ +

Tips とエラッタ

+ +

Because the sample server itself is still a work in progress, there are quirks and issues with how samples work. Here are some tips that will help you avoid some of the worst potential problems.

+ +

Port numbers

+ +

If your sample needs to use a network port, you will have to take care not to inadvertently use one that's already being used by another sample (or by a system service on the server).  At some point in the future, there will be an entry in the sample manifest for requesting a port number, so that the system will allocate them and keep track of which are used and which are not. But until then, be careful not to step on any toes!

+ +

進行中の作業

+ +

このページそのもの、そしてここに記述されているサーバについては、作業が継続中です。

diff --git a/files/ja/mdn/tools/search/index.html b/files/ja/mdn/tools/search/index.html new file mode 100644 index 0000000000..fdef55a96b --- /dev/null +++ b/files/ja/mdn/tools/search/index.html @@ -0,0 +1,158 @@ +--- +title: MDN の検索機能 +slug: MDN/Tools/Search +tags: + - Guide + - MDN Meta + - Site-wide + - Tools +translation_of: MDN/Tools/Search +--- +
{{MDNSidebar}}
+ +

MDN のオンサイト検索機能では、外部の検索エンジンで MDN の記事を検索した時には得られない多くの機能が提供されます。この記事では MDN の検索エンジンを最大限に活用する方法を記します。

+ +

基本的な検索オプション

+ +

結果をフィルタリングする

+ +

MDN で検索クエリの結果を表示する際に、トピック、技術レベル、文書タイプで結果をフィルタリングするオプションがあります。これは、関連するキーワードが複数の文脈で表示される可能性のあるメソッドを探している場合などに便利です。トピックフィルターを使用して、最も興味のある API の結果のみを表示することができます。これらのフィルターは、ページに設定されたタグによって、どのページを含めるか除外するかを決定します (ページを作成または編集する際に適切にタグ付けするのはこれが理由です)。以下の種類のフィルターを適用することができます。

+ +
+
トピック
+
トピックのタグに従って検索結果を絞り込む
+
技術レベル
+
Beginner, Intermediate, Advanced の各タグで絞り込む
+
文書タイプ
+
Example, Guide, Tools の各タグで絞り込む
+
+ +

高度な検索オプション

+ +

MDN 貢献者向けに特定のマクロや HTML 属性などを検索できるよう、マクロの出力ではなく生の HTML でページのソースを検索できる高度な検索機能を用意しています。

+ +

今のところこの高度な検索用のユーザーインターフェイスは用意しておらず、URL で直接アクセスすることで利用できます。検索結果は通常の MDN の検索結果ページあるいは JSON フォーマットのいずれかで得られます (後者の検索結果は例えば KumaScript などから使うこともできます)。この節ではその使い方を説明します。

+ +

注: ここで紹介する検索クエリーは広く利用される目的で作る URL ではありません。ツールやユーティリティから使用するためのものであり、将来変更される可能性があります。クエリーのパフォーマンスも高くない場合があります。

+ +

検索クエリーの書式

+ +

高度な検索クエリーは検索に適切な引数を付けた URL で実行してください。ベースとなる URL は次のいずれかです。

+ +
+
https://developer.mozilla.org/ja/search
+
通常の MDN 検索結果ページを出力とする場合はこちらを使います。
+
https://developer.mozilla.org/ja/search.json
+
JSON 形式で結果を取得する場合はこちらを使います。検索結果の書式については {{anch("JSON response body format")}} をご覧ください。
+
+ +

これに続けて、欲しい結果を得るには適切なパラメータを追加してください。次のパラメータを組み合わせて利用できます:

+ +
+
q=
+
マッチする検索クエリー。これは基本検索で使われるパラメーターと同じです。
+
locale=
+
検索対象とするロケール。既定ではすべてのロケールが対象となります。すべてのロケールを明示的に指定するにはワイルドカード "*" を指定することもできます。例えば、 locale=ja とすれば検索結果を日本語だけに絞り込めます。
+
css_classnames=
+
検索対象とする CSS クラス名。ページの HTML に少なくとも指定されたクラスが 1 つ以上含まれているページを検索します。
+
html_attributes=
+
検索対象とする HTML 属性テキスト。これは前方一致検索です。つまり、指定したテキストが HTML の属性文字列の始めにある場合、検索にマッチします。詳しくは下記をご覧ください。
+
kumascript_macros=
+
検索対象とする 1 つ以上の KumaScript のリスト。これをつかって特定のマクロを使った記事を検索できます。例えば、マクロを廃止する場合や、パラメータが変更され既存のページを更新する必要がある場合に便利です。
+
highlight=
+
truefalse のどちらかで、既定では true です。検索クエリーにマッチする結果の周りに <mark> 要素を含めるかどうかを決めます。
+
per_page=
+
100以下の数値です。既定では Kuma はページ当たり10個の結果を出力します。それとは異なる値を使用する場合にこの引数を使用してください。
+
+ +

+ +

検索例をいくつか示します。

+ +

ロケールによる検索

+ +
https://developer.mozilla.org/en-US/search?locale=ja
+ +

この例では日本語の記事のリストが得られます。言語 (ロケール) 以外での絞り込みはされません。このページの翻訳時点では 12092 ページが見つかります (もちろん翻訳ページは増え続けているのであなたが試すときにはもっと大きな数になっているはずです!)

+ +

CSS クラス名による検索

+ +
https://developer.mozilla.org/ja/search?locale=ja&css_classnames=smaller
+ +

この例では CSS で smaller クラスを使っている記事のリストが得られます。ページ翻訳時点では 42 ページに絞り込まれます。

+ +

HTML 属性文字列による検索

+ +
https://developer.mozilla.org/ja/search?locale=ja&html_attributes=style
+ +

この例では HTML 要素に style 属性が使われている記事のリストが得られます。ページ翻訳時点では 7277 ページが該当します。これらはダメなページで修正されるべきものです。少しずつ標準化したクラスで置き換えていく必要があります。

+ +

属性値も含めて検索することはできますが、検索文字列に =/ を含める場合にはこれらを URL エンコードする必要があることに注意してください。例えば、www.mozilla.org にリンクしているページは次のように検索します:

+ +
https://developer.mozilla.org/ja/search?locale=ja&html_attributes=href%3D%22https%3A%2F%2Fwww.mozilla.org
+ +

この検索結果は 80 件になりました。www.mozilla.org にリンクしているページは意外と少ないですね!

+ +

KumaScript マクロの使用状況による検索

+ +
https://developer.mozilla.org/ja/search?locale=ja&kumascript_macros=TemplateLink
+ +

この例では {{TemplateLink("TemplateLink")}} マクロを使用しているページを検索します。マクロの引数が変更された時や、マクロの使用をやめたいときに検索することができます。

+ +

JSON レスポンス本文の書式

+ +

JSON で検索結果を取得する場合も、通常の検索結果ページ同様に数件ずつのページ単位で結果が返されます。各ページには検索結果に関するメタデータが含まれる KumaScript オブジェクトと、通常のページオブジェクトにページ編集用の URL フィールドが追加されたものの配列が返されます。

+ +

結果のオブジェクトに含まれるデータは次の通りです。

+ +
+
count
+
検索結果の総数
+
next
+
検索結果の次ページ URL (あるいは最終ページの場合は {{JSxRef("Global_Objects/null", "null")}})
+
previous
+
検索結果の前ページ URL (あるいは最初のページの場合は {{JSxRef("Global_Objects/null", "null")}})
+
query
+
結果を検索するのに使われた検索クエリー
+
page
+
このオブジェクトに含まれる検索結果ページ番号
+
pages
+
検索結果ページの総数
+
start
+
このページの結果のうち最初の項目の番号
+
end
+
このページの結果のうち最後の項目の番号
+
filters
+
さまざまな検索フィルターの設定を含めた配列。通常の検索に利用可能なフィルターです
+
documents
+
マッチしたページの{{anch("Page_objects", "ページオブジェクト")}}の配列
+
+ +

ページオブジェクト

+ +

各ページオブジェクトには次のものが含まれます。

+ +
+
title
+
記事タイトル
+
slug
+
記事のスラグ。ページの URL のうち、ロケール名とスラッシュに続くものすべてです。
+
locale
+
ページのロケール
+
excerpt
+
ページコンテンツの断片 (スニペット)。これは記事本文の冒頭部分か、"SEO Summary" クラスが使われていればそのクラスで指定されたコンテンツ。検索クエリ引数内で highlight=false を指定しない限り、excerpt には <mark> 要素が入ります。
+
url
+
ページの完全な URL
+
edit_url
+
ページを編集モードで開く完全な URL
+
tags
+
ページのタグの配列
+
score
+
検索エンジンで割り当てられたスコア値
+
explanation
+
検索クエリーにどのように何故マッチしたかという検索エンジンからの雑多な情報。このコンテンツの詳細についてはこのページでは解説しません。
+
+ +

関連情報

+ +

追加の管理者のみの検索機能がいくつかあり、例えばスラッグが特定の文字で始まっているページを検索したりすることができます。

diff --git a/files/ja/mdn/tools/template_editing/index.html b/files/ja/mdn/tools/template_editing/index.html new file mode 100644 index 0000000000..d32794f82e --- /dev/null +++ b/files/ja/mdn/tools/template_editing/index.html @@ -0,0 +1,38 @@ +--- +title: テンプレートの編集 +slug: MDN/Tools/Template_editing +tags: + - Page-level +translation_of: MDN/Tools/Template_editing +--- +
{{MDNSidebar}}

MDNでは、 KumaScript で書かれたテンプレートがコンテンツの自動生成、およびページのカスタマイズに使われています。 それぞれのテンプレートは、別々の Wiki ページに置かれていて、ページ名は以下のとおりです:
+ /en-US/docs/Template:テンプレートの名前

+ +

MDN の Wikiを編集している人なら誰でも、マクロを通じてテンプレートを呼び出すことができます。KumaScript は強力なので、テンプレートの作成と編集のための権限は、必要な経験を持ち合わせた信頼できるユーザーのみに与えられています。

+ +

この権限を持つ役割の人

+ + + +

この権限を得るための条件

+ +

このツールにアクセスする権限を得るための条件は以下のとおりです:

+ + + +

この権限を得るためのプロセスについては、上位権限のリクエスト を見てください。

+ +

テンプレート編集の権限を持っている人(peer)たち

+ + diff --git a/files/ja/mdn/tools/zones/index.html b/files/ja/mdn/tools/zones/index.html new file mode 100644 index 0000000000..2bb4599e2d --- /dev/null +++ b/files/ja/mdn/tools/zones/index.html @@ -0,0 +1,203 @@ +--- +title: ゾーン +slug: MDN/Tools/Zones +tags: + - Deprecated + - Guide + - MDN Meta + - Site-wide + - Tools +translation_of: Archive/MDN/Zones +--- +
{{MDNSidebar}}

ゾーンは MDN の特別なエリアで、そのコンテンツは特別ゾーンナビゲーションボックス、ページのヘッダにおける強調された視覚要素のような追加ユーザインタフェースと共に提供されます。 このガイドはゾーンの構築と維持について取り扱います。

+ +
+

ゾーンの使用は廃止されました
+ Due to an unsatisfactory user experience and the performance costs of its implementation, we are in the process of deprecating zones. Please only create a new zone if you absolutely must; generally, this should only be done to fix problems related to content which is a zone in English but not in other locales.  Please drop into #mdn on IRC to ask questions about anything you read here, especially if you're considering creating a zone or turning any existing material into a zone.

+
+ +

ゾーンの特徴

+ +

Once you've created a zone, as covered below, you have various special features and abilities that you can, and should, take advantage of:

+ + + +

There are basically two types of zone: the in-wiki zone, and the mini-site zone.

+ +

Wiki 内のゾーン

+ +

An in-wiki zone is a zone which takes advantage of zone functionality while remaining part of the main flow of MDN's documentation content.  These are sort of semi-zones, in that they generally don't include content from outside their own hierarchy.

+ +

An in-wiki zone allows a segment of MDN to add the additional visuals and, probably more importantly, the zone navigation sidebar, without removing the user from the main flow of MDN content.

+ +
+

Note: In-wiki zones do not typically appear in the "Zones" list on the MDN home page, since they're treated as part of the main body of MDN's documentation content.

+
+ +

ミニサイト ゾーン

+ +

A mini-site zone is a zone which, while edited and managed using the same interface as any wiki page on MDN, is presented outside the main flow of documentation content. In all functional respects, it supports all the standard wiki functionality provided by the Kuma platform on which MDN is built. A good example is the App Center.

+ +

When a mini-site zone is created, it is given a new URL outside the "/docs/" tree on MDN, typically at the URL https://developer.mozilla.org/<locale>/zone/<your_zone_name>.

+ +
+

Note: In general, only very high-profile, special-purpose content should be moved out of the wiki hierarchy; these zones are intended primarily for setting up special-purpose promotional and/or program-related content.

+
+ +

何をゾーンにするべきか?

+ +

This is an interesting question, and to be honest, the answer is likely to change over time. Zones are a new concept for MDN, and we're still learning exactly how we'll use them.

+ +

There are basically two reasons to create a zone:

+ +
    +
  1. You need to set up a mini-site for a promotional campaign or a specific product.
  2. +
  3. You want to create a one-stop shop, so to speak, for a topic that spans multiple technology areas.
  4. +
+ +

ゾーンを作成する

+ +

The first step is to create the content. At a minimum, you need to create the initial landing page that will become the root page for your zone. Once you have at least the root page, and possibly even your sub-content, you can then have the pages turned into a zone.

+ +

In order to turn a section of MDN into a zone requires MDN administrator privileges, so you'll need to ask an MDN administrator to do it for you. There are a few things you'll need to provide to the admin as part of your request:

+ + + +
+

Note: Because zones are a special-purpose construct, you will likely be asked to justify why the content should be a zone at all. Refer to {{anch("What should be a zone.3F", "What should be a zone?")}} for insight.

+
+ +

ゾーンのアクセスポリシーを変更する

+ +

At this time, there's no functional support for access control for zones. This functionality is coming in the future. If you need access control for your zone, please let us know, so we can adjust the priority of that work.

+ +

表示をカスタマイズする

+ +

Part of what makes a zone a zone is the ability to customize its visual identity. Minimally, this means a special color and image used as the background in the header area of the zone's pages to help the user know that they're in a specific zone. It's also possible to make other basic adjustments to the appearance of the page, as long as the overall feeling of being on MDN is retained.

+ +
+

Note: It's important to keep in mind that the instructions below are suggestions. You can try to tinker further with the CSS for your zone. Just keep in mind that your changes may be reviewed by our UX and/or design teams, and will be expected to blend in well with the rest of MDN.

+
+ +

基本的なカスタマイズ

+ +

The basic, required customizations for each zone are the background color and image for the header area of the pages in the zone. When requesting that a zone be created, you'll be asked to provide these. Here are basic guidelines to what you need to provide.

+ + + +

With this information, the MDN admin team can set up the basic CSS for your zone for you. If you'd like, however, you can go a step farther and provide the CSS yourself. By following the guidelines in {{anch("Additional customizations")}}, you can experiment with other changes to the appearance of your zone.

+ +

さらなるカスタマイズ

+ +

If you'd like to investigate additional customization options, take a look at the CSS/stylus template located in github. This lists all the Stylus CSS for the styles you're allowed to alter using your zone's custom CSS.

+ +

If you wish to perform additional customizations, you may do so, with one major caveat: your customizations must not be so drastic that they make the pages in the zone no longer "feel" like part of MDN.

+ +

When customizing the zone's stylesheet, it's your job to sort out from the template which styles you want to alter and to put together the CSS to do so. Once you've done so, provide that CSS to the MDN admin team, and they'll install it for you.

+ +

All zone-related content has the class zone on it.

+ +
+

Note: Please note that because the site is actively undergoing development, anything about specific classes and styles discussed here is subject to change without notice.

+
+ +

背景色

+ +

As mentioned previously, the first thing you're likely to customize is the background color for your zone's header area. The CSS looks something like this:

+ +
.zone #main-header, .zone .zone-article-header, .zone .zone-landing-header {
+    background-color: zone-color;
+}
+
+ +

The ID main-header refers to the site navigation area at the very top of the page. This includes the "Mozilla" cross-site navigation tab, search box, and other global navigation functionality.

+ +

The class zone-article-header represents the appearance of the header area on article pages within the zone. That is, all pages other than the base landing page within the zone will have this class on their heading area.

+ +

The class zone-landing-header is used for the header area on the zone's landing page. This is the taller heading area on the landing page, with the larger image in it.

+ +

As a general rule, you want all of these areas to have the same color; indeed, the article and landing page header colors should be the same. The only reason you might configure them differently is if they were gradients and you wanted to adjust them to have the same overall "average" color despite the different height of the space.

+ +

In short: Replace zone-color in the CSS snippet above with the {{cssxref("<color>")}} you've selected for your zone color.

+ +

ランディングページのヘッダ画像

+ +

You will also want to change the image that represents your zone on the zone's landing page. This page has a larger header box to accomodate a larger image to represent your zone. The CSS looks like this:

+ +
.zone .zone-landing-header .zone-image {
+    background-image: url(zone-image-url);
+}
+
+ +

The zone-image class is used to specify and style the image for your zone's landing page header. This image should be no wider than 468 pixels, although you can override this by using additional CSS here. Simply replace zone-image-url with the URL of the image to use.

+ +
+

Note: The easiest way to provide the image is to simply attach it to an appropriate page on MDN and use the resulting URL.

+
+ +

記事ページのヘッダ画像

+ +

Additionally, you should set the image that represents your zone on its subpages. By default, this image is constrained to 200 pixels wide by 400 pixels tall, but, again, that can be overridden.

+ +
.zone .zone-article-header .zone-image {
+    background-image: url(zone-image-url);
+}
+
+ +

Just replace zone-image-url with the URL of the image to use.

+ +
+

Note: The easiest way to provide the image is to simply attach it to an appropriate page on MDN and use the resulting URL. You can choose to use the same image as you do for the landing page header image, with some scaling or cropping applied, or you can use a different image.

+
+ +

ヘッダボタンの下の境界

+ +

The last thing you're generally advised to change is the appearance of the bottom border of the buttons in the zone header area. This is the CSS:

+ +
.zone .zone-landing-header a.button {
+    box-shadow: inset 0 -1px color;
+}
+
+ +

Here, replace color with a {{cssxref("<color>")}} that is very similar to your background color, but slightly darker.

+ +

ゾーンナビゲーション

+ +

ゾーンナビゲーションサイドバー

+ +

The sidebar appearing on every page in a zone is defined in the zone's landing page content, in a section called "Subnav" (visible only when editing the page). This section may contain a manually curated list of pages or use a macro, such as {{TemplateLink("ListSubpages")}}. In the latter case you will need to force-reload (shift+refresh) the zone's landing page in order to update the sidebar.

+ +

クイックリンク

+ +

As is the case with any page on MDN, pages within zones may use the quicklinks feature. Quicklinks are a navigation box, presented in the left sidebar area, offering links the user may follow to related material. These links may be within MDN or off-site, and may be nested up to two total levels deep, using folders.

+ +

To aid in generating common types of quicklinks for zones, we have some macros you can use.

+ +

QuickLinksWithSubpages

+ +

The {{TemplateLink("QuickLinksWithSubpages")}} macro generates all of the HTML required to present a quicklinks box on the page with the links corresponding to the pages in a specified hierarchy. You can also use it with no parameters at all to present quicklinks of subpages of the current page, although this is not commonly as useful in a zone since the zone navigation will generally present this for you.

+ +

ゾーンのスタイルガイド

+ +

注記

+ +

This section offers some notes that are worth keeping in mind when creating, working with, and using zones.

+ + -- cgit v1.2.3-54-g00ecf