Skip to content

Commit

Permalink
fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 14, 2021
1 parent 6f33aed commit 23985e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions frontend/wikicms.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ def doFilter(self,html,filterKeys):
pass
# https://stackoverflow.com/questions/5041008/how-to-find-elements-by-class
if "editsection" in filterKeys:
for s in soup.select('span',{"class": "mw-editsection"}):
for s in soup.select('span.mw-editsection'):
s.extract()
return str(soup)
html=str(soup)
html=html.replace("<html><body>","")
html=html.replace("</body></html>","")
return html

def getFrame(self,pageTitle):
'''
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
long_description = open('../../README.md').read()

setup(name='pyWikiCMS',
version='0.0.13',
version='0.0.14',
description='python implementation of a Mediawiki based Content Management System',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
10 changes: 10 additions & 0 deletions tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ def testIssue15(self):
print(content)
self.assertFalse('''<span class="mw-editsection">''' in content)

def testIssue19(self):
'''
https://github.com/BITPlan/pyWikiCMS/issues/19
editsection filter should keep other span's untouched #19
'''
unfiltered="""<span class="mw-editsection">editsection</span><span class='image'>image section</span>"""
frontend=self.server.enableFrontend('cr')
filtered=frontend.doFilter(unfiltered,["editsection"])
self.assertEqual("""<span class="image">image section</span>""",filtered)

def testIssue17(self):
'''
https://github.com/BITPlan/pyWikiCMS/issues/17
Expand Down

0 comments on commit 23985e8

Please sign in to comment.