Skip to content

Commit 54ca6b0

Browse files
committed
Refactored Doc Standards into its own file
1 parent 8e196bf commit 54ca6b0

File tree

4 files changed

+96
-49
lines changed

4 files changed

+96
-49
lines changed

contributing/documentation/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ Contributing Documentation
66

77
overview
88
format
9+
standards
910
translations
1011
license

contributing/documentation/overview.rst

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -161,55 +161,8 @@ tags would be removed from the new 2.5 branch.
161161
Standards
162162
---------
163163

164-
In order to help the reader as much as possible and to create code examples that
165-
look and feel familiar, you should follow these rules:
166-
167-
* The code follows the :doc:`Symfony Coding Standards</contributing/code/standards>`
168-
as well as the `Twig Coding Standards`_;
169-
* Each line should break approximately after the first word that crosses the
170-
72nd character (so most lines end up being 72-78 characters);
171-
* To avoid horizontal scrolling on code blocks, we prefer to break a line
172-
correctly if it crosses the 85th character;
173-
* When you fold one or more lines of code, place ``...`` in a comment at the point
174-
of the fold. These comments are: ``// ...`` (php), ``# ...`` (yaml/bash), ``{# ... #}``
175-
(twig), ``<!-- ... -->`` (xml/html), ``; ...`` (ini), ``...`` (text);
176-
* When you fold a part of a line, e.g. a variable value, put ``...`` (without comment)
177-
at the place of the fold;
178-
* Description of the folded code: (optional)
179-
If you fold several lines: the description of the fold can be placed after the ``...``
180-
If you fold only part of a line: the description can be placed before the line;
181-
* If useful, a ``codeblock`` should begin with a comment containing the filename
182-
of the file in the code block. Don't place a blank line after this comment,
183-
unless the next line is also a comment;
184-
* You should put a ``$`` in front of every bash line;
185-
* The ``::`` shorthand is preferred over ``.. code-block:: php`` to begin a PHP
186-
code block;
187-
* You should use a form of *you* instead of *we*.
188-
189-
An example::
190-
191-
// src/Foo/Bar.php
192-
193-
// ...
194-
class Bar
195-
{
196-
// ...
197-
198-
public function foo($bar)
199-
{
200-
// set foo with a value of bar
201-
$foo = ...;
202-
203-
// ... check if $bar has the correct value
204-
205-
return $foo->baz($bar, ...);
206-
}
207-
}
208-
209-
.. caution::
210-
211-
In Yaml you should put a space after ``{`` and before ``}`` (e.g. ``{ _controller: ... }``),
212-
but this should not be done in Twig (e.g. ``{'hello' : 'value'}``).
164+
All documentation in the Symfony Documentation should follow
165+
:doc:`the documentation standards <standards>`.
213166

214167
Reporting an Issue
215168
------------------
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Documentation Standards
2+
=======================
3+
4+
In order to help the reader as much as possible and to create code examples that
5+
look and feel familiar, you should follow these standards.
6+
7+
Sphinx
8+
------
9+
10+
* Each line should break approximately after the first word that crosses the
11+
72nd character (so most lines end up being 72-78 characters);
12+
* The ``::`` shorthand is *preferred* over ``.. code-block:: php`` to begin a PHP
13+
code block (read `the Sphinx documentation`_ to see when you should use the
14+
shorthand);
15+
* You should use a form of *you* instead of *we*.
16+
17+
Example
18+
~~~~~~~
19+
20+
.. code-block:: ReST
21+
22+
Example
23+
=======
24+
25+
When you are working on the docs, you should follow the `Symfony Docs`_
26+
standards.
27+
28+
Level 2
29+
-------
30+
31+
A PHP example would be::
32+
33+
echo 'Hello World';
34+
35+
Level 3
36+
~~~~~~~
37+
38+
.. code-block:: php
39+
40+
echo 'You cannot use the :: shortcut here';
41+
42+
.. _`Symfony Docs`: http://symfony.com/doc/current/contributing/documentation/standards.html
43+
44+
Code Examples
45+
-------------
46+
47+
* The code follows the :doc:`Symfony Coding Standards</contributing/code/standards>`
48+
as well as the `Twig Coding Standards`_;
49+
* To avoid horizontal scrolling on code blocks, we prefer to break a line
50+
correctly if it crosses the 85th character;
51+
* When you fold one or more lines of code, place ``...`` in a comment at the point
52+
of the fold. These comments are: ``// ...`` (php), ``# ...`` (yaml/bash), ``{# ... #}``
53+
(twig), ``<!-- ... -->`` (xml/html), ``; ...`` (ini), ``...`` (text);
54+
* When you fold a part of a line, e.g. a variable value, put ``...`` (without comment)
55+
at the place of the fold;
56+
* Description of the folded code: (optional)
57+
If you fold several lines: the description of the fold can be placed after the ``...``
58+
If you fold only part of a line: the description can be placed before the line;
59+
* If useful, a ``codeblock`` should begin with a comment containing the filename
60+
of the file in the code block. Don't place a blank line after this comment,
61+
unless the next line is also a comment;
62+
* You should put a ``$`` in front of every bash line.
63+
64+
Example
65+
~~~~~~~
66+
67+
.. code-block:: php
68+
69+
// src/Foo/Bar.php
70+
71+
// ...
72+
class Bar
73+
{
74+
// ...
75+
76+
public function foo($bar)
77+
{
78+
// set foo with a value of bar
79+
$foo = ...;
80+
81+
// ... check if $bar has the correct value
82+
83+
return $foo->baz($bar, ...);
84+
}
85+
}
86+
87+
.. caution::
88+
89+
In Yaml you should put a space after ``{`` and before ``}`` (e.g. ``{ _controller: ... }``),
90+
but this should not be done in Twig (e.g. ``{'hello' : 'value'}``).
91+
92+
.. _`the Sphinx documentation`: http://sphinx-doc.org/rest.html#source-code

contributing/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
* :doc:`Overview </contributing/documentation/overview>`
1515
* :doc:`Format </contributing/documentation/format>`
16+
* :doc:`Documentation Standards </contributing/documentation/standards>`
1617
* :doc:`Translations </contributing/documentation/translations>`
1718
* :doc:`License </contributing/documentation/license>`
1819

0 commit comments

Comments
 (0)