Skip to content

Commit d168332

Browse files
committed
Fixed spell effects including file names
1 parent 6daa19f commit d168332

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog
33
=========
44

5+
.. 6.0.2
6+
7+
6.0.2 (2021-09-10)
8+
==================
9+
10+
- Fixed spell effects including file names.
11+
512
.. v6.0.1
613
714
6.0.1 (2021-08-18)

tibiawikisql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
__copyright__ = "Copyright 2021 Allan Galarza"
1919

2020
__license__ = "Apache 2.0"
21-
__version__ = "6.0.1"
21+
__version__ = "6.0.2"
2222

2323
from tibiawikisql import models
2424
from tibiawikisql.api import Article, Image, WikiClient, WikiEntry

tibiawikisql/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,13 @@ def clean_links(content, strip_question_mark=False):
6161
:class:`str`:
6262
The clean string, with no links.
6363
"""
64+
img = re.compile('(File|Image):', re.I)
6465
content = re.sub(r"</?[bB][rR] ?/?>", "\n", content)
6566
parsed = mwparserfromhell.parse(content)
67+
# Remove image links as well
68+
remove_img = [f for f in parsed.ifilter_wikilinks() if img.match(str(f.title))]
69+
for f in remove_img:
70+
parsed.remove(f)
6671
content = parsed.strip_code().strip()
6772
if strip_question_mark and content == "?":
6873
return None

0 commit comments

Comments
 (0)