Skip to content

docs: Refactor with more_autodoc.typehints and built-in type links #42

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

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@
"sphinxcontrib_trio",
"enum_tools.autoenum",
"sphinxext.opengraph",
"sphinx_toolbox.more_autodoc.typehints",
]

intersphinx_mapping = {
"py": ("https://docs.python.org/3", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
2 changes: 1 addition & 1 deletion docs/source/generate_style_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def generate_style_list():
last_col_heading=False,
style=styles[style],
)
style_heading = f"`{style}`\n" + "~" * len(f"`{style}`")
style_heading = f".. _PresetStyle.{style}:\n\n`{style}`\n" + "~" * len(f"`{style}`")
output_example = indent_all_lines(full + "\n\n" + body_only)
style_list += f"{style_heading}\n\n.. code-block:: none\n\n{output_example}\n\n"
# put it all together
Expand Down
54 changes: 54 additions & 0 deletions docs/source/styles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Preset styles

.. contents::

.. _PresetStyle.ascii:

`ascii`
~~~~~~~

Expand All @@ -26,6 +28,8 @@ Preset styles
| 2 | 30 40 35 30 |
+---+-------------------+

.. _PresetStyle.ascii_borderless:

`ascii_borderless`
~~~~~~~~~~~~~~~~~~

Expand All @@ -41,6 +45,8 @@ Preset styles
1 | 30 40 35 30
2 | 30 40 35 30

.. _PresetStyle.ascii_box:

`ascii_box`
~~~~~~~~~~~

Expand All @@ -62,6 +68,8 @@ Preset styles
| 2 | 30 | 40 | 35 | 30 |
+---+----+----+----+----+

.. _PresetStyle.ascii_compact:

`ascii_compact`
~~~~~~~~~~~~~~~

Expand All @@ -81,6 +89,8 @@ Preset styles
| 2 | 30 40 35 30 |
+---+-------------------+

.. _PresetStyle.ascii_double:

`ascii_double`
~~~~~~~~~~~~~~

Expand All @@ -102,6 +112,8 @@ Preset styles
| 2 | 30 40 35 30 |
+---+-------------------+

.. _PresetStyle.ascii_minimalist:

`ascii_minimalist`
~~~~~~~~~~~~~~~~~~

Expand All @@ -123,6 +135,8 @@ Preset styles
2 | 30 40 35 30
-----------------------

.. _PresetStyle.ascii_simple:

`ascii_simple`
~~~~~~~~~~~~~~

Expand All @@ -142,6 +156,8 @@ Preset styles
2 | 30 40 35 30
=== ==== ==== ==== ====

.. _PresetStyle.borderless:

`borderless`
~~~~~~~~~~~~

Expand All @@ -157,6 +173,8 @@ Preset styles
1 ┃ 30 40 35 30
2 ┃ 30 40 35 30

.. _PresetStyle.double:

`double`
~~~~~~~~

Expand All @@ -178,6 +196,8 @@ Preset styles
║ 2 ║ 30 40 35 30 ║
╚═══╩═══════════════════╝

.. _PresetStyle.double_box:

`double_box`
~~~~~~~~~~~~

Expand All @@ -199,6 +219,8 @@ Preset styles
║ 2 ║ 30 ║ 40 ║ 35 ║ 30 ║
╚═══╩════╩════╩════╩════╝

.. _PresetStyle.double_compact:

`double_compact`
~~~~~~~~~~~~~~~~

Expand All @@ -218,6 +240,8 @@ Preset styles
║ 2 ║ 30 40 35 30 ║
╚═══╩═══════════════════╝

.. _PresetStyle.double_thin_compact:

`double_thin_compact`
~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -237,6 +261,8 @@ Preset styles
║ 2 ║ 30 40 35 30 ║
╚═══╩═══════════════════╝

.. _PresetStyle.markdown:

`markdown`
~~~~~~~~~~

Expand All @@ -252,6 +278,8 @@ Preset styles
| 1 | 30 | 40 | 35 | 30 |
| 2 | 30 | 40 | 35 | 30 |

.. _PresetStyle.minimalist:

`minimalist`
~~~~~~~~~~~~

Expand All @@ -273,6 +301,8 @@ Preset styles
2 │ 30 40 35 30
───────────────────────

.. _PresetStyle.simple:

`simple`
~~~~~~~~

Expand All @@ -292,6 +322,8 @@ Preset styles
2 ║ 30 40 35 30
═══ ════ ════ ════ ════

.. _PresetStyle.thick:

`thick`
~~~~~~~

Expand All @@ -313,6 +345,8 @@ Preset styles
┃ 2 ┃ 30 40 35 30 ┃
┗━━━┻━━━━━━━━━━━━━━━━━━━┛

.. _PresetStyle.thick_box:

`thick_box`
~~~~~~~~~~~

Expand All @@ -334,6 +368,8 @@ Preset styles
┃ 2 ┃ 30 ┃ 40 ┃ 35 ┃ 30 ┃
┗━━━┻━━━━┻━━━━┻━━━━┻━━━━┛

.. _PresetStyle.thick_compact:

`thick_compact`
~~~~~~~~~~~~~~~

Expand All @@ -353,6 +389,8 @@ Preset styles
┃ 2 ┃ 30 40 35 30 ┃
┗━━━┻━━━━━━━━━━━━━━━━━━━┛

.. _PresetStyle.thin:

`thin`
~~~~~~

Expand All @@ -374,6 +412,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
└───┴───────────────────┘

.. _PresetStyle.thin_box:

`thin_box`
~~~~~~~~~~

Expand All @@ -395,6 +435,8 @@ Preset styles
│ 2 │ 30 │ 40 │ 35 │ 30 │
└───┴────┴────┴────┴────┘

.. _PresetStyle.thin_compact:

`thin_compact`
~~~~~~~~~~~~~~

Expand All @@ -414,6 +456,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
└───┴───────────────────┘

.. _PresetStyle.thin_compact_rounded:

`thin_compact_rounded`
~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -433,6 +477,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
╰───┴───────────────────╯

.. _PresetStyle.thin_double:

`thin_double`
~~~~~~~~~~~~~

Expand All @@ -454,6 +500,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
└───┴───────────────────┘

.. _PresetStyle.thin_double_rounded:

`thin_double_rounded`
~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -475,6 +523,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
╰───┴───────────────────╯

.. _PresetStyle.thin_rounded:

`thin_rounded`
~~~~~~~~~~~~~~

Expand All @@ -496,6 +546,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
╰───┴───────────────────╯

.. _PresetStyle.thin_thick:

`thin_thick`
~~~~~~~~~~~~

Expand All @@ -517,6 +569,8 @@ Preset styles
│ 2 │ 30 40 35 30 │
└───┴───────────────────┘

.. _PresetStyle.thin_thick_rounded:

`thin_thick_rounded`
~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions table2ascii/table_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def from_string(cls, string: str) -> "TableStyle":
Create a TableStyle from a string

Args:
string (:class:`str`): The string to create the TableStyle from
string: The string to create the TableStyle from

Returns:
:class:`TableStyle`: A TableStyle object
A TableStyle object

Example::

Expand Down
Loading