diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-21 16:46:01 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-05-21 16:46:01 -0400 |
commit | 91c9c024f32dd4dc0c336b8fa65b17542565649a (patch) | |
tree | 626db41ddac836ebe5a5cf20f0676dcd68673888 /mako/template.py | |
parent | c094a8adaac6aff481c9708fe91d71fae21cad87 (diff) | |
download | mako-91c9c024f32dd4dc0c336b8fa65b17542565649a.tar.gz |
- fix the line number scheme to be consistently 1-based, both
for the template and the module
- turn full_line_map into a list
- add another start source to help with when a render callable
begins
Diffstat (limited to 'mako/template.py')
-rw-r--r-- | mako/template.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/mako/template.py b/mako/template.py index 39ff8bd..a747feb 100644 --- a/mako/template.py +++ b/mako/template.py @@ -605,17 +605,14 @@ class ModuleInfo(object): source_map['line_map'] = dict((int(k), int(v)) for k, v in source_map['line_map'].items()) if full_line_map: - line_map = source_map['full_line_map'] = dict( - (k, v) for k, v in source_map['line_map'].items() - ) - - for mod_line in reversed(sorted(line_map)): - tmpl_line = line_map[mod_line] - while mod_line > 0: - mod_line -= 1 - if mod_line in line_map: - break - line_map[mod_line] = tmpl_line + f_line_map = source_map['full_line_map'] = [] + line_map = source_map['line_map'] + + curr_templ_line = 1 + for mod_line in range(1, max(line_map)): + if mod_line in line_map: + curr_templ_line = line_map[mod_line] + f_line_map.append(curr_templ_line) return source_map @property |