isogeotodocx.utils.formatter module¶
-
class
isogeotodocx.utils.formatter.
Formatter
(lang='FR')[source]¶ Bases:
object
Metadata formatter to avoid repeat operations on metadata during export in different formats.
- Parameters
lang (str) – selected language
-
clean_xml
(invalid_xml: str, mode: str = 'soft', substitute: str = '_')[source]¶ Clean string of XML invalid characters.
source: https://stackoverflow.com/a/13322581/2556577
- Parameters
invalid_xml (str) – xml string to clean
substitute (str) – character to use for subtistution of special chars
modeaccents (str) –
mode to apply. Available options:
soft [default]: remove chars which are not accepted in XML
strict: remove additional chars
-
conditions
(md_conditions: list) → list[source]¶ Render input metadata CGUs as a new list.
- Parameters
md_conditions (list) – input list extracted from an Isogeo metadata
- Return type
tuple(dict)
-
limitations
(md_limitations: list) → list[source]¶ Format input metadata limitations as a tuple of 2 tuples of dictionaries, ready to be exported: one with limitations related to INSPIRE, one with other limitations.
- Parameters
md_limitations (list) – input list of metadata limitations
- Return type
tuple(tuple(dict), tuple(dict))