Zend Framework ドキュメント標準(一部日本語) 概要 スコープ This document provides guidelines for creation of the end-user documentation found within Zend Framework. It is intended as a guide to Zend Framework contributors, who must write documentation as part of component contributions, as well as to documentation translators. The standards contained herein are intended to ease translation of documentation, minimize visual and stylistic differences between different documentation files, and make finding changes in documentation easier with diff tools. You may adopt and/or modify these standards in accordance with the terms of our license. Topics covered in Zend Framework's documentation standards include documentation file formatting and recommendations for documentation quality. ドキュメントファイル形式 XML タグ 各マニュアルのファイル先頭に、下記の XML 宣言がなければなりません。 ]]> 翻訳した言語の XML ファイルには、 対応する翻訳元の英語ファイルのリビジョンに等しいリビジョン・タグもなければなりません。 ]]> 行の最大長 The maximum line length, including tags, attributes, and indentation, is not to exceed 100 characters. There is only one exception to this rule: attribute and value pairs are allowed to exceed the 100 chars as they are not allowed to be separated. インデント インデントは、空白文字4つで構成されなければなりません。タブは許されません。 同じレベルにあるタグは、同じインデントを持たなければなりません。 ]]> 前のタグの1つ下のレベルのタグは、さらに4つの空白文字でインデントされなければなりません。 ]]> 複数のブロック・タグは、同一行の中では許されません。 しかしながら、インライン・タグは複数許されます。 Zend_Magic does not exist. Zend_Acl does. ]]> 行の終端 行の終端は、Unixテキスト・ファイル規約に従います。 行は、単一のラインフィード(LF)文字で終わらなければなりません。 ラインフィード文字は、序数10または16進の0x0Aとして表現されます。 注意: Apple OS で規約となっているキャリッジ・リターン (CR;0x0D) または、Windows OS で標準となっているキャリッジ・リターンと ラインフィード (CRLF) の組合せ (0x0D, 0x0A) を使用してはいけません。 空のタグ 空のタグは認められません。タグは全てテキストまたは子供タグを含まなければいけません。 Some text. ]]> ドキュメント内での空白の利用 タグ内での空白 Opening block tags should have no whitespace immediately following them other than line breaks (and indentation on the following line). WHITESPACE ]]> 開始のインライン・タグの直後に空白文字を置いてはいけません。 This is the class Zend_Class. This is the class Zend_Class. ]]> Closing block tags may be preceded by whitespace equivalent to the current indentation level, but no more than that amount. ]]> 終わりのインライン・タグの前に空白文字を置いてはいけません。 This is the class Zend_Class This is the class Zend_Class ]]> 複数行の切断 複数行内での、またはタグの間での切断は認められません。 Some text... ... and more text Another paragraph. Some text... ... and more text Another paragraph. ]]> タグの間の分離 読みやすくするために、同じレベルのタグは空行で分離しなければいけません。 Some text... More text... Some text... More text... ]]> 最初の子タグは、空行を置かずに親タグの直下に開かなければいけません。 最後の子タグは、親タグが閉じる直前で閉じなければいけません。 ]]> プログラム・リスティング The opening <programlisting> tag must indicate the appropriate "language" attribute and be indented at the same level as its sibling blocks. Sibling paragraph. ]]>< CDATA should be used around all program listings. <programlisting> sections must not add linebreaks or whitespace at the beginning or end of the section, as these are then represented in the final output. ]]><> ]]><> ]]> Ending CDATA and <programlisting> tags should be on the same line, without any indentation. ]]><> ]]><> ]]><> ]]> The <programlisting> tag should contain the "language" attribute with a value appropriate to the contents of the program listing. Typical values include "css", "html", "ini", "javascript", "php", "text", and "xml". ]]>< ]]>< ]]>< For program listings containing only PHP code, PHP tags (e.g., "<?php", "?>") are not required, and should not be used. They simply clutter the narrative, and are implied by the use of the <programlisting> tag. <]]]]>> < ]]]]>> ]]> Line lengths within program listings should follow the coding standards recommendations. Refrain from using require_once(), require(), include_once(), and include() calls within PHP listings. They simply clutter the narrative, and are largely obviated when using an autoloader. Use them only when they are essential to the example. ショートタグを決して使わないで下さい Short tags (e.g., "<?", "<?=") should never be used within programlisting or the narrative of a document. 特殊なインラインタグの注意 classname The tag <classname> must be used each time a class name is represented by itself; it should not be used when combined with a method name, variable name, or constant, and no other content is allowed within the tag. The class Zend_Class. ]]> varname Variables must be wrapped in the <varname> tag. Variables must be written using the "$" sigil. No other content is allowed within this tag, unless a class name is used, which indicates a class variable. The variable $var and the class variable Zend_Class::$var. ]]> methodname Methods must be wrapped in the <methodname> tag. Methods must either include the full method signature or at the least a pair of closing parentheses (e.g., "()"). No other content is allowed within this tag, unless a class name is used, which indicates a class method. The method foo() and the class method Zend_Class::foo(). A method with a full signature: foo($bar, $baz) ]]> constant Use the <constant> tag when denoting constants. Constants must be written in UPPERCASE. No other content is allowed within this tag, unless a class name is used, which indicates a class constant. The constant FOO and the class constant Zend_Class::FOO. ]]> filename Filenames and paths must be wrapped in the <filename> tag. No other content is allowed in this tag. The filename application/Bootstrap.php. ]]> command Commands, shell scripts, and program calls must be wrapped in the <command> tag. If the command includes arguments, these should also be included within the tag. Execute zf.sh create project. ]]> code Usage of the <code> tag is discouraged, in favor of the other inline tasks discussed previously. 特殊なブロックタグの注意 title <title> タグで他のタグを保持してはいけません。 Using <classname>Zend_Class</classname> Using Zend_Class ]]> 推奨事項 自動でフォーマットしないエディタを使ってください ドキュメンテーションを編集するために、 一般的に、正式なXMLエディタを使用するべきではありません。 そのようなエディタは、通常、それらの独自の標準に合わせるために、 既存のドキュメントを自動的にフォーマットします。 および/または、docbook 標準に厳密には従いません。 例えば、それらはCDATAタグを消したり、 4スペースの間隔をタブや2スペースに変えたりすることを経験しています。 スタイル・ガイドラインは、通常のdiffツールを用いて 変更した行を翻訳者が確認できるようにするために主に書かれました。 自動フォーマットは、この処理をより難しくします。 イメージを使ってください Good images and diagrams can improve readability and comprehension. Use them whenever they will assist in these goals. Images should be placed in the documentation/manual/en/figures/ directory, and be named after the section identifier in which they occur. ケースの例を使ってください Look for good use cases submitted by the community, especially those posted in proposal comments or on one of the mailing lists. Examples often illustrate usage far better than the narrative does. When writing your examples for inclusion in the manual, follow all coding standards and documentation standards. phpdocの内容を繰り返すことを避けてください The manual is intended to be a reference guide for end-user usage. Replicating the phpdoc documentation for internal-use components and classes is not wanted, and the narrative should be focussed on usage, not the internal workings. In any case, at this time, we would like the documentation teams to focus on translating the English manual, not the phpdoc comments. リンクを使ってください ドキュメントを繰り返す代わりに、 マニュアルの他のセクションや外部のソースにリンクしてください。 マニュアルの他のセクションへのリンクを <link>タグ(リンクのテキストを用意しなければいけません) を使って実施できるでしょう。 "Link" links to a section, using descriptive text: documentation on links. ]]> 外部リソースにリンクするには、<ulink>を使ってください。 The Zend Framework site. ]]>