We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f01b0c2 commit ef8f5b7Copy full SHA for ef8f5b7
src/sage/doctest/parsing.py
@@ -141,6 +141,17 @@ def parse_optional_tags(string):
141
# strip_string_literals replaces comments
142
comment = "#" + (literals[comment]).lower()
143
144
+ if return_string_sans_tags:
145
+ # skip non-tag comments that precede the first tag comment
146
+ if m := optional_regex.search(comment):
147
+ sharp_index = comment[:m.start(0)].rfind('#')
148
+ if sharp_index >= 0:
149
+ first_line += comment[:sharp_index]
150
+ comment = comment[sharp_index:]
151
+ else:
152
+ # no non-tag comment
153
+ return set(), string
154
+
155
tags = []
156
for m in optional_regex.finditer(comment):
157
cmd = m.group(1)
0 commit comments