Skip to content

Commit 965ca31

Browse files
committed
fix: add upper to everything so text searching ignore case
1 parent 3024346 commit 965ca31

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mkdocs_embed_file_plugins/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,29 @@ def search_in_file(citation_part: str, contents: str):
3030
elif '#' in citation_part and not '^' in citation_part:
3131
# cite from title
3232
sub_section = []
33-
citation_part = citation_part.replace('-', ' ').replace('#', '# ')
33+
citation_part = citation_part.replace('-', ' ').replace('#', '# ').upper()
3434
heading = 0
3535
for i in data:
36-
if citation_part in i and i.startswith('#'):
36+
if citation_part in i.upper() and i.startswith('#'):
3737
heading = i.count('#') * (-1)
3838
sub_section.append([i])
3939
elif heading != 0:
4040
inverse = i.count('#') * (-1)
4141
if inverse == 0 or heading > inverse:
42+
print('Inverse ?', i)
4243
sub_section.append([i])
4344
elif inverse >= heading:
45+
print('Break ?')
4446
break
4547
sub_section = [x for y in sub_section for x in y]
48+
4649
sub_section = '\n'.join(sub_section)
4750
return sub_section
4851
elif '#^' in citation_part:
4952
# cite from block
5053
citation_part = citation_part.replace('#', '')
5154
for i in data:
52-
if citation_part in i:
55+
if citation_part in i.upper():
5356
return i.replace(citation_part, '')
5457
return []
5558

0 commit comments

Comments
 (0)