Skip to content

Commit f6c9848

Browse files
committed
Fix issue with leading whitespace in .ipynb files
1 parent 95179cd commit f6c9848

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sphinx_tags/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,13 @@ def __init__(self, entrypath: Path):
263263
tagblock = []
264264
reading = False
265265
for line in self.lines:
266+
line = line.strip()
266267
if tagstart in line:
267268
reading = True
268269
line = line.split(tagstart)[1]
269270
tagblock.extend(line.split(","))
270271
else:
271-
if reading and line.strip() == tagend:
272+
if reading and line == tagend:
272273
# tagblock now contains at least one tag
273274
if tagblock != [""]:
274275
break
@@ -277,7 +278,7 @@ def __init__(self, entrypath: Path):
277278

278279
self.tags = []
279280
if tagblock:
280-
self.tags = [_normalize_display_tag(tag).rstrip('"') for tag in tagblock if tag != ""]
281+
self.tags = [_normalize_display_tag(tag) for tag in tagblock if tag != ""]
281282

282283
def assign_to_tags(self, tag_dict):
283284
"""Append ourself to tags"""

0 commit comments

Comments
 (0)