comparison scripts/generate-ini.py @ 8428:6eb1f66ac23f stable

ini: tweak mako comment markup - prepare for variable expansion in ## lines by only "quoting" ##
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 22 May 2020 16:45:09 +0200
parents ef9fd1434270
children 495dea7c2a13
comparison
equal deleted inserted replaced
8427:d59cb6068e55 8428:6eb1f66ac23f
53 # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text> 53 # make sure all mako lines starting with '#' (the '##' comments) are marked up as <text>
54 makofile = inifile.template_file 54 makofile = inifile.template_file
55 print('reading:', makofile) 55 print('reading:', makofile)
56 mako_org = open(makofile).read() 56 mako_org = open(makofile).read()
57 mako_no_text_markup = re.sub(r'</?%text>', '', mako_org) 57 mako_no_text_markup = re.sub(r'</?%text>', '', mako_org)
58 mako_marked_up = re.sub(r'\n(##.*)', r'\n<%text>\1</%text>', mako_no_text_markup, flags=re.MULTILINE) 58 mako_marked_up = re.sub(r'\n##(.*)', r'\n<%text>##</%text>\1', mako_no_text_markup, flags=re.MULTILINE)
59 if mako_marked_up != mako_org: 59 if mako_marked_up != mako_org:
60 print('writing:', makofile) 60 print('writing:', makofile)
61 open(makofile, 'w').write(mako_marked_up) 61 open(makofile, 'w').write(mako_marked_up)
62 62
63 lines = re.findall(r'\n(# [^ ].*)', mako_marked_up) 63 lines = re.findall(r'\n(# [^ ].*)', mako_marked_up)