Skip to content

Commit 2dd7e3b

Browse files
committed
Fix some formatting issues with blocks.
1 parent e848f00 commit 2dd7e3b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

mustang/TemplateParser.ooc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ TemplateParser: class {
115115
// End of tag block
116116
if(tag first() == '/') {
117117
endBlock()
118+
if(templateText charAt(index) == '\n') {
119+
// Skip any newline after the ending block tag
120+
index += 1
121+
}
118122
return true
119123
}
120124

@@ -124,8 +128,16 @@ TemplateParser: class {
124128
node := p parse(tag)
125129
if(node) {
126130
appendNode(node)
127-
if(p isBlock()) startBlock()
128131
}
132+
133+
if(p isBlock()) {
134+
startBlock()
135+
if(templateText charAt(index) == '\n') {
136+
// Skip any newline that comes after a block start tag
137+
index += 1
138+
}
139+
}
140+
129141
return true
130142
}
131143
}

0 commit comments

Comments
 (0)