diff --git a/docs/api_reference.rst b/docs/api_reference.rst index c1fcc64..953adc8 100644 --- a/docs/api_reference.rst +++ b/docs/api_reference.rst @@ -21,6 +21,7 @@ functions. .. autofunction:: parse_stylesheet .. autofunction:: parse_rule_list .. autofunction:: parse_one_rule +.. autofunction:: parse_blocks_contents .. autofunction:: parse_declaration_list .. autofunction:: parse_one_declaration .. autofunction:: parse_component_value_list diff --git a/docs/common_use_cases.rst b/docs/common_use_cases.rst index 163b7f0..11b9762 100644 --- a/docs/common_use_cases.rst +++ b/docs/common_use_cases.rst @@ -59,22 +59,22 @@ Parsing a list of declarations is possible from a list of tokens (given by the string (given by the ``style`` attribute of an HTML element, for example). The high-level function used to parse declarations is -:func:`tinycss2.parse_declaration_list`. +:func:`tinycss2.parse_blocks_contents`. .. code-block:: python rules = tinycss2.parse_stylesheet('body div {width: 50%;height: 50%}') - tinycss2.parse_declaration_list(rules[0].content) + tinycss2.parse_blocks_contents(rules[0].content) # [, ] - tinycss2.parse_declaration_list('width: 50%;height: 50%') + tinycss2.parse_blocks_contents('width: 50%;height: 50%') # [, ] You can then get the name and value of each declaration: .. code-block:: python - declarations = tinycss2.parse_declaration_list('width: 50%;height: 50%') + declarations = tinycss2.parse_blocks_contents('width: 50%;height: 50%') declarations[0].name, declarations[0].value # ('width', [, ]) diff --git a/tests/test_tinycss2.py b/tests/test_tinycss2.py index d07aa69..098717a 100644 --- a/tests/test_tinycss2.py +++ b/tests/test_tinycss2.py @@ -218,7 +218,7 @@ def test_serialize_rules(): def test_serialize_declarations(): source = 'color: #123; /**/ @top-left {} width:7px !important;' - rules = parse_declaration_list(source) + rules = parse_blocks_contents(source) assert serialize(rules) == source