Help: Add documentation style section headers to cmake-developer.7

Give the style guides titles instead of numbers so we can link to them.
This commit is contained in:
Brad King 2014-06-02 13:58:01 -04:00
parent 4207b3a3bb
commit eaafe756d5
1 changed files with 132 additions and 110 deletions

View File

@ -465,168 +465,190 @@ with an explicit target.
Style Style
----- -----
1) Style: Command Signatures
Command signatures should be marked up as plain literal blocks, not as ^^^^^^^^^^^^^^^^^^^^^^^^^
cmake ``code-blocks``.
2) Command signatures should be marked up as plain literal blocks, not as
Signatures are separated from preceding content by a horizontal cmake ``code-blocks``.
line. That is, use:
.. code-block:: rst Signatures are separated from preceding content by a horizontal
line. That is, use:
... preceding paragraph. .. code-block:: rst
--------------------------------------------------------------------- ... preceding paragraph.
:: ---------------------------------------------------------------------
add_library(<lib> ...) ::
This signature is used for ... add_library(<lib> ...)
3) This signature is used for ...
Use "``OFF``" and "``ON``" for boolean values which can be modified by
the user, such as :prop_tgt:`POSITION_INDEPENDENT_CODE`. Such properties
may be "enabled" and "disabled". Use "``True``" and "``False``" for
inherent values which can't be modified after being set, such as the
:prop_tgt:`IMPORTED` property of a build target.
4) Style: Boolean Constants
Use two spaces for indentation. Use two spaces between sentences in ^^^^^^^^^^^^^^^^^^^^^^^^
prose.
5) Use "``OFF``" and "``ON``" for boolean values which can be modified by
Prefer to mark the start of literal blocks with ``::`` at the end of the user, such as :prop_tgt:`POSITION_INDEPENDENT_CODE`. Such properties
the preceding paragraph. In cases where the following block gets may be "enabled" and "disabled". Use "``True``" and "``False``" for
a ``code-block`` marker, put a single ``:`` at the end of the preceding inherent values which can't be modified after being set, such as the
paragraph. :prop_tgt:`IMPORTED` property of a build target.
6) Style: Whitespace
Prefer to restrict the width of lines to 75-80 columns. This is not a ^^^^^^^^^^^^^^^^^
hard restriction, but writing new paragraphs wrapped at 75 columns
allows space for adding minor content without significant re-wrapping of
content.
7) Use two spaces for indentation. Use two spaces between sentences in
Mark up self-references with ``inline-literal`` syntax. For example, prose.
within the add_executable command documentation, use
.. code-block:: rst Style: Starting Literal Blocks
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``add_executable`` Prefer to mark the start of literal blocks with ``::`` at the end of
the preceding paragraph. In cases where the following block gets
a ``code-block`` marker, put a single ``:`` at the end of the preceding
paragraph.
not Style: Line Length
^^^^^^^^^^^^^^^^^^
.. code-block:: rst Prefer to restrict the width of lines to 75-80 columns. This is not a
hard restriction, but writing new paragraphs wrapped at 75 columns
allows space for adding minor content without significant re-wrapping of
content.
:command:`add_executable` Style: Document Self-References
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
which is used elsewhere. Mark up self-references with ``inline-literal`` syntax. For example,
within the add_executable command documentation, use
8) .. code-block:: rst
Mark up all other linkable references as links, including repeats. An
alternative, which is used by wikipedia (`<http://en.wikipedia.org/wiki/WP:REPEATLINK>`_),
is to link to a reference only once per article. That style is not used
in CMake documentation.
9) ``add_executable``
Mark up references to keywords in signatures, file names, and other
technical terms with ``inline-literl`` syntax, for example:
.. code-block:: rst not
If ``WIN32`` is used with :command:`add_executable`, the .. code-block:: rst
:prop_tgt:`WIN32_EXECUTABLE` target property is enabled. That command
creates the file ``<name>.exe`` on Windows.
:command:`add_executable`
10) which is used elsewhere.
If referring to a concept which corresponds to a property, and that
concept is described in a high-level manual, prefer to link to the
manual section instead of the property. For example:
.. code-block:: rst Style: Linkable References
^^^^^^^^^^^^^^^^^^^^^^^^^^
This command creates an :ref:`Imported Target <Imported Targets>`. Mark up all other linkable references as links, including repeats. An
alternative, which is used by wikipedia (`<http://en.wikipedia.org/wiki/WP:REPEATLINK>`_),
is to link to a reference only once per article. That style is not used
in CMake documentation.
instead of: Style: Technical Terms
^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: rst Mark up references to keywords in signatures, file names, and other
technical terms with ``inline-literl`` syntax, for example:
This command creates an :prop_tgt:`IMPORTED` target. .. code-block:: rst
The latter should be used only when referring specifically to the If ``WIN32`` is used with :command:`add_executable`, the
property. :prop_tgt:`WIN32_EXECUTABLE` target property is enabled. That command
creates the file ``<name>.exe`` on Windows.
References to manual sections are not automatically created by creating Style: Referencing Concepts
a section, but code such as: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: rst If referring to a concept which corresponds to a property, and that
concept is described in a high-level manual, prefer to link to the
manual section instead of the property. For example:
.. _`Imported Targets`: .. code-block:: rst
creates a suitable anchor. Use an anchor name which matches the name This command creates an :ref:`Imported Target <Imported Targets>`.
of the corresponding section. Refer to the anchor using a
cross-reference with specified text.
Imported Targets need the ``IMPORTED`` term marked up with care in instead of:
particular because the term may refer to a command keyword
(``IMPORTED``), a target property (:prop_tgt:`IMPORTED`), or a
concept (:ref:`Imported Targets`).
11) .. code-block:: rst
Where a property, command or variable is related conceptually to others,
by for example, being related to the buildsystem description, generator
expressions or Qt, each relevant property, command or variable should
link to the primary manual, which provides high-level information. Only
particular information relating to the command should be in the
documentation of the command.
12) This command creates an :prop_tgt:`IMPORTED` target.
When marking section titles, make the section decoration line as long as
the title text. Use only a line below the title, not above. For
example:
.. code-block:: rst The latter should be used only when referring specifically to the
property.
Title Text References to manual sections are not automatically created by creating
---------- a section, but code such as:
Capitalize the first letter of each non-minor word in the title. .. code-block:: rst
13) .. _`Imported Targets`:
When referring to properties, variables, commands etc, prefer to link
to the target object and follow that with the type of object it is.
For example:
.. code-block:: rst creates a suitable anchor. Use an anchor name which matches the name
of the corresponding section. Refer to the anchor using a
cross-reference with specified text.
Set the :prop_tgt:`AUTOMOC` target property to ``ON``. Imported Targets need the ``IMPORTED`` term marked up with care in
particular because the term may refer to a command keyword
(``IMPORTED``), a target property (:prop_tgt:`IMPORTED`), or a
concept (:ref:`Imported Targets`).
Instead of Where a property, command or variable is related conceptually to others,
by for example, being related to the buildsystem description, generator
expressions or Qt, each relevant property, command or variable should
link to the primary manual, which provides high-level information. Only
particular information relating to the command should be in the
documentation of the command.
.. code-block:: rst Style: Section Titles
^^^^^^^^^^^^^^^^^^^^^
Set the target property :prop_tgt:`AUTOMOC` to ``ON``. When marking section titles, make the section decoration line as long as
the title text. Use only a line below the title, not above. For
example:
The ``policy`` directive is an exception, and the type us usually .. code-block:: rst
referred to before the link:
.. code-block:: rst Title Text
----------
If policy :prop_tgt:`CMP0022` is set to ``NEW`` the behavior is ... Capitalize the first letter of each non-minor word in the title.
14) Style: Referencing CMake Domain Objects
Signatures of commands should wrap optional parts with square brackets, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
and should mark list of optional arguments with an ellipsis (``...``).
Elements of the signature which are specified by the user should be
specified with angle brackets, and may be referred to in prose using
``inline-literal`` syntax.
15) When referring to properties, variables, commands etc, prefer to link
Use American English spellings in prose. to the target object and follow that with the type of object it is.
For example:
.. code-block:: rst
Set the :prop_tgt:`AUTOMOC` target property to ``ON``.
Instead of
.. code-block:: rst
Set the target property :prop_tgt:`AUTOMOC` to ``ON``.
The ``policy`` directive is an exception, and the type us usually
referred to before the link:
.. code-block:: rst
If policy :prop_tgt:`CMP0022` is set to ``NEW`` the behavior is ...
Style: Command Signature Markup
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Signatures of commands should wrap optional parts with square brackets,
and should mark list of optional arguments with an ellipsis (``...``).
Elements of the signature which are specified by the user should be
specified with angle brackets, and may be referred to in prose using
``inline-literal`` syntax.
Style: Prose
^^^^^^^^^^^^
Use American English spellings in prose.
Modules Modules
======= =======