diff options
| -rw-r--r-- | blog/articles/overthinking.xml | 18 | ||||
| -rw-r--r-- | blog/articles/test.xml | 8 | ||||
| -rw-r--r-- | blog/feed.xml | 26 | ||||
| -rwxr-xr-x | blog/generate.py | 31 | ||||
| -rw-r--r-- | blog/index.html | 79 | ||||
| -rw-r--r-- | blog/template.html | 24 | ||||
| -rw-r--r-- | error/404.html~ | 39 | ||||
| -rw-r--r-- | images/blog_background.png | bin | 0 -> 33955 bytes | |||
| -rw-r--r-- | images/buddy_holly.png | bin | 0 -> 232531 bytes | |||
| -rw-r--r-- | images/rss.png | bin | 0 -> 370 bytes | 
10 files changed, 162 insertions, 63 deletions
diff --git a/blog/articles/overthinking.xml b/blog/articles/overthinking.xml new file mode 100644 index 0000000..218710b --- /dev/null +++ b/blog/articles/overthinking.xml @@ -0,0 +1,18 @@ +<article> +  <p> +    Whenver I decide to add something to this website I always overthink on how +    to add the thing. In general I just overthink how I will do everything. It +    slows me down. Right now I am overthinking trying to think what to write +    and how to format it. I always end up doing way less when what I planned +    on doing. My partner overthinks a lot to. We overthink together. +    Though we overthink in different ways. I always end up going fuck this +    and throwing together a terrible mess while he just ends up giving up +    from the start. +    <br/><br/> +    Overthinking is just as much of a power as it is a curse. It fuels my +    ideas and thought process just as much as it slows me down. Its a quite +    difficult weapon to use but still quite deadly indeed. +    <br/><br/> +    Next time you overthink do what I do: eat junk food. +  </p> +</article> diff --git a/blog/articles/test.xml b/blog/articles/test.xml deleted file mode 100644 index 51d440b..0000000 --- a/blog/articles/test.xml +++ /dev/null @@ -1,8 +0,0 @@ -<article> -  <header> -    <h1>Over thinking</h1> -    <p> -      I over think a lot tbh. -    </p> -  </header> -</article> diff --git a/blog/feed.xml b/blog/feed.xml index a504f41..54d986c 100644 --- a/blog/feed.xml +++ b/blog/feed.xml @@ -11,18 +11,28 @@      </image>      <item> -      <title>test post</title> +      <title>Overthinking</title>        <link>http://nathansmith117.bevomit.or/blog</link> -      <pubDate>Sat, 29 Mar 2025 00:00:00 GMT</pubDate> +      <pubDate>Sat, 29 Mar 2025 11:42:00 GMT</pubDate>        <description>          <![CDATA[  <article> -  <header> -    <h1>Over thinking</h1> -    <p> -      I over think a lot tbh. -    </p> -  </header> +  <p> +    Whenver I decide to add something to this website I always overthink on how +    to add the thing. In general I just overthink how I will do everything. It +    slows me down. Right now I am overthinking trying to think what to write +    and how to format it. I always end up doing way less when what I planned +    on doing. My partner overthinks a lot to. We overthink together. +    Though we overthink in different ways. I always end up going fuck this +    and throwing together a terrible mess while he just ends up giving up +    from the start. +    <br/><br/> +    Overthinking is just as much of a power as it is a curse. It fuels my +    ideas and thought process just as much as it slows me down. Its a quite +    difficult weapon to use but still quite deadly indeed. +    <br/><br/> +    Next time you overthink do what I do: eat junk food. +  </p>  </article>          ]]>        </description> diff --git a/blog/generate.py b/blog/generate.py index 3471ef9..09c2320 100755 --- a/blog/generate.py +++ b/blog/generate.py @@ -6,6 +6,24 @@ A script to generate html from the rss feed  import xml.etree.ElementTree as et +# Generates a html table for the article +# I use table layout because fuck you +def make_article_table(article_info, article): +    html_text = """ +    <table border="1" width="60%"> +        <tr><td><h2>{title}</h2>--- {date}</td></tr> +        <tr><td>{article}</td></tr> +    </table> +    """ + +    html_text = html_text.format( +        title=article_info["title"], +        date=article_info["pubDate"], +        article=article +    ) +     +    return html_text +  def main():      tree = et.parse("feed.xml")      root = tree.getroot() @@ -17,14 +35,25 @@ def main():      with open("template.html", "r") as fp:          template = fp.read() +    article_html = "" +      # Get articles from rss      for item in channel.findall("item"): +        article_info = { +            "title": item.find("title").text, +            "pubDate": item.find("pubDate").text +        } +                  article = item.find("description").text          # Remove article tags.          article = article[article.find("<article>")+9::]          article = article[:article.find("</article>"):] -        print(article) +        article_html += make_article_table(article_info, article) + +    # Format the articles into the html +    template = template.format(articles=article_html) +    print(template)  if __name__ == "__main__":      main() diff --git a/blog/index.html b/blog/index.html new file mode 100644 index 0000000..3161591 --- /dev/null +++ b/blog/index.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<html> +  +<head> +    <title>Nathan's shitty blog</title> +    <link rel="alternate" type="application/rss+xml" title="Nathan's shitty blog" href="feed.xml"> + +<style> + +    /* the weird formating is because its going to be used in a python format +       string. +     */ +body { +    color: black; +    background-image: url('../images/blog_background.png'); +} + +table { +	color: black; +	background-color: #bebebe; +	margin-top: 10px; +	margin-bottom: 10px; +	margin-left: 10px; +	margin-right: 10px; +} + +</style> + +</head> +  +<body> +    <a href="../index.html"><img src="../images/back_home.png" alt="Back to home page"/></a> +     +    <center> +        <table border="1" width="60%"> +        	<tr> +        		<td> +                    <h1>Nathan's shitty blog</h1> +                    <a href="feed.xml" target="_blank"> +                        <img src="../images/rss.png" alt="rss"/> +                    </a> +                    <p> +                        I dont know if I will post often but here you go fucking world! +                        There is no topic, just me posting whatever is on my mind. Add +                        the feed to your feedreader <b>(you better have one)</b> so you +                        can stay updated on the things on my mind. +                    </p> +                </td> +            </tr> +        </table> + +        <!-- Python will insert the articles from rss here --> +         +    <table border="1" width="60%"> +        <tr><td><h2>Overthinking</h2>--- Sat, 29 Mar 2025 11:42:00 GMT</td></tr> +        <tr><td> +  <p> +    Whenver I decide to add something to this website I always overthink on how +    to add the thing. In general I just overthink how I will do everything. It +    slows me down. Right now I am overthinking trying to think what to write +    and how to format it. I always end up doing way less when what I planned +    on doing. My partner overthinks a lot to. We overthink together. +    Though we overthink in different ways. I always end up going fuck this +    and throwing together a terrible mess while he just ends up giving up +    from the start. +    <br/><br/> +    Overthinking is just as much of a power as it is a curse. It fuels my +    ideas and thought process just as much as it slows me down. Its a quite +    difficult weapon to use but still quite deadly indeed. +    <br/><br/> +    Next time you overthink do what I do: eat junk food. +  </p> +</td></tr> +    </table> +     +    </center> +</body> +</html> + diff --git a/blog/template.html b/blog/template.html index 719d3f3..bd460fe 100644 --- a/blog/template.html +++ b/blog/template.html @@ -6,34 +6,44 @@      <link rel="alternate" type="application/rss+xml" title="Nathan's shitty blog" href="feed.xml">  <style> -     -body { + +    /* the weird formating is because its going to be used in a python format +       string. +     */ +body {{      color: black; -    background-image: url(''); -} +    background-image: url('../images/blog_background.png'); +}} -table { +table {{  	color: black;  	background-color: #bebebe;  	margin-top: 10px;  	margin-bottom: 10px;  	margin-left: 10px;  	margin-right: 10px; -} +}}  </style>  </head>  <body> -    <a href="index.html"><img src="../images/back_home.png" alt="Back to home page"/></a> +    <a href="../index.html"><img src="../images/back_home.png" alt="Back to home page"/></a>      <center>          <table border="1" width="60%">          	<tr>          		<td>                      <h1>Nathan's shitty blog</h1> +                    <a href="feed.xml" target="_blank"> +                        <img src="../images/rss.png" alt="rss"/> +                    </a>                      <p> +                        I dont know if I will post often but here you go fucking world! +                        There is no topic, just me posting whatever is on my mind. Add +                        the feed to your feedreader <b>(you better have one)</b> so you +                        can stay updated on the things on my mind.                      </p>                  </td>              </tr> diff --git a/error/404.html~ b/error/404.html~ deleted file mode 100644 index f4353e0..0000000 --- a/error/404.html~ +++ /dev/null @@ -1,39 +0,0 @@ -<!DOCTYPE html> -<html> -  -<head> -    <title></title> - -<style> -     -body { -    color: black; -    background-image: url(''); -} - -table { -	color: black; -	background-color: #bebebe; -	margin-top: 10px; -	margin-bottom: 10px; -	margin-left: 10px; -	margin-right: 10px; -} - -</style> - -</head> -  -<body> -    <a href="index.html"><img src="images/back_home.png" alt="Back to home page"/></a> -     -    <center> -        <table border="1" width="60%"> -        	<tr> -        		<td> -                </td> -            </tr> -        </table> -    </center> -</body> -</html> diff --git a/images/blog_background.png b/images/blog_background.png Binary files differnew file mode 100644 index 0000000..b5b5c40 --- /dev/null +++ b/images/blog_background.png diff --git a/images/buddy_holly.png b/images/buddy_holly.png Binary files differnew file mode 100644 index 0000000..41d9aa5 --- /dev/null +++ b/images/buddy_holly.png diff --git a/images/rss.png b/images/rss.png Binary files differnew file mode 100644 index 0000000..1150c20 --- /dev/null +++ b/images/rss.png  | 
