Zend Framework Documentation StandardOverviewScope
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.
Documentation File FormattingXML Tags
Each manual file must include the following XML declarations at
the top of the file:
]]>
XML files from translated languages must also include a revision
tag containing the revision of the corresponding English-language file the
translation was based on.
]]>Maximum Line Length
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.
IndentationIndentation should consist of 4 spaces. Tabs are not allowed.Tags which are at the same level must have the same indentation.
]]>
Tags which are one level under the previous tag must be indented with 4 additional
spaces.
]]>
Multiple block tags within the same line are not allowed; multiple inline tags are
allowed, however.
Zend_Magic does not exist. Zend_Acl does.
]]>Line Termination
Line termination follows the Unix text file convention. Lines must end with a
single linefeed (LF) character. Linefeed characters are represented as ordinal 10,
or hexadecimal 0x0A.
Note: Do not use carriage returns (CR) as is the convention in
Apple OS's (0x0D) or the carriage return - linefeed combination
(CRLF) as is standard for the Windows OS (0x0D, 0x0A).
Empty tags
Empty tags are not allowed; all tags must contain text or child tags.
Some text.
]]>Usage of whitespace within documentsWhitespace within tags
Opening block tags should have no whitespace immediately following them other
than line breaks (and indentation on the following line).
WHITESPACE
]]>
Opening inline tags should have no whitespace immediately following them.
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.
]]>
Closing inline tags must not be preceded by any whitespace.
This is the class Zend_Class
This is the class Zend_Class
]]>Multiple line breaks
Multiple line breaks within or between tags are not allowed.
Some text...
... and more text
Another paragraph.
Some text...
... and more text
Another paragraph.
]]>Separation between tags
Tags at the same level must be separated by an empty line to improve
readability.
Some text...
More text...
Some text...
More text...
]]>
The first child tag should open directly below its parent, with no empty line
between them; the last child tag should close directly before the closing tag of
its parent.
]]>Program Listings
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.
Never use short tags
Short tags (e.g., "<?", "<?=") should never be used within
programlisting or the narrative of a document.
Notes on specific inline tagsclassname
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.
Notes on specific block tagstitle
The <title> tag is not allowed to hold other tags.
Using Zend_ClassUsing Zend_Class
]]>RecommendationsUse editors without autoformatting
For editing the documentation, typically you should not use formal
XML editors. Such editors normally autoformat existing documents
to fit their own standards and/or do not strictly follow the docbook standard. As
examples, we have seen them erase the CDATA tags, change 4 space
separation to tabs or 2 spaces, etc.
The style guidelines were written in large part to assist translators in recognizing
the lines that have changed using normal diff tools.
Autoformatting makes this process more difficult.
Use Images
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.
Use Case Examples
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.
Avoid Replicating phpdoc Contents
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.
Use Links
Link to other sections of the manual or to external sources
instead of recreating documentation.
Linking to other sections of the manual may be done using the
<link> tag (to which you must provide link text).
"Link" links to a section, using descriptive text: documentation on
links.
]]>
To link to an external resource, use <ulink>:
The Zend Framework site.
]]>