diff --git a/app.py b/app.py index ce85b99..c4d9db4 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,7 @@ from flask import Flask, render_template, Response import requests import re -from bs4 import BeautifulSoup +from bs4 import BeautifulSoup, Comment from datetime import datetime from dateutil.relativedelta import relativedelta @@ -358,6 +358,21 @@ class WikiApp(Flask): file_link.unwrap() soup = self.remove_thumbnail_img(soup) + # Locate the table and the comment + table = soup.find('table') + # Remove inline styles by deleting the 'style' attribute + if table and 'style' in table.attrs: + del table['style'] + + # Add the class 'table-cont' to the table + if table: + table['class'] = table.get('class', []) + ['table-cont'] + comments = soup.find_all(string=lambda text: isinstance(text, Comment)) + comment = comments[-1] if comments else None + + # Insert the table before the comment + if comment: + comment.insert_before(table.extract()) return soup.prettify() diff --git a/static/assets/images/favicon.png b/static/assets/images/favicon.png new file mode 100644 index 0000000..4224a86 Binary files /dev/null and b/static/assets/images/favicon.png differ diff --git a/templates/base.html b/templates/base.html index 5ab7231..a5fb62a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,7 +5,7 @@ {% block title %}{% endblock %} - +