Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/converters.py

Issue 29512597: Issue 4491 - Adds handling for block commented page metadata (Closed)
Patch Set: ;) Created Aug. 15, 2017, 10:45 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -117,16 +117,19 @@
self._append_text(self.unescape('&#{};'.format(name)))
def parse_page_content(page, data):
"""Separate page content into metadata (dict) and body text (str)"""
page_data = {'page': page}
lines = data.splitlines(True)
for i, line in enumerate(lines):
+ if line.strip() in {'<!--', '-->'}:
+ lines[i] = ''
+ continue
if not re.search(r'^\s*[\w\-]+\s*=', line):
break
name, value = line.split('=', 1)
value = value.strip()
if value.startswith('[') and value.endswith(']'):
value = [element.strip() for element in value[1:-1].split(',')]
lines[i] = '\n'
page_data[name.strip()] = value
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld