Add support for comment lines in dialog files
Only lines not starting with '#' will be loaded.
@@ -48,13 +48,15 @@ class MustacheDialogRenderer(object):
with open(filename, 'r') as f:
for line in f:
template_text = line.strip()
+ # Skip all lines starting with '#'
+ if not template_text.startswith('#'):
if template_name not in self.templates:
self.templates[template_name] = []
# convert to standard python format string syntax. From
- # double (or more) '{' followed by any number of whitespace
- # followed by actual key followed by any number of whitespace
- # followed by double (or more) '}'
+ # double (or more) '{' followed by any number of
+ # whitespace followed by actual key followed by any number
+ # of whitespace followed by double (or more) '}'
template_text = re.sub(r'\{\{+\s*(.*?)\s*\}\}+', r'{\1}',
template_text)
