Skip to content

Commit

Permalink
Merge pull request #195 from sandialabs/194-fix-highlighting-in-examples
Browse files Browse the repository at this point in the history
docs: Fix highlighting in examples
  • Loading branch information
jmgate authored Sep 16, 2024
2 parents 6604b15 + 149e48c commit 25527b5
Showing 1 changed file with 13 additions and 7 deletions.
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

0 comments on commit 25527b5

Please sign in to comment.