Skip to content

Commit d4abefc

Browse files
author
Kenneth Reitz
committed
Merge pull request realpython#297 from kuyan/master
Formatting, code highlighting fixes.
2 parents a59c581 + 9072b68 commit d4abefc

File tree

13 files changed

+95
-76
lines changed

13 files changed

+95
-76
lines changed

docs/dev/env.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Vim is a text editor which uses keyboard shortcuts for editing instead of menus
1616
or icons. There exist a couple of plugins and settings for the VIM editor to
1717
aid Python development. If you only develop in Python, a good start is to set
1818
the default settings for indentation and line-wrapping to values compliant with
19-
`PEP 8 <http://www.python.org/dev/peps/pep-0008/>`_. In your home directory,
20-
open a file called `.vimrc` and add the following lines:::
19+
:pep:`8`. In your home directory, open a file called `.vimrc` and add the
20+
following lines:::
2121

2222
set textwidth=79 " lines longer than 79 columns will be broken
2323
set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns
@@ -113,12 +113,14 @@ scripters and novice users alike."
113113
Sublime Text
114114
------------
115115

116-
"`Sublime Text <http://www.sublimetext.com/>`_ is a sophisticated text editor
117-
for code, html and prose. You'll love the slick user interface and
118-
extraordinary features."
116+
`Sublime Text <http://www.sublimetext.com/>`_ is a sophisticated text
117+
editor for code, markup and prose. You'll love the slick user interface,
118+
extraordinary features and amazing performance.
119119

120120
Sublime Text has excellent support for editing Python code and uses Python for
121-
its plugin API.
121+
its plugin API. It also has plugins a diverse variety of plugins, `some of which <https://github.com/SublimeLinter/SublimeLinter>`_
122+
allow for in-editor PEP8 checking and code "linting".
123+
122124

123125
IDEs
124126
::::

docs/intro/community.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ PEPs
2727
PEPs are *Python Enhancement Proposals*. They describe changes to Python itself,
2828
or the standards around it.
2929

30-
There are three different types of PEPs (as defined by `PEP1 <http://www.python.org/dev/peps/pep-0001/>`_):
30+
There are three different types of PEPs (as defined by :pep:`1`):
3131

3232
**Standards**
3333
Describes a new feature or implementation.
@@ -45,13 +45,13 @@ Notable PEPs
4545

4646
There are a few PEPs that could be considered required reading:
4747

48-
- `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_: The Python Style Guide.
48+
- :pep:`8`: The Python Style Guide.
4949
Read this. All of it. Follow it.
5050

51-
- `PEP20 <http://www.python.org/dev/peps/pep-0020/>`_: The Zen of Python.
51+
- :pep:`20`: The Zen of Python.
5252
A list of 19 statements that briefly explain the philosophy behind Python.
5353

54-
- `PEP257 <http://www.python.org/dev/peps/pep-0257/>`_: Docstring Conventions.
54+
- :pep:`257`: Docstring Conventions.
5555
Gives guidelines for semantics and conventions associated with Python
5656
docstrings.
5757

docs/intro/duction.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ whether they're an old hand or a first-time Pythonista, and the authors to
8282
the Guide will gladly help if you have any questions about the
8383
appropriateness, completeness, or accuracy of a contribution.
8484

85-
To get started working on The Hitchhiker's Guide, see
86-
the: doc:`/notes/contribute` page.
85+
To get started working on The Hitchhiker's Guide, see the :doc:`/notes/contribute` page.
8786

8887

docs/intro/learning.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Python Koans
6565

6666
Python Koans is a port of Edgecase's Ruby Koans. It uses a test-driven
6767
approach, q.v. TEST DRIVEN DESIGN SECTION to provide an interactive tutorial
68-
teaching basic python concepts. By fixing assertion statements that fail in a
68+
teaching basic python concepts. By fixing assertion statements that fail in a
6969
test script, this provides sequential steps to learning python.
7070

7171
For those used to languages and figuring out puzzles on their own, this can be
@@ -105,7 +105,7 @@ is focused on the more advanced crowd.
105105

106106
It starts with topics like decorators (with caching, proxy, and context manager
107107
case-studies), method resolution order, using super() and meta-programming, and
108-
general PEP8 best practices.
108+
general :pep:`8` best practices.
109109

110110
It has a detailed, multi-chapter case study on writing and releasing a package
111111
and eventually an application, including a chapter on using zc.buildout. Later

docs/notes/license.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
=======
12
License
2-
-------
3+
=======
34

4-
.. todo:: Determine License
5+
The Guide is licensed under the `Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license <https://creativecommons.org/licenses/by-nc-sa/3.0/>`_.

docs/notes/styleguide.rst

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,32 @@ Headings
3939

4040
Use the following styles for headings.
4141

42-
Chapter title::
42+
Chapter title:
43+
44+
.. code-block:: rest
4345
4446
#########
4547
Chapter 1
4648
#########
4749
48-
Page title::
50+
Page title:
51+
52+
.. code-block:: rest
4953
5054
===================
5155
Time is an Illusion
5256
===================
5357
54-
Section headings::
58+
Section headings:
59+
60+
.. code-block:: rest
5561
5662
Lunchtime Doubly So
5763
-------------------
5864
59-
Sub section headings::
65+
Sub section headings:
66+
67+
.. code-block:: rest
6068
6169
Very Deep
6270
~~~~~~~~~
@@ -74,7 +82,9 @@ Code Examples
7482

7583
Wrap all code examples at 70 characters to avoid horizontal scrollbars.
7684

