-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: ensure snippets end on a fresh line
this change ensures every snippet ends on a fresh line, ensuring that the corresponding close snippet tag is written to its own line. Without this, snippets which would end in the middle of a line would ultimately cause the next parse to fail as the close tag would be written on the snippet's last line, causing the snippet parser to not identify the snippet end on next parse.
- Loading branch information
1 parent
b2df02f
commit 351dd2f
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
15 changes: 15 additions & 0 deletions
15
tests/data/gentests/bb-snippets-always-end-last-line/input/gcgen_conf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from gcgen.api import snippet, Emitter, Scope, Json | ||
|
||
|
||
@snippet("foo") | ||
def s_foo(e: Emitter, scope: Scope, val: Json): | ||
e.emit("i end in the middle of a line...") | ||
|
||
|
||
@snippet("bar") | ||
def s_bar(e: Emitter, scope: Scope, val: Json): | ||
e.emitln("I end on a fresh (new) line..") | ||
|
||
|
||
def gcgen_parse_files(): | ||
return ["testfile.txt"] |
7 changes: 7 additions & 0 deletions
7
tests/data/gentests/bb-snippets-always-end-last-line/input/testfile.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
something | ||
# <<? foo | ||
# ?>> | ||
something else.. | ||
# <<? bar | ||
# ?>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters