From 012828c80e8a24b5dcde620a41d23bc119928d76 Mon Sep 17 00:00:00 2001 From: Markus Steinlein Date: Mon, 8 Mar 2021 21:07:40 +0100 Subject: [PATCH 1/8] 1st take on a simple responsive foto grid that supports being embedded into markdown blog posts via jinja. Needs some more modularisation though. --- app.py | 35 ++++++++++++++++++++++++++++++++++- pages/wacken2019.md | 5 ++++- static/fotogrid.css | 35 +++++++++++++++++++++++++++++++++++ templates/template.html | 1 + 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 static/fotogrid.css diff --git a/app.py b/app.py index 7697768..990c307 100755 --- a/app.py +++ b/app.py @@ -1,12 +1,20 @@ #!/usr/bin/env python3 # vim: set sw=4 ts=4 ex -from flask import Flask, render_template, url_for +from flask import Flask, render_template, render_template_string, url_for from flask_flatpages import FlatPages +from flask_flatpages.utils import pygmented_markdown from flask_fontawesome import FontAwesome from datetime import datetime +# directly support jinja within markdown blogposts +# https://flask-flatpages.readthedocs.io/en/v0.7.1/ +def markdown_with_jinja_renderer(text): + prerendered_body = render_template_string(text) + return pygmented_markdown(prerendered_body) + app = Flask(__name__) app.config['FLATPAGES_EXTENSION'] = '.md' +app.config['FLATPAGES_HTML_RENDERER'] = markdown_with_jinja_renderer app.config['FONTAWESOME_STYLES'] = ['solid', 'brands'] pages = FlatPages(app) @@ -43,5 +51,30 @@ def index(): return render_template('index.html', pages=sorted_pages) +def fotogrid(image_urls): + result = '
' + cols = 4 + images = divmod(len(image_urls), cols) + images_per_col = images[0] + if images[1] > 0: + images_per_col += 1 + nbr = 0 + for img in image_urls: + if (nbr % images_per_col) == 0: + if nbr > 0: + result += '
' # closing fotocolumn + result += '
' + result += '' + nbr += 1 + + result += "
" # closing fotocolum, fotorow + return result + + +app.jinja_env.globals.update(fotogrid=fotogrid) + +#template = Template('Fotogrid') +#template.globals['fotogrid'] = fotogrid + if __name__ == '__main__': app.run(host='0.0.0.0') diff --git a/pages/wacken2019.md b/pages/wacken2019.md index 167ff28..3538c50 100644 --- a/pages/wacken2019.md +++ b/pages/wacken2019.md @@ -103,4 +103,7 @@ Eine weiteres Spektakel steht uns noch mit der _30th Anniversary Show_ bevor, di **Parkway Drive** ziehen mit einem Fackelzug direkt durch die Menge auf die Bühne, eröffnen mit _Wishing Wells_ und _Prey_ und kündigen danach an, dass der Gig beinahe ausfallen musste, da sich der Bassist ein Knie gebrochen hatte. Sänger _Winston McCall_ kündigt daraufhin an: „Please welcome our new and improved bass player on a wheel chair!“ und Bassist _Jia O’Connor_ wird von seiner Mutter (!) im Rollstuhl auf die Bühne geschoben. Diese wiederum nutzt die Gelegenheit und startet zu _Carrion_ in die Menge, um zum ersten Mal in ihrem Leben zu crowdsurfen. Wie die Menge sie feiert! ## So 04.08.2019, Trennungsschmerz -Tja, am Sonntag ist dann wieder alles vorbei. Schade. Es löst sich auf, man verabschiedet sich und fährt wieder heim. Bei der Abfahrt vom Platz begegnen uns nochmal zufällig die Wabers und wir winken uns von Auto zu Auto zu, bevor wir uns in die Abreiseschlange einsortieren, diese aber bald wieder verlassen, da wir noch ein paar Tage an der Ostsee daranhängen werden. Schön war’s! \ No newline at end of file +Tja, am Sonntag ist dann wieder alles vorbei. Schade. Es löst sich auf, man verabschiedet sich und fährt wieder heim. Bei der Abfahrt vom Platz begegnen uns nochmal zufällig die Wabers und wir winken uns von Auto zu Auto zu, bevor wir uns in die Abreiseschlange einsortieren, diese aber bald wieder verlassen, da wir noch ein paar Tage an der Ostsee daranhängen werden. Schön war’s! + +
+{{ fotogrid(["static/img/woa2019_01.jpg", "static/img/woa2019_02.jpg", "static/img/woa2019_03.jpg", "static/img/woa2019_04.jpg", "static/img/woa2019_05.jpg", "static/img/woa2019_06.jpg", "static/img/woa2019_07.jpg", "static/img/woa2019_08.jpg", "static/img/woa2019_09.jpg", "static/img/woa2019_10.jpg", "static/img/woa2019_11.jpg", "static/img/woa2019_12.jpg", "static/img/woa2019_13.jpg", "static/img/woa2019_14.jpg"])|safe }} \ No newline at end of file diff --git a/static/fotogrid.css b/static/fotogrid.css new file mode 100644 index 0000000..227411d --- /dev/null +++ b/static/fotogrid.css @@ -0,0 +1,35 @@ + + +.fotorow { + display: flex; + flex-wrap: wrap; + padding: 0 4px; +} + +/* Create four equal columns that sits next to each other */ +.fotocolumn { + flex: 25%; + max-width: 25%; + padding: 0 4px; +} + +.fotocolumn img { + margin-top: 8px; + vertical-align: middle; +} + +/* Responsive layout - makes a two column-layout instead of four columns */ +@media (max-width: 1000px) { + .fotocolumn { + flex: 50%; + max-width: 50%; + } +} + +/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ +@media (max-width: 800px) { + .fotocolumn { + flex: 100%; + max-width: 100%; + } +} \ No newline at end of file diff --git a/templates/template.html b/templates/template.html index 0333291..e6518aa 100644 --- a/templates/template.html +++ b/templates/template.html @@ -4,6 +4,7 @@ {{ fontawesome_html() }} + From 8bf2a86e5bc1b7361089963d7170d5361d968432 Mon Sep 17 00:00:00 2001 From: Markus Steinlein <47111718+Ayreonaut@users.noreply.github.com> Date: Mon, 8 Mar 2021 22:14:55 +0100 Subject: [PATCH 2/8] Moved fotogrid code to its own file. Created subfolder for static css. --- app.py | 29 +---- fotogrid.py | 20 +++ static/css/fotogrid.css | 35 ++++++ static/css/style.css | 267 ++++++++++++++++++++++++++++++++++++++++ templates/template.html | 4 +- 5 files changed, 330 insertions(+), 25 deletions(-) create mode 100644 fotogrid.py create mode 100644 static/css/fotogrid.css create mode 100644 static/css/style.css diff --git a/app.py b/app.py index 990c307..74c7a84 100755 --- a/app.py +++ b/app.py @@ -6,17 +6,23 @@ from flask_flatpages.utils import pygmented_markdown from flask_fontawesome import FontAwesome from datetime import datetime +from fotogrid import fotogrid + # directly support jinja within markdown blogposts # https://flask-flatpages.readthedocs.io/en/v0.7.1/ def markdown_with_jinja_renderer(text): prerendered_body = render_template_string(text) return pygmented_markdown(prerendered_body) +# create app app = Flask(__name__) app.config['FLATPAGES_EXTENSION'] = '.md' app.config['FLATPAGES_HTML_RENDERER'] = markdown_with_jinja_renderer app.config['FONTAWESOME_STYLES'] = ['solid', 'brands'] +# register fotogrid with jinja +app.jinja_env.globals.update(fotogrid=fotogrid) + pages = FlatPages(app) fa = FontAwesome(app) @@ -51,30 +57,7 @@ def index(): return render_template('index.html', pages=sorted_pages) -def fotogrid(image_urls): - result = '
' - cols = 4 - images = divmod(len(image_urls), cols) - images_per_col = images[0] - if images[1] > 0: - images_per_col += 1 - nbr = 0 - for img in image_urls: - if (nbr % images_per_col) == 0: - if nbr > 0: - result += '
' # closing fotocolumn - result += '
' - result += '' - nbr += 1 - - result += "
" # closing fotocolum, fotorow - return result - - -app.jinja_env.globals.update(fotogrid=fotogrid) -#template = Template('Fotogrid') -#template.globals['fotogrid'] = fotogrid if __name__ == '__main__': app.run(host='0.0.0.0') diff --git a/fotogrid.py b/fotogrid.py new file mode 100644 index 0000000..efa18c1 --- /dev/null +++ b/fotogrid.py @@ -0,0 +1,20 @@ +# Provide a simple responsive fotogrid using flex layout. +# Depends on the css/fotogrid.css defined styles. +def fotogrid(image_urls): + result = '
' + cols = 4 + images = divmod(len(image_urls), cols) + images_per_col = images[0] + if images[1] > 0: + images_per_col += 1 + nbr = 0 + for img in image_urls: + if (nbr % images_per_col) == 0: + if nbr > 0: + result += '
' # closing fotocolumn + result += '
' + result += '' + nbr += 1 + + result += "
" # closing fotocolum, fotorow + return result \ No newline at end of file diff --git a/static/css/fotogrid.css b/static/css/fotogrid.css new file mode 100644 index 0000000..227411d --- /dev/null +++ b/static/css/fotogrid.css @@ -0,0 +1,35 @@ + + +.fotorow { + display: flex; + flex-wrap: wrap; + padding: 0 4px; +} + +/* Create four equal columns that sits next to each other */ +.fotocolumn { + flex: 25%; + max-width: 25%; + padding: 0 4px; +} + +.fotocolumn img { + margin-top: 8px; + vertical-align: middle; +} + +/* Responsive layout - makes a two column-layout instead of four columns */ +@media (max-width: 1000px) { + .fotocolumn { + flex: 50%; + max-width: 50%; + } +} + +/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ +@media (max-width: 800px) { + .fotocolumn { + flex: 100%; + max-width: 100%; + } +} \ No newline at end of file diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..c66d162 --- /dev/null +++ b/static/css/style.css @@ -0,0 +1,267 @@ +* { + box-sizing:border-box; +} + +html, body { + margin: 0; + padding: 0; +} + +html { + font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Droid Sans", "Helvetica Neue", Arial, sans-serif; + font-size: 1rem; + line-height: 1.5; +} + +body { + text-size-adjust:100% + background-attachment: fixed; + background-color: #000000; + color: rgba(255, 255, 255, 0.75); + display: flex; + flex-direction: column; + min-height:100vh +} + +main { + display: block +} + +a { + color: #c11012; + text-decoration:none +} + +a:hover, a:focus { + text-decoration:underline +} + +a strong { + color:inherit +} + +h1, h2, h3, h4, h5, h6, .site-title { + color: #313131; + font-weight: 600; + line-height: 1.25; + margin-bottom: .5rem; + text-rendering:optimizeLegibility +} + +h1 { + font-size:2rem +} + +h2 { + font-size: 1.5rem; + margin-top:1rem +} + +#sidebar { + flex: 0 0 auto; + padding:2rem +} + +#sidebar .site-title { + font-family: 'Abril Fatface', serif; + font-size: 1.25rem; + font-weight: normal; + margin-bottom: .5rem; + margin-top:0 +} + +#sidebar nav { + display: flex; +} + +#sidebar-nav-links { + flex-flow: column nowrap; +} + +.content { + background: #fff; + color: #515151; + padding:2rem +} + +.container { + display: flex; + flex: 1 1 auto; + flex-direction:column +} + +.container > .content { + flex-grow: 1; + padding-bottom:4rem +} + +.container > header { + background: transparent; + color: #fff; + margin:-1.5rem 2rem 2rem +} + +.container > header h1, .container > header h2 { + color:inherit +} + +.home #sidebar { + text-align:center +} + +.home #sidebar .site-title { + font-size:3.25rem +} + +.home #sidebar header ~ nav { + display:flex +} + +.home #sidebar > * :last-child { + margin-bottom:0.5rem +} + +/* + Styling for images meant to be embedded within blog post. Use it + by append #illustration to image url in markdown like: + ![Kitten](static/img/kitten.jpg#illustration) + */ +img[src $= "#illustration"] { + display: block; + margin-top: 8px; + margin-left: auto; + margin-right: auto; + border-radius: 8px; + width: 60%; +} + +/* + Display an external icon after each link that leads away from our site. + */ +.content a[href^="http://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after, +.content a[href^="https://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after { + + font-family: 'Font Awesome 5 Free'; + content: "\f35d"; + display: inline-block; + font: normal 16px/1 'Font Awesome 5 Free'; + margin-left: 4px; +} +/* + Display an Youtube icon left of every youtube link. + */ +.content a[href^="http://youtu.be"]:before, +.content a[href^="https://youtu.be"]:before, +.content a[href^="http://youtube.com"]:before, +.content a[href^="https://youtube.com"]:before { + + font-family: "Font Awesome 5 Brands"; + content: "\f167"; + display: inline-block; + font: normal 16px/1 'Font Awesome 5 Brands'; + margin-right: 4px; +} + + +@media (min-width: 49rem) { + body { + flex-direction: row; + min-height: 100vh; + -webkit-overflow-scrolling: touch; + overflow-y:auto + } + + body > * { + -webkit-overflow-scrolling: touch; + overflow-y:auto + } + + #sidebar, .home #sidebar { + text-align: left; + width:18rem + } + + #sidebar > * :last-child, .home #sidebar > * :last-child { + margin-bottom:0 + } + + #sidebar { + position: fixed; + left:0 + } + + #sidebar .site-title { + font-size:3.25rem; + text-align: center; + } + + #sidebar .site-title .back-arrow { + display:none + } + + #sidebar p.lead, #sidebar header ~ * { + display:block + } + + #sidebar header ~ nav { + display:flex + } + + .index #sidebar { + margin-bottom:0 + } + + .container { + background: #fff; + color: #515151; + min-height: 100vh; + padding: 4rem 4rem 0; + margin-left:18rem + } + + .container > header { + color: #313131; + margin:0 + } + + .container > header h1, .container > header h2 { + color:inherit + } + + .container > header h1:last-child, .container > header h2:last-child { + margin-bottom:.5rem + } + + .container > * { + max-width: 38rem; + padding:0 + } +} + +#sidebar a { + color:#fff +} + +#sidebar a:hover, #sidebar a:focus { + text-decoration:underline +} + +@media screen and (max-width: 783px) { + .container > .content { + padding:1.5rem + } + + #sidebar #sidebar-nav-links { + flex-direction: row; + justify-content:space-evenly + } + + #sidebar #sidebar-nav-links a { + display: inline-block; + margin:0 .5em + } + + .home.index #sidebar { + padding: 1rem + } +} diff --git a/templates/template.html b/templates/template.html index e6518aa..0f3ad42 100644 --- a/templates/template.html +++ b/templates/template.html @@ -3,8 +3,8 @@ {{ fontawesome_html() }} - - + + From bafe096b17b149b09a8d1d57297616ec7d6730bb Mon Sep 17 00:00:00 2001 From: Markus Steinlein <47111718+Ayreonaut@users.noreply.github.com> Date: Mon, 8 Mar 2021 22:15:50 +0100 Subject: [PATCH 3/8] Moved fotogrid code to its own file. Created subfolder for static css. --- static/fotogrid.css | 35 ------ static/style.css | 267 -------------------------------------------- 2 files changed, 302 deletions(-) delete mode 100644 static/fotogrid.css delete mode 100644 static/style.css diff --git a/static/fotogrid.css b/static/fotogrid.css deleted file mode 100644 index 227411d..0000000 --- a/static/fotogrid.css +++ /dev/null @@ -1,35 +0,0 @@ - - -.fotorow { - display: flex; - flex-wrap: wrap; - padding: 0 4px; -} - -/* Create four equal columns that sits next to each other */ -.fotocolumn { - flex: 25%; - max-width: 25%; - padding: 0 4px; -} - -.fotocolumn img { - margin-top: 8px; - vertical-align: middle; -} - -/* Responsive layout - makes a two column-layout instead of four columns */ -@media (max-width: 1000px) { - .fotocolumn { - flex: 50%; - max-width: 50%; - } -} - -/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */ -@media (max-width: 800px) { - .fotocolumn { - flex: 100%; - max-width: 100%; - } -} \ No newline at end of file diff --git a/static/style.css b/static/style.css deleted file mode 100644 index c66d162..0000000 --- a/static/style.css +++ /dev/null @@ -1,267 +0,0 @@ -* { - box-sizing:border-box; -} - -html, body { - margin: 0; - padding: 0; -} - -html { - font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Droid Sans", "Helvetica Neue", Arial, sans-serif; - font-size: 1rem; - line-height: 1.5; -} - -body { - text-size-adjust:100% - background-attachment: fixed; - background-color: #000000; - color: rgba(255, 255, 255, 0.75); - display: flex; - flex-direction: column; - min-height:100vh -} - -main { - display: block -} - -a { - color: #c11012; - text-decoration:none -} - -a:hover, a:focus { - text-decoration:underline -} - -a strong { - color:inherit -} - -h1, h2, h3, h4, h5, h6, .site-title { - color: #313131; - font-weight: 600; - line-height: 1.25; - margin-bottom: .5rem; - text-rendering:optimizeLegibility -} - -h1 { - font-size:2rem -} - -h2 { - font-size: 1.5rem; - margin-top:1rem -} - -#sidebar { - flex: 0 0 auto; - padding:2rem -} - -#sidebar .site-title { - font-family: 'Abril Fatface', serif; - font-size: 1.25rem; - font-weight: normal; - margin-bottom: .5rem; - margin-top:0 -} - -#sidebar nav { - display: flex; -} - -#sidebar-nav-links { - flex-flow: column nowrap; -} - -.content { - background: #fff; - color: #515151; - padding:2rem -} - -.container { - display: flex; - flex: 1 1 auto; - flex-direction:column -} - -.container > .content { - flex-grow: 1; - padding-bottom:4rem -} - -.container > header { - background: transparent; - color: #fff; - margin:-1.5rem 2rem 2rem -} - -.container > header h1, .container > header h2 { - color:inherit -} - -.home #sidebar { - text-align:center -} - -.home #sidebar .site-title { - font-size:3.25rem -} - -.home #sidebar header ~ nav { - display:flex -} - -.home #sidebar > * :last-child { - margin-bottom:0.5rem -} - -/* - Styling for images meant to be embedded within blog post. Use it - by append #illustration to image url in markdown like: - ![Kitten](static/img/kitten.jpg#illustration) - */ -img[src $= "#illustration"] { - display: block; - margin-top: 8px; - margin-left: auto; - margin-right: auto; - border-radius: 8px; - width: 60%; -} - -/* - Display an external icon after each link that leads away from our site. - */ -.content a[href^="http://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after, -.content a[href^="https://"]:not([href*="fdgl.rocks"]):not([href*="youtu.be"]):not([href*="youtube.com"]):after { - - font-family: 'Font Awesome 5 Free'; - content: "\f35d"; - display: inline-block; - font: normal 16px/1 'Font Awesome 5 Free'; - margin-left: 4px; -} -/* - Display an Youtube icon left of every youtube link. - */ -.content a[href^="http://youtu.be"]:before, -.content a[href^="https://youtu.be"]:before, -.content a[href^="http://youtube.com"]:before, -.content a[href^="https://youtube.com"]:before { - - font-family: "Font Awesome 5 Brands"; - content: "\f167"; - display: inline-block; - font: normal 16px/1 'Font Awesome 5 Brands'; - margin-right: 4px; -} - - -@media (min-width: 49rem) { - body { - flex-direction: row; - min-height: 100vh; - -webkit-overflow-scrolling: touch; - overflow-y:auto - } - - body > * { - -webkit-overflow-scrolling: touch; - overflow-y:auto - } - - #sidebar, .home #sidebar { - text-align: left; - width:18rem - } - - #sidebar > * :last-child, .home #sidebar > * :last-child { - margin-bottom:0 - } - - #sidebar { - position: fixed; - left:0 - } - - #sidebar .site-title { - font-size:3.25rem; - text-align: center; - } - - #sidebar .site-title .back-arrow { - display:none - } - - #sidebar p.lead, #sidebar header ~ * { - display:block - } - - #sidebar header ~ nav { - display:flex - } - - .index #sidebar { - margin-bottom:0 - } - - .container { - background: #fff; - color: #515151; - min-height: 100vh; - padding: 4rem 4rem 0; - margin-left:18rem - } - - .container > header { - color: #313131; - margin:0 - } - - .container > header h1, .container > header h2 { - color:inherit - } - - .container > header h1:last-child, .container > header h2:last-child { - margin-bottom:.5rem - } - - .container > * { - max-width: 38rem; - padding:0 - } -} - -#sidebar a { - color:#fff -} - -#sidebar a:hover, #sidebar a:focus { - text-decoration:underline -} - -@media screen and (max-width: 783px) { - .container > .content { - padding:1.5rem - } - - #sidebar #sidebar-nav-links { - flex-direction: row; - justify-content:space-evenly - } - - #sidebar #sidebar-nav-links a { - display: inline-block; - margin:0 .5em - } - - .home.index #sidebar { - padding: 1rem - } -} From 2bfa284ecd730c6daaed994bbac0c64de83d481a Mon Sep 17 00:00:00 2001 From: Markus Steinlein <47111718+Ayreonaut@users.noreply.github.com> Date: Mon, 8 Mar 2021 22:46:49 +0100 Subject: [PATCH 4/8] Some cosmetics to blog pages (user icon, hr, date formatting). Created folder drafts for posts that should be preserved, but not published yet. --- app.py | 5 +++++ drafts/slaughterlounge.md | 8 ++++++++ static/css/style.css | 5 +++++ templates/index.html | 2 +- templates/page.html | 3 ++- 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 drafts/slaughterlounge.md diff --git a/app.py b/app.py index 74c7a84..d489686 100755 --- a/app.py +++ b/app.py @@ -14,6 +14,10 @@ def markdown_with_jinja_renderer(text): prerendered_body = render_template_string(text) return pygmented_markdown(prerendered_body) +def format_date_string(date_string): + date = datetime.strptime(date_string, "%d.%m.%Y") + return date.strftime("%d. %B %Y") + # create app app = Flask(__name__) app.config['FLATPAGES_EXTENSION'] = '.md' @@ -22,6 +26,7 @@ app.config['FONTAWESOME_STYLES'] = ['solid', 'brands'] # register fotogrid with jinja app.jinja_env.globals.update(fotogrid=fotogrid) +app.jinja_env.globals.update(format_date_string=format_date_string) pages = FlatPages(app) fa = FontAwesome(app) diff --git a/drafts/slaughterlounge.md b/drafts/slaughterlounge.md new file mode 100644 index 0000000..1b45b90 --- /dev/null +++ b/drafts/slaughterlounge.md @@ -0,0 +1,8 @@ +title: Slaughterlounge rockt +date: 05.03.2021 +author: Markus +description: Slaughterlounge rockt + + + diff --git a/static/css/style.css b/static/css/style.css index c66d162..a340e7c 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -57,6 +57,11 @@ h2 { margin-top:1rem } +hr { + border: 1px solid #c11012; + border-radius: 2px; +} + #sidebar { flex: 0 0 auto; padding:2rem diff --git a/templates/index.html b/templates/index.html index 98c1719..e799d43 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,7 +6,7 @@ {% for page in pages %}

{{ page.title }}

{{ page.description }}

-

{{ page.date }}

+

{{ format_date_string(page.date) }}


{% endfor %} {% endblock %} diff --git a/templates/page.html b/templates/page.html index 74d52ec..aeb627e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -2,5 +2,6 @@ {% block content %}

{{ page.title }}

{{page.html|safe }}

- {{ page.author }} {{ page.date }} +
+  {{ page.author }} — {{ format_date_string(page.date) }} {% endblock %} From e3804e883d57e32ec093b2e9e91922ed7d582711 Mon Sep 17 00:00:00 2001 From: Markus Steinlein Date: Mon, 8 Mar 2021 22:48:03 +0100 Subject: [PATCH 5/8] Some cosmetics to blog pages (user icon, hr, date formatting). Created folder drafts for posts that should be preserved, but not published yet. --- pages/slaughterlounge.md | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 pages/slaughterlounge.md diff --git a/pages/slaughterlounge.md b/pages/slaughterlounge.md deleted file mode 100644 index 1b45b90..0000000 --- a/pages/slaughterlounge.md +++ /dev/null @@ -1,8 +0,0 @@ -title: Slaughterlounge rockt -date: 05.03.2021 -author: Markus -description: Slaughterlounge rockt - - - From 4b3d4023a35742b5fa0183f62ed5d60cd6bd6d4b Mon Sep 17 00:00:00 2001 From: Markus Steinlein <47111718+Ayreonaut@users.noreply.github.com> Date: Tue, 9 Mar 2021 08:23:47 +0100 Subject: [PATCH 6/8] Code cleanup to pass travis checks. --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index d489686..b81d584 100755 --- a/app.py +++ b/app.py @@ -5,7 +5,6 @@ from flask_flatpages import FlatPages from flask_flatpages.utils import pygmented_markdown from flask_fontawesome import FontAwesome from datetime import datetime - from fotogrid import fotogrid # directly support jinja within markdown blogposts @@ -14,10 +13,13 @@ def markdown_with_jinja_renderer(text): prerendered_body = render_template_string(text) return pygmented_markdown(prerendered_body) + +# function to reformat date from blog posts for better visualization on the pages def format_date_string(date_string): date = datetime.strptime(date_string, "%d.%m.%Y") return date.strftime("%d. %B %Y") + # create app app = Flask(__name__) app.config['FLATPAGES_EXTENSION'] = '.md' @@ -62,7 +64,5 @@ def index(): return render_template('index.html', pages=sorted_pages) - - if __name__ == '__main__': app.run(host='0.0.0.0') From 19677cb455d35f65481a17c5f16a0b3689af14f5 Mon Sep 17 00:00:00 2001 From: Markus Steinlein <47111718+Ayreonaut@users.noreply.github.com> Date: Tue, 9 Mar 2021 08:47:09 +0100 Subject: [PATCH 7/8] More style corrections. --- app.py | 1 + fotogrid.py | 2 +- static/css/style.css | 2 +- templates/template.html | 1 + tests/conftest.py | 1 + tests/test_index.py | 1 + tests/test_page_generation.py | 1 + tests/test_static_pages.py | 1 + 8 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index b81d584..dd62fee 100755 --- a/app.py +++ b/app.py @@ -7,6 +7,7 @@ from flask_fontawesome import FontAwesome from datetime import datetime from fotogrid import fotogrid + # directly support jinja within markdown blogposts # https://flask-flatpages.readthedocs.io/en/v0.7.1/ def markdown_with_jinja_renderer(text): diff --git a/fotogrid.py b/fotogrid.py index efa18c1..b487530 100644 --- a/fotogrid.py +++ b/fotogrid.py @@ -17,4 +17,4 @@ def fotogrid(image_urls): nbr += 1 result += "" # closing fotocolum, fotorow - return result \ No newline at end of file + return result diff --git a/static/css/style.css b/static/css/style.css index a340e7c..0f61aa1 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -14,7 +14,7 @@ html { } body { - text-size-adjust:100% + text-size-adjust:100%; background-attachment: fixed; background-color: #000000; color: rgba(255, 255, 255, 0.75); diff --git a/templates/template.html b/templates/template.html index 0f3ad42..f8bb121 100644 --- a/templates/template.html +++ b/templates/template.html @@ -6,6 +6,7 @@ + FdgL - Freunde des geordneten Lärms