Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Fix highlighting in examples #195

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ straightforward it is to get up and running with it.
.. literalinclude:: ../../example/basic.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/basic.py``
:emphasize-lines: 5,16-19
:emphasize-lines: 3,14-17

.. note::

The only thing you're adding to your script to take advantage of
``reverse_argparse`` is lines 7 and 19--22.
``reverse_argparse`` is lines 3 and 14--17.

Running the script, and passing an argument to it, yields the following:

Expand All @@ -37,8 +38,9 @@ arguments, but this time with default values.
.. literalinclude:: ../../example/default_values.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/default_values.py``
:emphasize-lines: 10-11
:emphasize-lines: 8-9

Now running the script with the same command line arguments yields:

Expand All @@ -54,8 +56,9 @@ will be translated to an absolute path behind the scenes.
.. literalinclude:: ../../example/relative_references.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/relative_references.py``
:emphasize-lines: 3,13
:emphasize-lines: 1,11

Now running the script and pointing to a file in your current working directory
yields:
Expand All @@ -73,8 +76,9 @@ standard format.
.. literalinclude:: ../../example/post_processing.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/post_processing.py``
:emphasize-lines: 6,16,20-21
:emphasize-lines: 4,14,18-19

Now running the script and specifying a relative date/time yields:

Expand All @@ -92,8 +96,9 @@ different flags and corresponding values are.
.. literalinclude:: ../../example/pretty_printing.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/pretty_printing.py``
:emphasize-lines: 28
:emphasize-lines: 26

Now running the script and specifying a relative date/time yields:

Expand All @@ -114,8 +119,9 @@ shows the subtle difference.
.. literalinclude:: ../../example/subparsers.py
:language: python
:linenos:
:lines: 10-
:caption: ``example/subparsers.py``
:emphasize-lines: 11-18
:emphasize-lines: 9-19

Running this script and using the ``foo`` subcommand yields:

Expand Down
Loading