diff --git a/CHANGELOG.md b/CHANGELOG.md index 37f081efde15e7f1419cc019aee67d721216cfcf..ee3c0478148349c136b33be1c7aea2259c415fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### +- Converters often used in dicts (DictFloatElementConverter, + DictIntegerElementConverter, ...) do now accept other StructureElements by + default. For example a DictIntegerElement is accepted by default instead of a + DictFloatElement. This behavior can be changed (see converter documentation). + **Note** This might lead to additional matches compared to previous versions. - `_AbstractDictElementConverter` uses `re.DOTALL` for `match_value` - The "fallback" parent, the name of the element in the cfood, is only used when the object is created and only if there are no parents given. diff --git a/src/doc/converters.rst b/src/doc/converters.rst index 74090cf8bcea065602ed8faa526cd1aa34cd342e..5ca37f27f19fe5061c0291a209390daac39d5fb8 100644 --- a/src/doc/converters.rst +++ b/src/doc/converters.rst @@ -77,13 +77,6 @@ Dict Converter Typical Subtree converters -------------------------- -- DictBooleanElementConverter -- DictFloatElementConverter -- DictTextElementConverter -- DictIntegerElementConverter -- DictListElementConverter -- DictDictElementConverter - These converters expect `match_name` and `match_value` in their definition which allow to match the key and the value, respectively. @@ -92,6 +85,16 @@ DictFloatElementConverter also accepts DictIntegerElements. The default behavior can be adjusted with the fields `accept_text`, `accept_int`, `accept_float`, and `accept_bool`. +The following denotes what kind of StructureElements are accepted by default +(they are defined in `src/caoscrawler/converters.py`): + +- DictBooleanElementConverter: bool, int +- DictFloatElementConverter: int, float +- DictTextElementConverter: text, bool, int, float +- DictIntegerElementConverter: int +- DictListElementConverter: list +- DictDictElementConverter: dict + YAMLFileConverter =================