diff --git a/CHANGES.rst b/CHANGES.rst index b5b69af6..10267e0b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ Changelog 1.11 (unreleased) ----------------- +- Allow to use fix_html_in_content_fields without applying the default html_fixer. + [pbauer] + - Try to restore broken blobs when exporting content. [thet] diff --git a/src/collective/exportimport/fix_html.py b/src/collective/exportimport/fix_html.py index 2f21d395..c3bbd9fa 100644 --- a/src/collective/exportimport/fix_html.py +++ b/src/collective/exportimport/fix_html.py @@ -247,7 +247,9 @@ def find_object(base, path): return target -def fix_html_in_content_fields(context=None, commit=True, fixers=None): +def fix_html_in_content_fields( + context=None, commit=True, fixers=None, apply_default_fixer=True +): """Fix html this after importing content into Plone 5 or 6. When calling this from your code you can pass additional fixers to modify the html. @@ -296,7 +298,9 @@ def table_class_fixer(text, obj=None): else: if not isinstance(fixers, list): fixers = [fixers] - fixers = [html_fixer] + [i for i in fixers if callable(i)] + fixers = [i for i in fixers if callable(i)] + if apply_default_fixer: + fixers.prepend(html_fixer) try: # Add img_variant_fixer if we are running this in Plone 6.x