File tree Expand file tree Collapse file tree 1 file changed +11
-15
lines changed
crates/djls-templates/src Expand file tree Collapse file tree 1 file changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -128,24 +128,20 @@ impl Lexer {
128128 while !self . is_at_end ( ) {
129129 let remaining = self . remaining_source ( ) ;
130130
131- if let Some ( pos) = memchr3 ( b'{' , b'\n' , b'\r' , remaining. as_bytes ( ) ) {
132- let found_char = remaining. as_bytes ( ) [ pos] ;
133-
134- if found_char == b'{' {
135- let substr = & remaining[ pos..] ;
136- if TagDelimiter :: from_input ( substr) . is_some ( ) {
137- self . current += pos;
138- break ;
139- }
140- self . current += pos + 1 ;
141- } else {
142- self . current += pos;
143- break ;
144- }
145- } else {
131+ let Some ( pos) = memchr3 ( b'{' , b'\n' , b'\r' , remaining. as_bytes ( ) ) else {
146132 self . current = self . source . len ( ) ;
147133 break ;
134+ } ;
135+
136+ let is_newline = matches ! ( remaining. as_bytes( ) [ pos] , b'\n' | b'\r' ) ;
137+ let is_django_delimiter = TagDelimiter :: from_input ( & remaining[ pos..] ) . is_some ( ) ;
138+
139+ if is_newline || is_django_delimiter {
140+ self . current += pos;
141+ break ;
148142 }
143+
144+ self . current += pos + 1 ;
149145 }
150146
151147 let text = self . consumed_source_from ( text_start) ;
You can’t perform that action at this time.
0 commit comments