diff --git a/app.py b/app.py index b727966..03210cf 100644 --- a/app.py +++ b/app.py @@ -34,10 +34,10 @@ class WikiApp(Flask): data = response.json() # Extract page title and content page_content = data['parse']['text']['*'] - page_content = self.fix_html(page_content) + page_content, table = self.fix_html(page_content) homepage_content += page_content - - return render_template('index.html', title=pages[0], cont=homepage_content) + print(table) + return render_template('index.html', title=pages[0], cont=homepage_content, table=table) def data_int(self): return render_template('data.html') @@ -313,8 +313,9 @@ class WikiApp(Flask): # Extract page title and content page_title = data['parse']['title'] page_content = data['parse']['text']['*'] - page_content = self.fix_html(page_content) - return render_template('index.html', title=page_title, cont=page_content) + page_content, table = self.fix_html(page_content) + print(table) + return render_template('index.html', title=page_title, cont=page_content, table=table) def fetch_page(self, title): @@ -364,7 +365,7 @@ class WikiApp(Flask): for link in links: # Add _blank to href link['target'] = '_blank' - link.string = link.string.strip() + " ↗" + link.string = link.string.strip() # Find all a tags with href containing 'index.php' links = soup.find_all('a', href=lambda href: href and 'index.php' in href) @@ -409,13 +410,30 @@ class WikiApp(Flask): table_html = str(table) if table else None # Store the table HTML + has_content = False + # Check if the table has meaningful rows + if table: + rows = table.find_all('tr') + has_content = False # Assume no meaningful content + + for row in rows: + cells = row.find_all(['td', 'th']) + # Check if any cell has non-empty text + if any(cell.get_text(strip=True) for cell in cells): + has_content = True + break + + if has_content is False: + table_html = None + + # Remove the table from the main HTML if table: table.decompose() # Return the modified HTML - return soup.prettify() + return soup.prettify(), table_html def remove_thumbnail_img(self, soup): thumbnail = soup.find_all(attrs={"typeof": "mw:File/Thumb"}) diff --git a/static/assets/styles.css b/static/assets/styles.css index 8318bdd..fdd7647 100644 --- a/static/assets/styles.css +++ b/static/assets/styles.css @@ -24,6 +24,19 @@ body { overflow: hidden; } +* { + margin:0; + padding:0; + border:0; + font-family: "Inter", serif; + -webkit-text-size-adjust:none; +} + +a { + text-decoration: none; + color:black; +} + #main-container { height: 100%; width: 100%; @@ -88,6 +101,11 @@ body { overflow-x: hidden; } +#content-container a{ + text-decoration: underline; + color:blue; +} + #content-title { text-decoration: underline; } @@ -98,12 +116,44 @@ body { gap: 20px; } +#content-body img{ + width: 100%; + height: auto; + object-fit: contain; + -webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */ + filter: grayscale(100%) contrast(1.75); +} + +#wiki-box { + border-style: dashed; +} + #line-divider { width: 2px; /* Thickness of the divider */ background-color: black; /* Color of the line */ } +/* + table +*/ + +table { + display: table; + border-collapse: separate; + box-sizing: border-box; + text-indent: initial; + unicode-bidi: isolate; + border-spacing: 20px; + border-color: gray; + border-radius: 30px; + font-size: 16px; +} + +th { + text-transform: uppercase; +} + /* classes */ @@ -155,3 +205,32 @@ p { font-size: 12px; font-weight: bold; } + +/* headers */ +h4 { + font-size: 24px; + margin: 0; + color: black; +} + +h3 { + font-size: 26px; + margin: 0; + color: black; +} + +h2 { + font-size: 28px; + margin: 0; + color: black; +} + +h1 { + font-size: 30px; + margin: 0; + color: black; +} + +hr { + border-top: 1px solid black; +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 867ab54..0c337d3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,7 +5,7 @@ {% block content %}
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat dignissim justo, posuere imperdiet justo condimentum at. Sed eget odio vitae velit efficitur facilisis lacinia eget libero. Donec ex magna, laoreet id hendrerit at, varius et sem. Phasellus tempor ante in felis vehicula, vitae rhoncus tellus posuere. Ut nec sodales urna. Sed molestie lectus vel dolor maximus, sed cursus urna mattis. Cras eu mauris sit amet mauris lacinia accumsan vitae eu arcu. Duis quis mollis mauris. Maecenas condimentum ac tortor vel sodales. Fusce eget erat ut odio interdum porta. Donec placerat nisl id dui dapibus, finibus volutpat massa placerat. Donec commodo pellentesque ipsum eget ullamcorper. Praesent fermentum sit amet turpis sit amet sagittis. Aliquam tempus, sapien eget tincidunt luctus, urna felis molestie dolor, ac blandit arcu erat vitae eros. Morbi a lacus laoreet, varius eros ut, rutrum nibh.

@@ -46,9 +46,11 @@ MM. MM. ,MP M `MM.M MM. MM Y , MM MM
✲ ✲ ✲
+ {%if table != None %}
- + {{ table | safe }}
+ {%endif%}