@@ -100,14 +100,13 @@ def found_include_tag(match):
100100
101101 # string options
102102 start_match = re .search (ARGUMENT_REGEXES ['start' ], arguments_string )
103- if start_match is not None :
104- start = process .interpret_escapes (start_match .group (1 ))
105- _ , _ , text_to_include = text_to_include .partition (start )
106-
107103 end_match = re .search (ARGUMENT_REGEXES ['end' ], arguments_string )
108- if end_match is not None :
109- end = process .interpret_escapes (end_match .group (1 ))
110- text_to_include , _ , _ = text_to_include .partition (end )
104+
105+ text_to_include , _ , _ = process .filter_inclusions (
106+ start_match ,
107+ end_match ,
108+ text_to_include ,
109+ )
111110
112111 # nested includes
113112 new_text_to_include = get_file_content (text_to_include , file_path_abs )
@@ -185,16 +184,13 @@ def found_include_markdown_tag(match):
185184
186185 # string options
187186 start_match = re .search (ARGUMENT_REGEXES ['start' ], arguments_string )
188- start = None
189- if start_match is not None :
190- start = process .interpret_escapes (start_match .group (1 ))
191- _ , _ , text_to_include = text_to_include .partition (start )
192-
193187 end_match = re .search (ARGUMENT_REGEXES ['end' ], arguments_string )
194- end = None
195- if end_match is not None :
196- end = process .interpret_escapes (end_match .group (1 ))
197- text_to_include , _ , _ = text_to_include .partition (end )
188+
189+ text_to_include , start , end = process .filter_inclusions (
190+ start_match ,
191+ end_match ,
192+ text_to_include ,
193+ )
198194
199195 # relative URLs rewriting
200196 if bool_options ['rewrite-relative-urls' ]['value' ]:
0 commit comments