mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #28343 -- Add an OS chooser for docs command line examples.
This commit is contained in:
parent
a22ef3bb37
commit
37c17846ad
29 changed files with 1399 additions and 90 deletions
|
@ -39,7 +39,7 @@ At this point, you can work on the code. Use ``git rebase -i`` and ``git
|
|||
commit --amend`` to make sure the commits have the expected level of quality.
|
||||
Once you're ready:
|
||||
|
||||
.. code-block:: console
|
||||
.. console::
|
||||
|
||||
$ # Pull in the latest changes from master.
|
||||
$ git checkout master
|
||||
|
|
|
@ -90,7 +90,7 @@ Imports
|
|||
|
||||
Quick start:
|
||||
|
||||
.. code-block:: console
|
||||
.. console::
|
||||
|
||||
$ pip install isort
|
||||
$ isort -rc .
|
||||
|
|
|
@ -53,7 +53,7 @@ To simplify the process of providing optimized JavaScript code, Django
|
|||
includes a handy Python script which should be used to create a "minified"
|
||||
version. To run it:
|
||||
|
||||
.. code-block:: console
|
||||
.. console::
|
||||
|
||||
$ pip install closure
|
||||
$ python django/contrib/admin/bin/compress.py
|
||||
|
@ -134,13 +134,13 @@ To run the tests from the command line, you need to have `Node.js`_ installed.
|
|||
After installing `Node.js`, install the JavaScript test dependencies by running
|
||||
the following from the root of your Django checkout:
|
||||
|
||||
.. code-block:: console
|
||||
.. console::
|
||||
|
||||
$ npm install
|
||||
|
||||
Then run the tests with:
|
||||
|
||||
.. code-block:: console
|
||||
.. console::
|
||||
|
||||
$ npm test
|
||||
|
||||
|
|
|
@ -269,6 +269,50 @@ docs defines some extra description units:
|
|||
|
||||
:ticket:`12345`
|
||||
|
||||
Django's documentation uses a custom ``console`` directive for documenting
|
||||
command-line examples involving ``django-admin.py``, ``manage.py``, ``python``,
|
||||
etc.). In the HTML documentation, it renders a two-tab UI, with one tab showing
|
||||
a Unix-style command prompt and a second tab showing a Windows prompt.
|
||||
|
||||
For example, you can replace this fragment::
|
||||
|
||||
use this command:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py shell
|
||||
|
||||
with this one::
|
||||
|
||||
use this command:
|
||||
|
||||
.. console::
|
||||
|
||||
$ python manage.py shell
|
||||
|
||||
Notice two things:
|
||||
|
||||
* You usually will replace occurrences of the ``.. code-block:: console``
|
||||
directive.
|
||||
* You don't need to change the actual content of the code example. You still
|
||||
write it assuming a Unix-y environment (i.e. a ``'$'`` prompt symbol,
|
||||
``'/'`` as filesystem path components separator, etc.)
|
||||
|
||||
The example above will render a code example block with two tabs. The first
|
||||
one will show:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ python manage.py shell
|
||||
|
||||
(No changes from what ``.. code-block:: console`` would have rendered).
|
||||
|
||||
The second one will show:
|
||||
|
||||
.. code-block:: doscon
|
||||
|
||||
...\> py manage.py shell
|
||||
|
||||
.. _documenting-new-features:
|
||||
|
||||
Documenting new features
|
||||
|
@ -337,7 +381,7 @@ AdvanceCOMP's ``advpng``:
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
$ cd docs/
|
||||
$ cd docs
|
||||
$ optipng -o7 -zm1-9 -i0 -strip all `find . -type f -not -path "./_build/*" -name "*.png"`
|
||||
$ advpng -z4 `find . -type f -not -path "./_build/*" -name "*.png"`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue