From 283654d9a0d644ec3cd6e9c06898f11ac8effa78 Mon Sep 17 00:00:00 2001 From: mjfernez Date: Wed, 22 Dec 2021 16:59:15 -0500 Subject: Remove site as the parent directory, manual merge merges needed changes (and CSS) from mjfer.net branch --- static/main.css | 91 +++++++++++++++++++++++++++--------------------- templates/base.html | 6 ++-- templates/index.html | 2 +- templates/site/home.html | 2 +- views.py | 13 ++++--- 5 files changed, 62 insertions(+), 52 deletions(-) diff --git a/static/main.css b/static/main.css index 4db48f9..a0be844 100644 --- a/static/main.css +++ b/static/main.css @@ -1,13 +1,16 @@ -h1,h2,h3,h4 { +h1 { text-align: center; - margin: 0.25em auto; + margin: 1% auto; white-space: normal; } -h3,h4 { - text-align: justify; - margin: 0.25em auto; +h2,h3,h4 { + text-align: left; + margin: 1% auto; + white-space: normal; +} +h2.center { + text-align: center; } -/* class to optionally center h3 when we want it */ h3.center { text-align: center; } @@ -17,15 +20,15 @@ h1 { } h2 { font-size: 175%; - color: #404040; + color: #202020; } h3 { font-size: 150%; - color: #808080; + color: #404040; } h4 { font-size: 125%; - color: #bfbfbf; + color: #808080; } body { margin: 0 auto; @@ -35,27 +38,6 @@ body { white-space: normal; font-size: 120%; } - -.navbar { - text-align: center; - max-width: 95%; - display: block; -} -.content { - text-align: justify; - max-width: 85%; - display: inline-block; -} -.license { - font-size: 50%; - text-align: center; - max-width: 35%; - display: block; -} -/* Use for long text which doesnt wrap nicely */ -.long { - word-wrap: break-word; -} p { margin-top: 1.5%; margin-bottom: 1.5%; @@ -70,30 +52,59 @@ code { white-space: pre-wrap; word-wrap: break-all; } -table { - border-spacing: 0 10px; +th { + text-align: center; + padding: 1%; + background-color: #cccccc; } td { - text-align: left + text-align: center; + padding: 1%; } img { max-width: 100%; height: auto; width: auto; } -/*mobile*/ +img.icon { + filter: invert(50%); +} +iframe { + border: 0; +} + +.navbar { + text-align: center; + max-width: 95%; + display: block; +} +.content { + text-align: justify; + max-width: 85%; + display: inline-block; +} +.license { + font-size: 50%; + text-align: center; + max-width: 35%; + display: block; +} +.long { + word-wrap: break-word; +} + @media screen and (max-device-width: 480px) { - body { + body { max-width: 100%; font-size: 90%; - } - .license { + } + .license { font-size: 0; - } - p { + } + p { margin-top: 5%; margin-bottom: 5%; - } + } code.long { font-size: 65%; } diff --git a/templates/base.html b/templates/base.html index 5ca253a..c280184 100644 --- a/templates/base.html +++ b/templates/base.html @@ -14,19 +14,19 @@ -

{{ title }}

+

{{ title }}

{% block content %} {% endblock %}

{{ errors }}

- {% if parent_dir != '/site/' %} + {% if parent_dir %}

Go up to parent folder ({{ parent_dir }})

{% endif %}
diff --git a/templates/index.html b/templates/index.html index c8356fe..b612c63 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,7 +2,7 @@ {% block content %}
{% if description %} -{% include cur_path + '/.description' %} +{% include '/site/' + cur_path + '/.description' %} {% endif %} {% if dirs %} diff --git a/templates/site/home.html b/templates/site/home.html index 01d676e..46c1663 100644 --- a/templates/site/home.html +++ b/templates/site/home.html @@ -1,4 +1,4 @@ {% extends 'base.html' %} {% block content %} -

Home

+

Home

{% endblock %} diff --git a/views.py b/views.py index aed9f17..4a41248 100644 --- a/views.py +++ b/views.py @@ -18,9 +18,8 @@ CONTENT_BLOCK = ( @app.route("/") -@app.route("/site") -@app.route("/site/home.html") -@app.route("/site/index.html") +@app.route("/home.html") +@app.route("/index.html") @cache.cached() def home(): """ @@ -31,13 +30,13 @@ def home(): """ context = default_context() context.update( - {'title': app.config['HOME_TITLE'], 'parent_dir': '/site/'} + {'title': app.config['HOME_TITLE'], 'parent_dir': None} ) return render_template("site/home.html", **context) # from: https://pythonise.com/series/learning-flask/sending-files-with-flask -@app.route("/site/") +@app.route("/") @cache.cached() def render_file(path): """ @@ -55,7 +54,7 @@ def render_file(path): context.update( { 'title': path.split('.')[0].upper(), - 'parent_dir': '/site/' + '/'.join(path.split('/')[:-1]), + 'parent_dir': '/' + '/'.join(path.split('/')[:-1]), 'last_update': file_last_modified(abs_path), } ) @@ -82,7 +81,7 @@ def render_file(path): dirs, files, links, description = index_dir(abs_path) context.update( { - 'cur_path': 'site/' + path, + 'cur_path': path, 'cur_dir': path.split('/')[-1] + '/', 'dirs': dirs, 'files': files, -- cgit v1.2.3