<%page args="module"/> <%namespace name="lib" file="//lib.html" import="*"/> % if "text" in module : % if module["text"] : <% from lxml.html.clean import Cleaner import re import urlparse import uuid cleaner = Cleaner(comments = False, links = False, meta = False, page_structure = False, processing_instructions = False, embedded = False, frames = False, forms = False, annoying_tags = False, remove_unknown_tags = False, safe_attrs_only = False) html = cleaner.clean_html('

' + module["text"] + '

') formactionRegex = 'formaction=\"(.+?)\"' attr = re.search(formactionRegex, html) if attr: url = str(attr.group(1)) o = urlparse.urlparse(url) if o.scheme not in ('http', 'https', 'mailto'): html = re.sub(formactionRegex, 'formaction=""', html) html = re.sub('^

|

$','',html) content_id = 'static_content_' + str(uuid.uuid4()) %> % endif % else : Hi! I am completely static HTML content module. % endif <%lib:add_script_block> require(["splunkjs/mvc/simplexml/htmlcleaner"], function(htmlCleaner) { var static_content = '' + '${_(html).replace("\r", "").replace("\n", "").replace("\'","\\\'")}' + ''; $('#' + '${content_id}').html(htmlCleaner.clean(static_content)); });