Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions webodt/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,21 @@ def unescape_templatetags_preprocessor(template_content):
template_content = template_content.replace(
'{{%s}}' % include_text, '{{%s}}' % new_include_text
)
for include_text in re.findall(r'{{(.+?)}}', template_content):
new_include_text = re.sub(r'<.*?>', '', include_text)
template_content = template_content.replace(
'{{%s}}' % include_text, '{{%s}}' % new_include_text
)
return template_content

def xmlfor_preprocessor(template_content):
for include_text in re.findall(r'{%(.+?)%}', template_content):
new_include_text = re.sub(r'<.*?>', '', include_text)
template_content = template_content.replace(
'{%%%s%%}' % include_text, '{%%%s%%}' % new_include_text
)
print include_text
print template_content
tree = etree.parse(StringIO(template_content))

# 1. search for xmlfor pairs
Expand Down