Skip to content

Commit

Permalink
Add regex module to more_autodoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Sep 22, 2020
1 parent 059b49e commit 1892aee
Show file tree
Hide file tree
Showing 14 changed files with 1,505 additions and 12 deletions.
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ known_third_party =
github
html5lib
hypothesis
importlib_resources
pprint36
pytest
pytest_cov
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ include __pkginfo__.py
include LICENSE
include requirements.txt
prune **/__pycache__
include sphinx_toolbox/more_autodoc/regex.css
recursive-include sphinx_toolbox *.pyi
include sphinx_toolbox/py.typed
32 changes: 32 additions & 0 deletions doc-source/extensions/more_autodoc/regex.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
==========================================
:mod:`~sphinx_toolbox.more_autodoc.regex`
==========================================

.. automodule:: sphinx_toolbox.more_autodoc.regex
:noindex:
:no-autosummary:
:no-members:


API Reference
--------------

.. automodulesumm:: sphinx_toolbox.more_autodoc.regex
:member-order: bysource

.. autoclass:: sphinx_toolbox.more_autodoc.regex.RegexDocumenter

.. autoclass:: sphinx_toolbox.more_autodoc.regex.RegexParser
:exclude-members: AT_COLOUR,SUBPATTERN_COLOUR,IN_COLOUR,REPEAT_COLOUR,REPEAT_BRACE_COLOUR,CATEGORY_COLOUR,BRANCH_COLOUR,LITERAL_COLOUR,ANY_COLOUR

.. autoclass:: sphinx_toolbox.more_autodoc.regex.TerminalRegexParser
:no-members:

.. autoclass:: sphinx_toolbox.more_autodoc.regex.HTMLRegexParser
:no-members:

.. automodule:: sphinx_toolbox.more_autodoc.regex
:no-docstring:
:no-autosummary:
:members: parse_regex_flags,no_formatting,span,setup
:member-order: bysource
3 changes: 3 additions & 0 deletions repo_helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ extra_sphinx_extensions:

sphinx_conf_epilogue:
- hide_none_rtype = True

manifest_additional:
- include sphinx_toolbox/more_autodoc/regex.css
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ beautifulsoup4>=4.9.1
docutils>=0.16
domdf_python_tools>=0.8.0
html5lib>=1.1
importlib_resources>=3.0.0
requests>=2.24.0
sphinx>=3.0.3
sphinx-autodoc-typehints==1.11.0
Expand Down
1 change: 1 addition & 0 deletions sphinx_toolbox/more_autodoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def setup(app: Sphinx) -> SphinxExtMetadata:
app.setup_extension("sphinx_toolbox.more_autodoc.variables")
app.setup_extension("sphinx_toolbox.more_autodoc.sourcelink")
app.setup_extension("sphinx_toolbox.more_autodoc.no_docstring")
app.setup_extension("sphinx_toolbox.more_autodoc.regex")

return {
"version": __version__,
Expand Down
51 changes: 51 additions & 0 deletions sphinx_toolbox/more_autodoc/regex.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
span.regex_literal {
color: dimgrey;
}

span.regex_at {
/*color: rgb(204, 120, 50)*/
color: orangered;
}

span.regex_repeat_brace {
/*color: rgb(204, 120, 50)*/
color: orangered;
}

span.regex_branch {
/*color: rgb(204, 120, 50)*/
color: orangered;
}

span.regex_subpattern {
/*color: indianred !* rgb(255, 150, 50) *!*/
color: dodgerblue /* rgb(255, 150, 50) */
}

span.regex_in {
/*color: rgb(255, 150, 50)*/
color: darkorange
}

span.regex_category {
/*color: rgb(255, 150, 50)*/
color: darkseagreen;
}

span.regex_repeat {
/*color: rgb(51, 204, 255)*/
color: orangered;
}

span.regex_any {
/*color: rgb(204, 120, 50)*/
color: orangered;
}

code.regex {
font-size: 80%;
}

span.regex {
font-weight: bold;
}
Loading

0 comments on commit 1892aee

Please sign in to comment.