URL パラメータと文書のメタデータ

この翻訳は不完全です。英語から この記事を翻訳 してください。

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

URL パラメータ

We support several useful query parameter options on every Kuma wiki document URL, when fetched via HTTP GET or viewed in a browser. Multiple query parameters are separated by & instead of the initial ? (see macros example):

summary
Kuma にページの概要のみを返すよう指示します。 If there is content on the page marked with the class "SEO summary", that content is returned. If there is no such content, the contents of a section entitled "Summary" are returned. Failing that,  the contents of the first block are returned.
raw
Instructs Kuma to return the raw content of the page, without any of the skin material, such as the headers, footers, and so forth. This does not execute templates or scripts, which is handy for building editors. For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw
macros
Instructs Kuma to execute all the templates in the page. When combined with ?raw, this offers fully-rendered MDN content without the site wrapper. Defaults to on without ?raw (ie. during normal site views), defaults to off when ?raw is present. For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw&macros
nomacros
Instructs Kuma not to execute the KumaScript templates in the page. Since ?macros defaults to "on" during a normal site view, this option turns it off. For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?nomacros
include
Tells Kuma to strip out any blocks that have the class "noinclude" on them. This is useful to get the output as it would appear when included in another page, rather than as a standalone page. Often this will remove sample code and the like (although not always). For example: https://developer.mozilla.org/en-US/docs/XUL/Attribute/align?raw&macros&include
section=id
Instructs Kuma to return the content from only the section with the specified anchor name.For example:
https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters?section=params and the more interesting https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters?raw&macros&section=params

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

Along with parameters to tweak the response of a document URL, there are also some alternate views on documents specified by URL suffix:

$toc
Tells Kuma to return only the table of contents for the page in HTML. It's returned as an ordered list (that is, <ol>). For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$toc
$json
Tells Kuma to describe the page in a JSON object; this object is essentially the same one you would get using the KumaScript routine wiki.getPage(). For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$json
$children
Tells Kuma to list the topic children of the page in JSON; this object is essentially the same one you would get using the KumaScript routine pages.subpages(). For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$children
$compare
Presents the source text line differences between revisions specified in required query parameters ?from and ?to. For examle: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$compare?to=911697&from=911067
$edit
Edits the current revision given document instead of displaying it. For example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$edit
$history
Displays revision history of the newest ten revisions of given document instead of its contents. The full history can be requested with the ?limit=all query parameter value. For example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$history?limit=all
$revision
Displays the document revision number which must be specified after a "/" separator. For example https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$revision/915141

ドキュメントのタグと貢献者

タグ: 
 最終更新者: Uemmra3,