From e472c86578f26e8ded5eea76e00ea795d4e96db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Tue, 15 Nov 2022 09:36:19 +0100 Subject: [PATCH] DOC: enhanced documentation --- CHANGELOG.md | 5 +++++ src/doc/converters.rst | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37f081ef..ee3c0478 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 74090cf8..5ca37f27 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 ================= -- GitLab