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. 11, 2017, 8:36 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 | tests/test_site/pages/filter.tmpl » ('j') | 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 == '<!--\n' or line == '-->\n':
Vasily Kuznetsov 2017/08/11 17:38:21 Maybe we can use `.strip()` to take care of possib
Jon Sonesen 2017/08/14 05:58:52 Acknowledged.
+ 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 | tests/test_site/pages/filter.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld