@@ -579,10 +579,8 @@ def append_text(self, text, file, line):
579
579
elif '\n ' in text :
580
580
i = text .find ('\n ' )
581
581
self .result_text .append (text [:i + 1 ])
582
- self .last_file_line = (
583
- self .last_file_line [0 ], self .last_file_line [1 ] + 1 )
584
582
# and try again
585
- self .append_text (text [i + 1 :], file , line )
583
+ self .append_text (text [i + 1 :], file , line + 1 )
586
584
return
587
585
588
586
self .result_text .append (text )
@@ -755,10 +753,16 @@ def expand(filename, line_directive=_default_line_directive, **local_bindings):
755
753
>>> from tempfile import NamedTemporaryFile
756
754
>>> f = NamedTemporaryFile()
757
755
>>> f.write(
758
- ... '''---
756
+ ... r '''---
759
757
... % for i in range(int(x)):
760
758
... a pox on ${i} for epoxy
761
759
... % end
760
+ ... ${120 +
761
+ ...
762
+ ... 3}
763
+ ... abc
764
+ ... ${"w\nx\nX\ny"}
765
+ ... z
762
766
... ''')
763
767
>>> f.flush()
764
768
>>> result = expand(
@@ -772,7 +776,16 @@ def expand(filename, line_directive=_default_line_directive, **local_bindings):
772
776
a pox on 0 for epoxy
773
777
//#sourceLocation(file: "dummy.file", line: 3)
774
778
a pox on 1 for epoxy
775
-
779
+ //#sourceLocation(file: "dummy.file", line: 5)
780
+ 123
781
+ //#sourceLocation(file: "dummy.file", line: 8)
782
+ abc
783
+ w
784
+ x
785
+ X
786
+ y
787
+ //#sourceLocation(file: "dummy.file", line: 10)
788
+ z
776
789
"""
777
790
with open (filename ) as f :
778
791
t = parse_template (filename , f .read ())
0 commit comments