From 15fc4c739ae07421c0ce1bed9fc05403312a2e86 Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Fri, 25 Oct 2024 21:46:28 +0200 Subject: added about page, changed css, added navbar --- .gitignore | 1 - content/about.md | 33 +++++ content/images/powerdebian.gif | Bin 0 -> 904 bytes content/images/vcss-blue.gif | Bin 0 -> 1176 bytes content/index.md | 25 ++-- content/styles/style.css | 92 ++++++++++--- content/thoughts.md | 4 + content/thoughts/first-entry.md | 7 + content/thoughts/thought-1.md | 9 -- content/thoughts/updated-css-and-navigation.md | 7 + generate.py | 134 ------------------- generate.sh | 5 + main.py | 170 +++++++++++++++++++++++++ templates/about.html.j2 | 4 + templates/index.html.j2 | 2 +- templates/template.html.j2 | 52 +++++++- templates/thought.html.j2 | 4 + templates/thoughts.html.j2 | 5 +- 18 files changed, 375 insertions(+), 179 deletions(-) create mode 100644 content/about.md create mode 100644 content/images/powerdebian.gif create mode 100644 content/images/vcss-blue.gif create mode 100644 content/thoughts.md create mode 100644 content/thoughts/first-entry.md delete mode 100644 content/thoughts/thought-1.md create mode 100644 content/thoughts/updated-css-and-navigation.md delete mode 100755 generate.py create mode 100755 generate.sh create mode 100755 main.py create mode 100644 templates/about.html.j2 create mode 100644 templates/thought.html.j2 diff --git a/.gitignore b/.gitignore index 4084451..846e08e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -.git venv static diff --git a/content/about.md b/content/about.md new file mode 100644 index 0000000..a49608a --- /dev/null +++ b/content/about.md @@ -0,0 +1,33 @@ +My name is Eva and I'm 27 year old computer science enthusiast. I graduated in +business information systems and am currently employed as an IT specialist +working in security and application administration. In my spare time I like to +go climbing and bouldering in a gym or do some recreational programming. I also +sometimes go on walks or "explorations". I search on +[openstreetmap](https://www.openstreetmap.org) for places in my area I've never +been to and take a walk there. Sometimes I find interesting or nice places and +take pictures. + +Other things I'm interested in: +- homelabbing, I have a server which runs a couple of webservices (and also this +website). Maybe I'll make a dedicated page to my setup in the future +- video games, especially grinding heavy ones like Disgaea. Also rogue-likes +- anime and manga +- I like to read books, horror is my preferred genre. I also like non-fiction +- Magic the Gathering + +My favourite anime of all time is Detective Conan and my favourite manga is +Baki. +My favourite video game series is Monster Hunter, especially Freedom Unite for +the PSP and 4 Ultimate for the 3DS. I also have a Medion 1998 OF CRT monitor +for playing retro games. + +I also listen to a lot of music. I can't even tell if I have a favourite genre, +because I listen to so many different types of music. Pop, Hip-Hop, Death Metal, +Grindcore, Speedcore, Vaporwave... I'm pretty much open to all genres, as long +as it sounds good I don't care what it is. +Some of my most listened to artists, in no particular order, are: +- Death Grips +- t+pazolite +- Utsu-P +- Pig Destroyer +- reol \ No newline at end of file diff --git a/content/images/powerdebian.gif b/content/images/powerdebian.gif new file mode 100644 index 0000000..1f617c8 Binary files /dev/null and b/content/images/powerdebian.gif differ diff --git a/content/images/vcss-blue.gif b/content/images/vcss-blue.gif new file mode 100644 index 0000000..697fbfc Binary files /dev/null and b/content/images/vcss-blue.gif differ diff --git a/content/index.md b/content/index.md index 9630063..5a0ac9c 100644 --- a/content/index.md +++ b/content/index.md @@ -1,14 +1,17 @@ -# eva's site +## hi -## About Me +I'm a 27 year old graduate in business information systems. I made this website +because I feel like too much of the internet is centered around social media and +sometimes it feels as if the whole internet is only a handful of websites. Years +back I really enjoyed browsing random websites created by people who just wanted +to share their hobby, which made the web feel way more alive and individual than +it is now. I still do this sometimes using [wiby.me](https://wiby.me). Maybe +this website can encourage someone to create their own. +In my spare time I like to go climbing and do some programming on various +projects. Occasionally I'll go on a walk in a random place I've never been in +and take pictures. Maybe I'll add a photo album sometime later. You can read +more about me [here](./about.html) -I'm a 27 year old graduate in business information systems. I like to go climbing -in my spare time and sometimes do some programming on various projects. -Occasionally I'll go on a walk in a random place I've never been in and take pictures. -Maybe I'll add a photo album sometime later. +## thoughts -## Thoughts - -You can read my thoughts [here](thoughts/thought-1.html). -This is just a short test for now. I'll add an index later, once I write some more -thoughts down. +I'll sometimes post my thoughts. You can read them [here](./thoughts.html). diff --git a/content/styles/style.css b/content/styles/style.css index 725b930..a731649 100644 --- a/content/styles/style.css +++ b/content/styles/style.css @@ -1,32 +1,94 @@ -body { +html { background-color: black; - color: pink; + font-family: 'Open Sans', sans-serif; + font-size: small; +} + +body { + background: black; + margin-left: 0px; + margin-right: 0px; + margin-bottom: 0px; + position: relative; +} + +footer { + padding: 300px 10px 5px 20px; + margin-bottom: 300px; + font-size: xx-small; + align-content: center; +} + +#headerflex { + display: flex; +} + +#headers { + flex-grow: 1; +} + +header nav { + flex-grow: 1; + display: inline; +} + +header div { + padding-left: 20px; + padding-bottom: 20px; +} + +nav ul { + margin: 0; + padding: 0; +} + +nav li { + display: inline-block; + list-style-type: none; +} + +nav a { + text-decoration: none; + display: block; + padding: 5px 6px 5px 6px; + color: black; +} + +#the_title { + text-decoration: none; + color: black; } -p { - padding-bottom: 30px; +#the_title h1 { + padding-left: 6px; +} + +#navbar { + text-align: left; + background-color: white; +} + +#footer_banners { + display: flex; + align-items: center; } #wrapper { - background-color: #000000; + background-color: #f1e7d5; max-width: 974px; min-width: 850px; margin: auto; margin-top: -10px; + padding: 30px; } -.center { - text-align: center; - justify-content: center; -} - -.left { - text-align: left; - justify-content: center; +#thoughts_list ul { + padding-left: 12px; + line-height: 20px; } -.limit-text-width { - width: 50%; +#thoughts_list ul li { + list-style: none; } .header_linker { diff --git a/content/thoughts.md b/content/thoughts.md new file mode 100644 index 0000000..ded8a19 --- /dev/null +++ b/content/thoughts.md @@ -0,0 +1,4 @@ +Here are all of the thoughts I've posted so far: + +- [first entry, 2024-10-24](./thoughts/first-entry.html) +- [updated css and navigation, 2024-10-25](./thoughts/updated-css-and-navigation.html) diff --git a/content/thoughts/first-entry.md b/content/thoughts/first-entry.md new file mode 100644 index 0000000..a2402b6 --- /dev/null +++ b/content/thoughts/first-entry.md @@ -0,0 +1,7 @@ +Finally putting some content on this website. I've had this domain for 18 months now +to host my matrix server, but never did anything with the site itself. I thought it +would be a waste not to put something here, so here you go. +This will most likely remain a purely static website where I'll sometimes post stuff. + +Got to put the "back to home" link into a proper navigation bar later. It's around 3AM right +now and I'm tired. diff --git a/content/thoughts/thought-1.md b/content/thoughts/thought-1.md deleted file mode 100644 index 1f4effe..0000000 --- a/content/thoughts/thought-1.md +++ /dev/null @@ -1,9 +0,0 @@ -# 2024-10-24 - -Finally putting some content on this website. I've had this domain for 18 months now -to host my matrix server, but never did anything with the site itself. I thought it -would be a waste not to put something here, so here you go. -This will most likely remain a purely static website where I'll sometimes post stuff. - -Got to put the "back to home" link into a proper navigation bar later. It's around 3AM right -now and I'm tired. diff --git a/content/thoughts/updated-css-and-navigation.md b/content/thoughts/updated-css-and-navigation.md new file mode 100644 index 0000000..0d2bb09 --- /dev/null +++ b/content/thoughts/updated-css-and-navigation.md @@ -0,0 +1,7 @@ +Implemented the index for all thoughts and changed the css. Also made a proper +navigation bar. Maybe I'll ditch the css completely and go brutalist style, not +sure yet. This website is currently just html+css. I wrote a very basic static +site generator with Jinja2, mistune and Pygments to convert markdown to html. +Maybe I'll rewrite this into Flask and use a database to store these entries. +But that will have to wait, if I ever decide to do this, because right now that +would be total overkill. diff --git a/generate.py b/generate.py deleted file mode 100755 index 65e6ef6..0000000 --- a/generate.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python3 - -from pygments import highlight -from pygments.lexers import get_lexer_by_name -from pygments.formatters import HtmlFormatter -from urllib.parse import urlparse - -import urllib.parse -import lxml.html -import mistune -import houdini -import jinja2 -import shutil -import os - -ENV = jinja2.Environment(loader=jinja2.FileSystemLoader('templates')) - -class MyRenderer(mistune.HTMLRenderer): - def block_code(self, code, info=None): - if not info: - return '\n
{}
\n'.format(houdini.escape_html(code.strip())) - lexer = get_lexer_by_name(info, stripall=True) - formatter = HtmlFormatter() - return highlight(code, lexer, formatter) - - def block_quote(self, content): - content = content[3:-5] - out = '\n
' - for line in houdini.escape_html(content.strip()).split("\n"): - out += '\n{}
'.format(line) - return out + '\n
' - - def image(self, link, text, title): - return "%s" % ( - urlparse(link)._replace(query='').geturl(), text, link - ) - - def heading(self, text, level): - hash_ = urllib.parse.quote_plus(text) - return "%s [#]\n" % ( - level, hash_, text, hash_, level - ) - -def parse_file(path): - with open(path, "r") as f: - unformatted = f.read() - - return parse_text(unformatted)[0] - -def parse_text(unformatted): - md = mistune.create_markdown( - renderer = MyRenderer(), - plugins = ["strikethrough", "table", "url", "task_lists", "def_list"] - ) - html = md(unformatted) - if html == "": - return "", "" - - return html, get_headers(html) - -def get_headers(html): - root = lxml.html.fromstring(html) - - headers = [] - thesmallestlevel = 7 - for node in root.xpath('//h1|//h2|//h3|//h4|//h5//h6'): - level = int(node.tag[-1]) - if level < thesmallestlevel: - thesmallestlevel = level - headers.append(( - urllib.parse.unquote_plus(node.attrib["id"]), - level, - "#%s" % node.attrib["id"]) - ) - - headers = [(i[0], i[1] - thesmallestlevel, i[2]) for i in headers] - md_template = jinja2.Template(""" -{% for text, depth, link in contents -%} - {{ " " * depth }} - [{{ text }}]({{ link }}) -{% endfor %} - """) - - return mistune.html(md_template.render(contents = headers)) - -def index(): - src_file = "content/index.md" - template_file = "index.html.j2" - dst_file = "index.html" - - template = ENV.get_template(template_file) - - with open(os.path.join('static/%s' % dst_file), 'w') as html_file: - with open(src_file, "r") as f: - html = template.render( - prefix = "./", - title = "eva's site", - content = parse_text(f.read())[0] - ) - html_file.write(html) - -def thoughts(): - src_path = "content/thoughts" - template_file = "thoughts.html.j2" - dst_path = "static/thoughts" - - template = ENV.get_template(template_file) - - if not os.path.isdir(dst_path): - os.mkdir(dst_path) - - for file in os.listdir(src_path): - dst_file = file.replace(".md", ".html") - with open(os.path.join(dst_path, dst_file), 'w') as html_file: - with open(os.path.join(src_path, file), 'r') as f: - html = template.render( - prefix = "../", - title = "eva's site :: thoughts", - content = parse_text(f.read())[0] - ) - html_file.write(html) - -def main(): - if os.path.isdir("static"): - shutil.rmtree("static") - os.mkdir("static") - - shutil.copytree("content/styles", "static/styles") - shutil.copytree("content/images", "static/images") - - index() - thoughts() - -if __name__ == '__main__': - main() diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..1b7247b --- /dev/null +++ b/generate.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source ./venv/bin/activate +python3 main.py +deactivate diff --git a/main.py b/main.py new file mode 100755 index 0000000..89c1544 --- /dev/null +++ b/main.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 + +from pygments import highlight +from pygments.lexers import get_lexer_by_name +from pygments.formatters import HtmlFormatter +from urllib.parse import urlparse + +import urllib.parse +import lxml.html +import mistune +import houdini +import jinja2 +import shutil +import os + +ENV = jinja2.Environment(loader=jinja2.FileSystemLoader('templates')) + +class MyRenderer(mistune.HTMLRenderer): + def block_code(self, code, info=None): + if not info: + return '\n
{}
\n'.format(houdini.escape_html(code.strip())) + lexer = get_lexer_by_name(info, stripall=True) + formatter = HtmlFormatter() + return highlight(code, lexer, formatter) + + def block_quote(self, content): + content = content[3:-5] + out = '\n
' + for line in houdini.escape_html(content.strip()).split("\n"): + out += '\n{}
'.format(line) + return out + '\n
' + + def image(self, link, text, title): + return "%s" % ( + urlparse(link)._replace(query='').geturl(), text, link + ) + + def heading(self, text, level): + hash_ = urllib.parse.quote_plus(text) + return "%s [#]\n" % ( + level, hash_, text, hash_, level + ) + +def parse_file(path): + with open(path, "r") as f: + unformatted = f.read() + + return parse_text(unformatted)[0] + +def parse_text(unformatted): + md = mistune.create_markdown( + renderer = MyRenderer(), + plugins = ["strikethrough", "table", "url", "task_lists", "def_list"] + ) + html = md(unformatted) + if html == "": + return "", "" + + return html, get_headers(html) + +def get_headers(html): + root = lxml.html.fromstring(html) + + headers = [] + thesmallestlevel = 7 + for node in root.xpath('//h1|//h2|//h3|//h4|//h5//h6'): + level = int(node.tag[-1]) + if level < thesmallestlevel: + thesmallestlevel = level + headers.append(( + urllib.parse.unquote_plus(node.attrib["id"]), + level, + "#%s" % node.attrib["id"]) + ) + + headers = [(i[0], i[1] - thesmallestlevel, i[2]) for i in headers] + md_template = jinja2.Template(""" + {% for text, depth, link in contents %} + {{ " " * depth }} - [{{ text }}]({{ link }}) + {% endfor %} + """) + + return mistune.html(md_template.render(contents = headers)) + +def index(): + src_file = "content/index.md" + template_file = "index.html.j2" + dst_file = "index.html" + + template = ENV.get_template(template_file) + + with open(os.path.join('static/%s' % dst_file), 'w') as html_file: + with open(src_file, "r") as f: + html = template.render( + prefix = "./", + title = "eva's site", + content = parse_text(f.read())[0] + ) + html_file.write(html) + +def thoughts_overview(): + src_file = "content/thoughts.md" + template_file = "thoughts.html.j2" + dst_file = "thoughts.html" + + template = ENV.get_template(template_file) + + with open(os.path.join('static/%s' % dst_file), 'w') as html_file: + with open(src_file, "r") as f: + html = template.render( + prefix = "./", + title = "my thoughts", + content = parse_text(f.read())[0] + ) + html_file.write(html) + + +def thoughts(): + src_path = "content/thoughts" + template_file = "thought.html.j2" + dst_path = "static/thoughts" + + template = ENV.get_template(template_file) + + if not os.path.isdir(dst_path): + os.mkdir(dst_path) + + for file in os.listdir(src_path): + dst_file = file.replace(".md", ".html") + with open(os.path.join(dst_path, dst_file), 'w') as html_file: + with open(os.path.join(src_path, file), 'r') as f: + html = template.render( + prefix = "../", + title = file.replace("-", " ").replace(".md", ""), + content = parse_text(f.read())[0] + ) + html_file.write(html) + +def about(): + src_file = "content/about.md" + template_file = "about.html.j2" + dst_file = "about.html" + + template = ENV.get_template(template_file) + + with open(os.path.join('static/%s' % dst_file), 'w') as html_file: + with open(src_file, "r") as f: + html = template.render( + prefix = "./", + title = "about me", + content = parse_text(f.read())[0] + ) + html_file.write(html) + + +def main(): + if os.path.isdir("static"): + shutil.rmtree("static") + os.mkdir("static") + + shutil.copytree("content/styles", "static/styles") + shutil.copytree("content/images", "static/images") + + index() + about() + thoughts_overview() + thoughts() + +if __name__ == '__main__': + main() diff --git a/templates/about.html.j2 b/templates/about.html.j2 new file mode 100644 index 0000000..8ebc3d7 --- /dev/null +++ b/templates/about.html.j2 @@ -0,0 +1,4 @@ +{% extends "template.html.j2" %} +{% block content %} + {{ content|safe }} +{% endblock %} \ No newline at end of file diff --git a/templates/index.html.j2 b/templates/index.html.j2 index 8257ab2..fa4873e 100644 --- a/templates/index.html.j2 +++ b/templates/index.html.j2 @@ -1,4 +1,4 @@ {% extends "template.html.j2" %} {% block content %} - {{ content }} + {{ content|safe }} {% endblock %} diff --git a/templates/template.html.j2 b/templates/template.html.j2 index 96f7f9d..4753dfd 100644 --- a/templates/template.html.j2 +++ b/templates/template.html.j2 @@ -2,14 +2,54 @@ - {{ title }} + + + cafebabe.gay :: {{ title }} + + + -
-
- {% block content %} - {% endblock %} -
+
+
+
+
+

{{ title }}

+ +
+
+
+
+ {% block content %} + {% endblock %} +
+
+

This website does not contain any javascript and will always remain javascript-free.

+ +
diff --git a/templates/thought.html.j2 b/templates/thought.html.j2 new file mode 100644 index 0000000..fa4873e --- /dev/null +++ b/templates/thought.html.j2 @@ -0,0 +1,4 @@ +{% extends "template.html.j2" %} +{% block content %} + {{ content|safe }} +{% endblock %} diff --git a/templates/thoughts.html.j2 b/templates/thoughts.html.j2 index 17b2797..69734fa 100644 --- a/templates/thoughts.html.j2 +++ b/templates/thoughts.html.j2 @@ -1,5 +1,6 @@ {% extends "template.html.j2" %} {% block content %} - Back to main page - {{ content }} +
+ {{ content|safe }} +
{% endblock %} -- cgit v1.2.3