Luke Plant avatar Luke Plant committed 7389c7e

Made the disallowed elements in the cleaning routine into a configurable setting

Comments (0)

Files changed (1)

semanticeditor/clean.py

 from semanticeditor.common import html_extract, parse, get_classes_for_node
 from semanticeditor.definitions import BLOCKDEF_SELECTOR, COMMANDS
 from semanticeditor.utils.etree import get_parent, get_index, eliminate_tag, empty_text
+from django.conf import settings
 
+disallowed_elements = getattr(settings, "SEMANTICEDITOR_DISALLOWED_ELEMENTS", ['span', 'li p:only-child', 'table', 'tbody', 'thead', 'tr', 'td'])
 
 def clean_tree(root):
     """
         i = get_index(p, n)
         eliminate_tag(p, i)
 
-    for x in ['table', 'tbody', 'thead', 'tr', 'td', 'span', 'li p:only-child']:
+    for x in disallowed_elements: 
         for n in doc(x):
             pull_up(n)
     # "li p:only-child" appears to be buggy.  It works like
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.