Skip to content

Commit 25078c4

Browse files
committed
Update docs
1 parent e397e15 commit 25078c4

8 files changed

Lines changed: 15 additions & 14 deletions

File tree

dict2css/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
# __init__.py
44
"""
55
A μ-library for constructing cascasing style sheets from Python dictionaries.
6-
7-
.. latex:vspace:: 10px
8-
.. seealso:: `css-parser <https://github.com/ebook-utils/css-parser>`_, which this library builds upon.
96
"""
107
#
118
# Copyright © 2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
@@ -143,6 +140,7 @@ def dumps(
143140
:return: The style sheet as a string.
144141
145142
.. versionchanged:: 0.2.0 Added support for media at-rules.
143+
.. versionchanged:: 0.5.0 New implementation. Output may differ slightly from previous css-parser based one.
146144
"""
147145

148146
serializer = CSSSerializer(
@@ -224,6 +222,8 @@ def dump(
224222
* ``fp`` now accepts :py:obj:`domdf_python_tools.typing.PathLike` objects,
225223
representing the path of a file to write to.
226224
* Added support for media at-rules.
225+
226+
.. versionchanged:: 0.5.0 New implementation. Output may differ slightly from previous css-parser based one.
227227
"""
228228

229229
css = dumps(
@@ -247,10 +247,13 @@ def loads(styles: str) -> MutableMapping[str, MutableMapping[str, Any]]:
247247
Parse a style sheet and return its dictionary representation.
248248
249249
.. versionadded:: 0.2.0
250+
.. versionchanged:: 0.5.0 New implementation. Output may differ slightly from previous css-parser based one.
250251
251252
:param styles:
252253
253254
:return: The style sheet as a dictionary.
255+
256+
.. latex:clearpage::
254257
"""
255258

256259
stylesheet = tinycss2.parse_blocks_contents(styles, skip_comments=True, skip_whitespace=True)
@@ -298,6 +301,7 @@ def load(fp: Union[PathLike, IO]) -> MutableMapping[str, MutableMapping[str, Any
298301
Parse a cascading style sheet from the given file and return its dictionary representation.
299302
300303
.. versionadded:: 0.2.0
304+
.. versionchanged:: 0.5.0 New implementation. Output may differ slightly from previous css-parser based one.
301305
302306
:param fp: An open file handle, or the filename of a file to write to.
303307

dict2css/serializer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
class CSSSerializer:
7474
r"""
75-
Serializes a :class:`~.StyleSheet` and its parts.
75+
Serializes a dictionary to CSS.
7676
7777
This controls the formatting of the style sheet.
7878
@@ -83,7 +83,9 @@ class CSSSerializer:
8383
:param sort_keys: Sort dictionary keys alphabetically.
8484
:param check_circular: Check for circular references.
8585
86-
.. autosummary-widths:: 5/16
86+
.. versionchanged:: 0.5.0 New implementation. Output may differ slightly from previous css-parser based one.
87+
88+
.. autosummary-widths:: 1/4
8789
"""
8890

8991
def __init__(
@@ -160,9 +162,9 @@ def encode(self, obj: Mapping) -> str:
160162
"""
161163
Return a CSS representation of a Python dictionary.
162164
163-
:param obj: The Python object to be serialized
165+
:param obj: The Python dictionary to be serialized
164166
165-
:returns: The CSS string representation of the Python object
167+
:returns: The CSS string representation of the Python dictionary
166168
"""
167169

168170
return ''.join(self.iterencode(obj))

doc-source/api/dict2css.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
================
44

55
.. autosummary-widths:: 21/64
6-
:html: 41/128
76

87
.. raw:: latex
98

doc-source/api/helpers.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
===========================
44

55
.. autosummary-widths:: 7/16
6-
:html: 2/10
76

87
.. automodule:: dict2css.helpers

doc-source/api/serializer.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
===========================
44

55
.. autosummary-widths:: 1/2
6-
:html: 4/10
76

87
.. automodule:: dict2css.serializer
98
:no-show-inheritance:

doc-source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,4 @@ def setup(app):
101101

102102
nitpicky = True
103103
latex_elements["preamble"] = "\\raggedbottom\n\\widowpenalty10000"
104-
autosummary_widths_builders = ["latex"]
105104
changelog_sections_numbered = False

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extensions = [
6363
"sphinx_licenseinfo",
6464
"seed_intersphinx_mapping",
6565
"html_section",
66-
"sphinx_toolbox_experimental.autosummary_widths",
66+
"sphinx_toolbox.more_autosummary.column_widths",
6767
"sphinx_toolbox_experimental.succinct_seealso",
6868
"sphinx_toolbox_experimental.needspace",
6969
"sphinx_toolbox_experimental.missing_xref",

repo_helper.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ classifiers:
4040
sphinx_conf_epilogue:
4141
- nitpicky = True
4242
- latex_elements["preamble"] = "\\raggedbottom\n\\widowpenalty10000"
43-
- autosummary_widths_builders = ["latex"]
4443
- changelog_sections_numbered = False
4544

4645
exclude_files:
4746
- contributing
4847

4948

5049
extra_sphinx_extensions:
51-
- sphinx_toolbox_experimental.autosummary_widths
50+
- sphinx_toolbox.more_autosummary.column_widths
5251
- sphinx_toolbox_experimental.succinct_seealso
5352
- sphinx_toolbox_experimental.needspace
5453
- sphinx_toolbox_experimental.missing_xref

0 commit comments

Comments
 (0)