File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const std = @import ("std" );
2+ const assert = std .debug .assert ;
23const Writer = std .Io .Writer ;
34const scripty = @import ("scripty" );
45const tracy = @import ("tracy" );
@@ -907,11 +908,19 @@ pub fn SuperTemplate(comptime ScriptyVM: type) type {
907908 }
908909
909910 if (elem .kind .isElement () and ! elem .kind .isVoid ()) {
910- // Print up to the close tag
911- const end = elem .close .end ;
912- const up_to_attr = tpl .src [tpl .print_cursor .. end ];
913- writer .writeAll (up_to_attr ) catch return error .OutIO ;
914- tpl .print_cursor = end ;
911+ if (elem .self_closing ) {
912+ assert (tpl .html .language == .xml );
913+ // Synthesize a closing tag
914+ writer .print ("</{s}>" , .{
915+ elem .open .getName (tpl .src , tpl .html .language ).slice (tpl .src ),
916+ }) catch return error .OutIO ;
917+ } else {
918+ // Print up to the close tag
919+ const end = elem .close .end ;
920+ const up_to_end = tpl .src [tpl .print_cursor .. end ];
921+ writer .writeAll (up_to_end ) catch return error .OutIO ;
922+ tpl .print_cursor = end ;
923+ }
915924 }
916925 _ = tpl .cursor .next ();
917926 },
You can’t perform that action at this time.
0 commit comments