Skip to content

Commit

Permalink
👌 Streamline internal CSS (#1178)
Browse files Browse the repository at this point in the history
This commit restructures the internal CSS used by the extension, with the goal of improving compatibility sphinx theme extensions.

- `common.css` is split into multiple files, relating to their purpose.
- most hard-coded colors set within the CSS are replaced with CSS variables, that can be set/overridden by themes/users
- most per-theme CSS is replaced with simply defining the CSS variable colors (removing a lot of duplication)
- Outdated/deprecated handling of CSS/JS in `sphinx_needs/environment.py` is replaced with modern sphinx methods
  • Loading branch information
chrisjsewell authored May 11, 2024
1 parent 4bc4423 commit dd28cda
Show file tree
Hide file tree
Showing 29 changed files with 665 additions and 1,184 deletions.
21 changes: 1 addition & 20 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1637,28 +1637,9 @@ This may be needed to avoid custom table handling of some specific Sphinx theme
needs_table_classes = ['my_custom_class', 'another_class']
Default: ``['rtd-exclude-wy-table', 'no-sphinx-material-strip']``
This classes are not set for needtables using the ``table`` style, which is using the normal Sphinx table layout
These classes are not set for needtables using the ``table`` style, which is using the normal Sphinx table layout
and therefore must be handled by themes.
The following themes support the following table classes to deactivate their specific handling:
.. list-table::
- * Theme
* Class
- * ReadTheDocs
* ``rtd-exclude-wy-table``
- * Sphinx-Material
* ``no-sphinx-material-strip``
.. hint::
The deactivation of theme specific table handling is quite a new feature in most themes.
Please be sure to use the newest theme version or even the nightly build.
.. _needs_builder_filter:
needs_builder_filter
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ markers = [
]
filterwarnings = [
"ignore:.*removed in Python 3.14.*:DeprecationWarning",
# "ignore::sphinx.deprecation.RemovedInSphinx90Warning"
"ignore::PendingDeprecationWarning:sphinx_data_viewer.*",
]


Expand Down
5 changes: 2 additions & 3 deletions sphinx_needs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sphinx.application import Sphinx
from sphinx.config import Config as _SphinxConfig

from sphinx_needs.defaults import DEFAULT_DIAGRAM_TEMPLATE, NEEDS_TABLES_CLASSES
from sphinx_needs.defaults import DEFAULT_DIAGRAM_TEMPLATE

if TYPE_CHECKING:
from sphinx.util.logging import SphinxLoggerAdapter
Expand Down Expand Up @@ -376,8 +376,7 @@ def __setattr__(self, name: str, value: Any) -> None:
default="is_external==False", metadata={"rebuild": "html", "types": (str,)}
)
table_classes: list[str] = field(
default_factory=lambda: NEEDS_TABLES_CLASSES,
metadata={"rebuild": "html", "types": (list,)},
default_factory=list, metadata={"rebuild": "html", "types": (list,)}
)
"""Additional classes to set for needs and needtable."""
string_links: dict[str, dict[str, Any]] = field(
Expand Down
67 changes: 0 additions & 67 deletions sphinx_needs/css/blank/blank.css

This file was deleted.

95 changes: 0 additions & 95 deletions sphinx_needs/css/blank/styles.css

This file was deleted.

162 changes: 0 additions & 162 deletions sphinx_needs/css/common.css

This file was deleted.

Loading

0 comments on commit dd28cda

Please sign in to comment.