Browse Source

styling and article py updates

main
Cailean Finn 9 months ago
parent
commit
000b399798
  1. 22
      app.py
  2. 96
      static/assets/styles.css
  3. 11
      templates/article.html
  4. 1
      templates/home.html

22
app.py

@ -64,7 +64,7 @@ class WikiApp(Flask):
def homepage(self):
# Fetch pages for articles, projects, and newsletters
categories = ['Articles', 'Projects', 'Newsletters', 'MainNavigation']
categories = ['Articles', 'Projects', 'Newsletters']
category_page_list = self.fetch_all_pages(categories)
updated_cat_list = self.fetch_pages_cat(category_page_list)
articles = updated_cat_list.get('Articles', [])
@ -103,14 +103,25 @@ class WikiApp(Flask):
# Append 'https://wiki.conceptnull.org' to the src attribute
img['src'] = 'https://wiki.conceptnull.org' + img['src']
# Find all a tags with href not containing 'index.php'
links = soup.find_all('a', href=lambda href: href and 'index.php' not in href and not href.startswith('#') and not href.startswith('/File:'))
# Loop through each link and modify its href attribute
for link in links:
# Add _blank to href
link['target'] = '_blank'
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)
# Loop through each link and modify its href attribute
for link in links:
# Remove 'index.php' from the href attribute
link['href'] = link['href'].replace('/index.php', '')
# Remove any element with class 'mw-editsection'
edit_sections = soup.find_all(class_='mw-editsection')
@ -122,8 +133,15 @@ class WikiApp(Flask):
for file_link in file_description_tags:
file_link.unwrap()
soup = self.remove_thumbnail_img(soup)
return soup.prettify()
def remove_thumbnail_img(self, soup):
thumbnail = soup.find_all(attrs={"typeof": "mw:File/Thumb"})
for img in thumbnail:
img.decompose()
return soup
# Route for favicon.ico to prevent Flask from raising an error
def favicon(self):
return Response('', status=200)

96
static/assets/styles.css

@ -47,7 +47,7 @@ body {
height: 100px;
gap: 0px;
margin-bottom: 10px;
position: fixed;
/* position: fixed; */
z-index: 100;
}
@ -90,8 +90,83 @@ body {
}
.content {
margin-left: 20px;
margin-right: 20px;
width: 100%;
position: fixed;
}
.content-cont {
overflow: scroll;
overflow-x: hidden;
height: 100vh;
margin-left: 40px;
margin-top: 100px;
padding-right: 400px;
}
.content-cont h1{
font-size: 60px;
text-decoration: underline;
}
.content-cont h2{
font-size: 30px;
text-decoration: underline;
}
.content-cont h3{
font-size: 25px;
text-decoration: underline ;
}
.content-cont h4{
font-size: 20px;
}
.content-cont p {
font-size: 17.5px;
line-height: 30px;
}
.content-cont a {
color: black;
text-decoration: none;
background-color: white;
font-style: oblique;
padding-left: 5px;
padding-right: 5px;
}
.content-cont ul {
font-size: 20px;
border-style: none;
}
.content-cont li a{
border-style: none;
line-height: 40px;
}
.content-cont img{
height: 100%;
width: auto;
max-width: 900px;
border: white;
border-style: dashed;
transition: transform 0.3s ease-in-out;
}
.content-cont img:hover {
animation: rotate 1s steps(2) forwards infinite;
}
.content-cont::-webkit-scrollbar {
display: none;
}
.content-header {
/* padding-top: 160px; */
}
.section-cont {
@ -173,6 +248,11 @@ body {
z-index: 500;
}
.foot {
height: 200px;
width: auto;
}
/* Keyframes for the spin animation */
@keyframes spin {
@ -182,18 +262,18 @@ body {
@keyframes rotate {
0% {
transform: rotate(0deg);
transform: rotate(0deg) scaleX(100%);
}
25% {
transform: rotate(2deg);
transform: rotate(2deg) scaleX(95%);
}
50% {
transform: rotate(0deg);
transform: rotate(0deg) scaleX(100%);
}
75% {
transform: rotate(-2deg);
transform: rotate(-2deg) scaleX(95%);
}
100% {
transform: rotate(0deg);
transform: rotate(0deg) scaleX(100%);
}
}

11
templates/article.html

@ -1,8 +1,11 @@
{% extends "base.html" %}
{% block title %}Ø | {{ title }}{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
<div>
{{ content | safe }}
</div>
<div class='content-cont'>
<h1 class='content-header'>{{ title }}</h1>
{{ content | safe }}
<div class='foot'></div>
</div>
{% endblock %}

1
templates/home.html

@ -33,4 +33,5 @@
</div>
</div>
</div>
{% endblock %}
Loading…
Cancel
Save