77-
Command line examples::
85+
Command line examples:
86+
87+
.. code-block:: rest
7888
7989
.. code-block:: console
8090
@@ -83,15 +93,19 @@ Command line examples::
8393
8494
Be sure to include the ``$`` prefix before each line.
8595

86-
Python interpreter examples::
96+
Python interpreter examples:
97+
98+
.. code-block:: rest
8799
88100
Label the example::
89101
90102
.. code-block:: python
91103
92104
>>> import this
93105
94-
Python examples::
106+
Python examples:
107+
108+
.. code-block:: rest
95109
96110
Descriptive title::
97111
@@ -103,16 +117,20 @@ Python examples::
103117
Externally Linking
104118
------------------
105119

106-
* Prefer labels for well known subjects (ex: proper nouns) when linking::
120+
* Prefer labels for well known subjects (ex: proper nouns) when linking:
121+
122+
.. code-block:: rest
107123
108-
Sphinx_ is used to document Python.
124+
Sphinx_ is used to document Python.
109125
110-
.. _Sphinx: http://sphinx.pocoo.org
126+
.. _Sphinx: http://sphinx.pocoo.org
111127
112128
* Prefer to use descriptive labels with inline links instead of leaving bare
113-
links::
129+
links:
130+
131+
.. code-block:: rest
114132
115-
Read the `Sphinx Tutorial <http://sphinx.pocoo.org/tutorial.html>`_
133+
Read the `Sphinx Tutorial <http://sphinx.pocoo.org/tutorial.html>`_
116134
117135
* Avoid using labels such as "click here", "this", etc. preferring
118136
descriptive labels (SEO worthy) instead.
@@ -124,7 +142,9 @@ To cross-reference other parts of this documentation, use the `:ref:
124142
<http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>`_
125143
keyword and labels.
126144

127-
To make reference labels more clear and unique, always add a ``-ref`` suffix::
145+
To make reference labels more clear and unique, always add a ``-ref`` suffix:
146+
147+
.. code-block:: rest
128148
129149
.. _some-section-ref:
130150
@@ -137,14 +157,18 @@ Notes and Warnings
137157
Make use of the appropriate `admonitions directives
138158
<http://sphinx.pocoo.org/rest.html#directives>`_ when making notes.
139159

140-
Notes::
160+
Notes:
161+
162+
.. code-block:: rest
141163
142164
.. note::
143165
The Hitchhiker’s Guide to the Galaxy has a few things to say
144166
on the subject of towels. A towel, it says, is about the most
145167
massively useful thing an interstellar hitch hiker can have.
146168
147-
Warnings::
169+
Warnings:
170+
171+
.. code-block:: rest
148172
149173
.. warning:: DON'T PANIC
150174
@@ -156,7 +180,7 @@ Please mark any incomplete areas of The Guide with a `todo directive
156180
avoid cluttering the :ref:`todo-list-ref`, use a single ``todo`` for stub
157181
documents or large incomplete sections.
158182

159-
::
183+
.. code-block:: rest
160184
161185
.. todo::
162186
Learn the Ultimate Answer to the Ultimate Question

docs/scenarios/db.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ DB-API
55
------
66

77
The Python Database API (DB-API) defines a standard interface for Python
8-
database access modules. It's documented in `PEP 249 <http://www.python.org/dev/peps/pep-0249/>`_.
8+
database access modules. It's documented in :pep:`249`.
99
Nearly all Python database modules such as `sqlite3`, `psycopg` and
1010
`mysql-python` conform to this interface.
1111

docs/scenarios/imaging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The `Python Imaging Library <http://www.pythonware.com/products/pil/>`_, or PIL
1212
for short, is *the* library for image manipulation in Python. Unfortunately, its
1313
development has stagnated, with its last release in 2009.
1414

15-
Lucky for you, there's an actively-developed fork of PIL called `Pillow <http://python-imaging.github.io/>`_ -
15+
Luckily for you, there's an actively-developed fork of PIL called `Pillow <http://python-imaging.github.io/>`_ -
1616
it's easier to install, runs on all operating systems, and supports Python 3.
1717

1818
Installation

docs/scenarios/web.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface between web servers and Python web application frameworks. By
1818
standardizing behavior and communication between web servers and Python web
1919
frameworks, WSGI makes it possible to write portable Python web code that
2020
can be deployed in any :ref:`WSGI-compliant web server <wsgi-servers-ref>`.
21-
WSGI is documented in `PEP-3333 <http://www.python.org/dev/peps/pep-3333/>`_.
21+
WSGI is documented in :pep:`3333`.
2222

2323

2424
Frameworks

docs/writing/documentation.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ In Python, *docstrings* describe modules, classes, and functions: ::
104104
"""Returns the square root of self times self."""
105105
...
106106

107-
In general, follow the `comment section of PEP 0008`_ (the "Python Style Guide").
108-
109-
.. _comment section of PEP 0008: http://www.python.org/dev/peps/pep-0008/#comments
107+
In general, follow the comment section of :pep:`8#comments` (the "Python Style Guide").
110108

111109
Commenting Sections of Code
112110
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -137,9 +135,7 @@ operation of the function or class: ::
137135
"""Returns the square root of self times self."""
138136
...
139137

140-
.. seealso:: Further reading on docstrings: `PEP 0257`_
141-
142-
.. _PEP 0257: http://www.python.org/dev/peps/pep-0257/
138+
.. seealso:: Further reading on docstrings: :pep:`257`
143139

144140

145141
Other Tools

0 commit comments

Comments
 (0)