blob: d0557119fbff2a034d6aeef9df434c8bbee3337b [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001.. highlightlang:: rest
2
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +00003Style guide
Georg Brandl116aa622007-08-15 14:28:22 +00004===========
5
6The Python documentation should follow the `Apple Publications Style Guide`_
7wherever possible. This particular style guide was selected mostly because it
8seems reasonable and is easy to get online.
9
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000010Topics which are either not covered in Apple's style guide or treated
11differently in Python documentation will be discussed in this
12document.
13
14Use of whitespace
15-----------------
Georg Brandl116aa622007-08-15 14:28:22 +000016
17All reST files use an indentation of 3 spaces. The maximum line length is 80
18characters for normal text, but tables, deeply indented code samples and long
19links may extend beyond that.
20
21Make generous use of blank lines where applicable; they help grouping things
22together.
23
24A sentence-ending period may be followed by one or two spaces; while reST
25ignores the second space, it is customarily put in by some users, for example
26to aid Emacs' auto-fill mode.
27
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000028Footnotes
29---------
30
Georg Brandl116aa622007-08-15 14:28:22 +000031Footnotes are generally discouraged, though they may be used when they are the
32best way to present specific information. When a footnote reference is added at
33the end of the sentence, it should follow the sentence-ending punctuation. The
34reST markup should appear something like this::
35
36 This sentence has a footnote reference. [#]_ This is the next sentence.
37
38Footnotes should be gathered at the end of a file, or if the file is very long,
39at the end of a section. The docutils will automatically create backlinks to
40the footnote reference.
41
42Footnotes may appear in the middle of sentences where appropriate.
43
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000044Capitalization
45--------------
46
47.. sidebar:: Sentence case
48
49 Sentence case is a set of capitalization rules used in English
50 sentences: the first word is always capitalized and other words are
51 only capitalized if there is a specific rule requiring it.
52
53Apple style guide recommends the use of title case in section titles.
54However, rules for which words should be capitalized in title case
55vary greaty between publications.
56
57In Python documentation, use of sentence case in section titles is
58preferable, but consistency within a unit is more important than
59following this rule. If you add a section to the chapter where most
60sections are in title case you can either convert all titles to
61sentence case or use the dominant style in the new section title.
62
63Sentences that start with a word for which specific rules require
64starting it with a lower case letter should be avoided in titles and
65elsewhere.
66
67.. note::
68
69 Sections that describe a library module often have titles in the
70 form of "modulename --- Short description of the module." In this
71 case, the description should be capitalized as a stand-alone
72 sentence.
73
Georg Brandl116aa622007-08-15 14:28:22 +000074Many special names are used in the Python documentation, including the names of
75operating systems, programming languages, standards bodies, and the like. Most
76of these entities are not assigned any special markup, but the preferred
77spellings are given here to aid authors in maintaining the consistency of
78presentation in the Python documentation.
79
80Other terms and words deserve special mention as well; these conventions should
81be used to ensure consistency throughout the documentation:
82
83CPU
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000084 For "central processing unit." Many style guides say this should be
85 spelled out on the first use (and if you must use it, do so!). For
86 the Python documentation, this abbreviation should be avoided since
87 there's no reasonable way to predict which occurrence will be the
88 first seen by the reader. It is better to use the word "processor"
89 instead.
Georg Brandl116aa622007-08-15 14:28:22 +000090
91POSIX
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000092 The name assigned to a particular group of standards. This is always
93 uppercase.
Georg Brandl116aa622007-08-15 14:28:22 +000094
95Python
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +000096 The name of our favorite programming language is always capitalized.
97
98reST
99 For "reStructuredText," an easy to read, plaintext markup syntax
100 used to produce Python documentation. When spelled out, it is
101 always one word and both forms start with a lower case 'r'.
Georg Brandl116aa622007-08-15 14:28:22 +0000102
103Unicode
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +0000104 The name of a character coding system. This is always written
105 capitalized.
Georg Brandl116aa622007-08-15 14:28:22 +0000106
107Unix
Alexander Belopolskyea3e91e2010-11-11 22:43:45 +0000108 The name of the operating system developed at AT&T Bell Labs in the early
109 1970s.
Georg Brandl116aa622007-08-15 14:28:22 +0000110
111
Georg Brandl386bc6d2010-04-25 10:19:53 +0000112.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf
Georg Brandl116aa622007-08-15 14:28:22 +0000113