@@ -250,7 +250,7 @@ def parse_tokens_generator(
250250 )
251251 i += 1
252252 continue
253-
253+
254254 # URL with preview
255255 if LexingRule .URL_WITH_PREVIEW in current_token :
256256 yield Node (
@@ -318,21 +318,14 @@ def parse_tokens_generator(
318318 tokens [i + 1 :], [current_token .lexing_rule ]
319319 )
320320 if children_token is not None :
321- children_content = ""
322- # treat all children token as inline text
323- for child_token in children_token :
324- children_content += child_token .value
325-
321+ children_content = "" .join (child_token .value for child_token in children_token )
326322 # check for a language specifier
327323 lines = children_content .split ("\n " )
328- # there must be at least one other non-empty line
329- # (the content doesn't matter, there just has to be one)
330- non_empty_line_found = False
331324 lang = None
332- for line_index in range ( 1 , len ( lines )):
333- if len (lines [line_index ]) > 0 :
334- non_empty_line_found = True
335- break
325+ non_empty_line_found = any (
326+ len (lines [line_index ]) > 0
327+ for line_index in range ( 1 , len ( lines ))
328+ )
336329 if non_empty_line_found :
337330 match = LANG_SPEC .fullmatch (lines [0 ])
338331 # if there is any behind the lang spec, then it is normal text
@@ -384,7 +377,7 @@ def parse_tokens_generator(
384377 i = len (tokens ) # move to the end
385378 break
386379
387- if len ( children_token_in_quote_block ) > 0 :
380+ if children_token_in_quote_block :
388381 # tell the inner parse function that it's now inside a quote block
389382 children_nodes = list (
390383 parse_tokens_generator (
0 commit comments