I encountered an IndexError in the Template.normal_name function while running my bot. I don't have the actual example that caused this, but I have reproduced an example of what I think happened:
>>> x = wtp.Template('{{Template: | hi=bye}}')
>>> x.normal_name(capitalize=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/winston/projects/IndentBot/venv/lib/python3.9/site-packages/wikitextparser/_template.py", line 95, in normal_name
n0 = name[0]
IndexError: string index out of range
One fix would be to change this code:
if capitalize:
# Use uppercase for the first letter
n0 = name[0]
if n0.islower():
name = n0.upper() + name[1:]
to
if capitalize:
# Use uppercase for the first letter
name = name[:1].upper() + name[1:]
I encountered an IndexError in the Template.normal_name function while running my bot. I don't have the actual example that caused this, but I have reproduced an example of what I think happened:
One fix would be to change this code:
to