mirror of
https://github.com/tiyn/beaker-blog.git
synced 2025-04-19 15:27:47 +02:00
Compare commits
No commits in common. "a936fd5ee649844b54305d10ab4faca725859bd5" and "488602b4e273efe506045b884276f27cc5b4e3c0" have entirely different histories.
a936fd5ee6
...
488602b4e2
14
src/app.py
14
src/app.py
@ -7,41 +7,35 @@ import config
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
TITLE = config.TITLE
|
TITLE = config.TITLE
|
||||||
STITLE = config.STITLE
|
|
||||||
STYLE = config.STYLE
|
STYLE = config.STYLE
|
||||||
LANGUAGE = config.LANGUAGE
|
LANGUAGE = config.LANGUAGE
|
||||||
DESCRIPTION = config.DESCRIPTION
|
DESCRIPTION = config.DESCRIPTION
|
||||||
WEBSITE = config.WEBSITE
|
WEBSITE = config.WEBSITE
|
||||||
MAIL = config.MAIL
|
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(e):
|
def page_not_found(e):
|
||||||
return render_template("error.html", title=TITLE, stitle=STITLE, errorcode="404", style=STYLE, language=LANGUAGE), 404
|
return render_template("error.html", title=TITLE, errorcode="404", style=STYLE, language=LANGUAGE), 404
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@app.route("/index.html")
|
@app.route("/index.html")
|
||||||
def index():
|
def index():
|
||||||
content = con_gen.gen_index_string()
|
content = con_gen.gen_index_string()
|
||||||
return render_template("index.html", title=TITLE, stitle=STITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
return render_template("index.html", title=TITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
||||||
|
|
||||||
@app.route("/imprint")
|
|
||||||
@app.route("/imprint.html")
|
|
||||||
def imprint():
|
|
||||||
return render_template("imprint.html", title=TITLE, stitle=STITLE, mail=MAIL, style=STYLE, language=LANGUAGE)
|
|
||||||
|
|
||||||
@app.route("/archive")
|
@app.route("/archive")
|
||||||
@app.route("/archive.html")
|
@app.route("/archive.html")
|
||||||
def archive():
|
def archive():
|
||||||
content = con_gen.gen_arch_string()
|
content = con_gen.gen_arch_string()
|
||||||
return render_template("archive.html", title=TITLE, stitle=STITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
return render_template("archive.html", title=TITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/entry/<path>")
|
@app.route("/entry/<path>")
|
||||||
def entry(path):
|
def entry(path):
|
||||||
content = con_gen.gen_stand_string(path)
|
content = con_gen.gen_stand_string(path)
|
||||||
if content != "":
|
if content != "":
|
||||||
return render_template("standalone.html", title=TITLE, stitle=STITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
return render_template("standalone.html", title=TITLE, content_string=content, style=STYLE, language=LANGUAGE)
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
# Name/title of your blog
|
# Name/title of your blog
|
||||||
TITLE = "Beaker Blog"
|
TITLE = "Beaker Blog"
|
||||||
|
|
||||||
# Short name/title of your blog
|
|
||||||
STITLE = "Beaker Blog"
|
|
||||||
|
|
||||||
# Description for RSS of your blog
|
# Description for RSS of your blog
|
||||||
DESCRIPTION = "This is your personal Beaker Blog."
|
DESCRIPTION = "This is your personal Beaker Blog."
|
||||||
|
|
||||||
@ -15,6 +12,3 @@ STYLE = "dark"
|
|||||||
|
|
||||||
# Language for the titles: en-us or de-de
|
# Language for the titles: en-us or de-de
|
||||||
LANGUAGE = "en-us"
|
LANGUAGE = "en-us"
|
||||||
|
|
||||||
# Mail address for the imprint
|
|
||||||
MAIL = "dummy@mail.com"
|
|
||||||
|
@ -27,12 +27,12 @@ def gen_arch_string():
|
|||||||
if path.exists(path_ex):
|
if path.exists(path_ex):
|
||||||
name_list = os.listdir(path_ex)
|
name_list = os.listdir(path_ex)
|
||||||
full_list = [os.path.join(path_ex, i) for i in name_list]
|
full_list = [os.path.join(path_ex, i) for i in name_list]
|
||||||
contents = sorted(full_list, key=os.path.getmtime)
|
contents = sorted(full_list, key=os.path.getctime)
|
||||||
content_string = ""
|
content_string = ""
|
||||||
last_month = ""
|
last_month = ""
|
||||||
for file in reversed(contents):
|
for file in reversed(contents):
|
||||||
curr_date = datetime.fromtimestamp(os.path.getmtime(file)).strftime("%Y-%m-%d")
|
curr_date = datetime.fromtimestamp(os.path.getctime(file)).strftime("%Y-%m-%d")
|
||||||
curr_month = datetime.fromtimestamp(os.path.getmtime(file)).strftime("%B %Y")
|
curr_month = datetime.fromtimestamp(os.path.getctime(file)).strftime("%B %Y")
|
||||||
if curr_month != last_month:
|
if curr_month != last_month:
|
||||||
if last_month != "":
|
if last_month != "":
|
||||||
content_string += "</ul>\n"
|
content_string += "</ul>\n"
|
||||||
@ -67,7 +67,7 @@ def gen_index_string():
|
|||||||
if path.exists(path_ex):
|
if path.exists(path_ex):
|
||||||
name_list = os.listdir(path_ex)
|
name_list = os.listdir(path_ex)
|
||||||
full_list = [os.path.join(path_ex, i) for i in name_list]
|
full_list = [os.path.join(path_ex, i) for i in name_list]
|
||||||
contents = sorted(full_list, key=os.path.getmtime)
|
contents = sorted(full_list, key=os.path.getctime)
|
||||||
for file in reversed(contents):
|
for file in reversed(contents):
|
||||||
filename = pathlib.PurePath(file)
|
filename = pathlib.PurePath(file)
|
||||||
purefile = filename
|
purefile = filename
|
||||||
@ -82,11 +82,12 @@ def gen_index_string():
|
|||||||
pathlib.PurePath(file).name + "\">" + \
|
pathlib.PurePath(file).name + "\">" + \
|
||||||
title + "</a>" +"</h2>\n"
|
title + "</a>" +"</h2>\n"
|
||||||
content_string += "<small>" + \
|
content_string += "<small>" + \
|
||||||
datetime.fromtimestamp(os.path.getmtime(
|
datetime.fromtimestamp(os.path.getctime(
|
||||||
file)).strftime("%Y-%m-%d") + "</small><br><br>"
|
file)).strftime("%Y-%m-%d") + "</small><br><br>"
|
||||||
if file.endswith(".html"):
|
if file.endswith(".html"):
|
||||||
for line in text:
|
for line in text:
|
||||||
content_string += line
|
content_string += line
|
||||||
|
content_string += "<br>"
|
||||||
if file.endswith(".md"):
|
if file.endswith(".md"):
|
||||||
content_string += gen_md_content(file, 2)
|
content_string += gen_md_content(file, 2)
|
||||||
content_string += "</div>"
|
content_string += "</div>"
|
||||||
@ -110,7 +111,7 @@ def gen_stand_string(path_ex):
|
|||||||
if path.exists(filename):
|
if path.exists(filename):
|
||||||
title = open(filename).readline().rstrip("\n")
|
title = open(filename).readline().rstrip("\n")
|
||||||
text = open(filename).readlines()[1:]
|
text = open(filename).readlines()[1:]
|
||||||
curr_date = datetime.fromtimestamp(os.path.getmtime(filename)).strftime("%Y-%m-%d")
|
curr_date = datetime.fromtimestamp(os.path.getctime(filename)).strftime("%Y-%m-%d")
|
||||||
filename_no_end = filename.split(".", 1)[0]
|
filename_no_end = filename.split(".", 1)[0]
|
||||||
filename_no_end = filename_no_end.split("/")[-1]
|
filename_no_end = filename_no_end.split("/")[-1]
|
||||||
content_string += "<h1>" + title + "</h1>\n"
|
content_string += "<h1>" + title + "</h1>\n"
|
||||||
@ -164,7 +165,7 @@ def get_rss_string():
|
|||||||
if path.exists(path_ex):
|
if path.exists(path_ex):
|
||||||
name_list = os.listdir(path_ex)
|
name_list = os.listdir(path_ex)
|
||||||
full_list = [os.path.join(path_ex, i) for i in name_list]
|
full_list = [os.path.join(path_ex, i) for i in name_list]
|
||||||
contents = sorted(full_list, key=os.path.getmtime)
|
contents = sorted(full_list, key=os.path.getctime)
|
||||||
content_string = ""
|
content_string = ""
|
||||||
for file in reversed(contents):
|
for file in reversed(contents):
|
||||||
filename = pathlib.PurePath(file)
|
filename = pathlib.PurePath(file)
|
||||||
@ -178,7 +179,7 @@ def get_rss_string():
|
|||||||
content_string += "<guid>" + config.WEBSITE + \
|
content_string += "<guid>" + config.WEBSITE + \
|
||||||
"/index.html#" + filename + "</guid>\n"
|
"/index.html#" + filename + "</guid>\n"
|
||||||
content_string += "<pubDate>" + \
|
content_string += "<pubDate>" + \
|
||||||
datetime.fromtimestamp(os.path.getmtime(file)).strftime(
|
datetime.fromtimestamp(os.path.getctime(file)).strftime(
|
||||||
"%Y-%m-%d") + "</pubDate>\n"
|
"%Y-%m-%d") + "</pubDate>\n"
|
||||||
content_string += "<description>"
|
content_string += "<description>"
|
||||||
for line in text:
|
for line in text:
|
||||||
|
@ -51,13 +51,11 @@ span {
|
|||||||
|
|
||||||
.hide-menu:hover,
|
.hide-menu:hover,
|
||||||
.main-menu a:hover,
|
.main-menu a:hover,
|
||||||
.main-menu-dropdown a:hover,
|
|
||||||
.show-menu:hover {
|
.show-menu:hover {
|
||||||
color: var(--menulink1);
|
color: var(--menulink1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-menu a,
|
.main-menu a {
|
||||||
.main-menu-dropdown a {
|
|
||||||
color: var(--menulink0);
|
color: var(--menulink0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,13 +59,11 @@ span {
|
|||||||
|
|
||||||
.hide-menu:hover,
|
.hide-menu:hover,
|
||||||
.main-menu a:hover,
|
.main-menu a:hover,
|
||||||
.main-menu-dropdown a:hover,
|
|
||||||
.show-menu:hover {
|
.show-menu:hover {
|
||||||
color: var(--menulink1);
|
color: var(--menulink1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-menu a,
|
.main-menu a {
|
||||||
.main-menu-dropdown a {
|
|
||||||
color: var(--menulink0);
|
color: var(--menulink0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,7 @@ footer .center {
|
|||||||
.main-menu-dropdown img {
|
.main-menu-dropdown img {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.main-menu-dropdown span,
|
.main-menu-dropdown span {
|
||||||
.main-menu-dropdown a {
|
|
||||||
float: left;
|
float: left;
|
||||||
font-family: Georgia, serif;
|
font-family: Georgia, serif;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
@ -160,30 +159,12 @@ footer .center {
|
|||||||
.entry {
|
.entry {
|
||||||
border-radius: 0 10px 30px 0;
|
border-radius: 0 10px 30px 0;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
padding-left: 20px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2 {
|
.entry h1,
|
||||||
padding-top: 20px;
|
.entry h2 {
|
||||||
padding-bottom: 20px;
|
margin: 5px auto 2px auto;
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.imprint h1:first-child {
|
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blog h1:first-child {
|
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entry h2:first-child {
|
|
||||||
padding-top: 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry ul {
|
.entry ul {
|
||||||
@ -191,12 +172,7 @@ h3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
padding-top: 20px;
|
padding:20px;
|
||||||
padding-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entry figure:last-child {
|
|
||||||
padding-bottom:0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
{% extends "template.html" %}
|
|
||||||
{% block content %}
|
|
||||||
<div class="container">
|
|
||||||
<div class="imprint">
|
|
||||||
<h1>{% if language=="de-de" %}Impressum{% else %}Imprint{% endif %}</h1><br>
|
|
||||||
{% if language=="de-de" %}
|
|
||||||
<h2>Kontakt:</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href='mailto:{{ mail }}'>E-Mail</a></li>
|
|
||||||
</ul>
|
|
||||||
<h2>Haftungsausschluss:</h2>
|
|
||||||
<h3>Haftung für Inhalte</h3>
|
|
||||||
<p>
|
|
||||||
Die Inhalte unserer Seiten wurden mit größter Sorgfalt erstellt. Für die Richtigkeit, Vollständigkeit und
|
|
||||||
Aktualität der Inhalte können wir jedoch keine Gewähr übernehmen. Als Diensteanbieter sind wir gemäß § 7 Abs.1
|
|
||||||
TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich. Nach §§ 8 bis 10 TMG sind
|
|
||||||
wir als Diensteanbieter jedoch nicht verpflichtet, übermittelte oder gespeicherte fremde Informationen zu
|
|
||||||
überwachen oder nach Umständen zu forschen, die auf eine rechtswidrige Tätigkeit hinweisen. Verpflichtungen zur
|
|
||||||
Entfernung oder Sperrung der Nutzung von Informationen nach den allgemeinen Gesetzen bleiben hiervon unberührt.
|
|
||||||
Eine diesbezügliche Haftung ist jedoch erst ab dem Zeitpunkt der Kenntnis einer konkreten Rechtsverletzung
|
|
||||||
möglich. Bei Bekanntwerden von entsprechenden Rechtsverletzungen werden wir diese Inhalte umgehend
|
|
||||||
entfernen.
|
|
||||||
</p>
|
|
||||||
<h3>Haftung für Links</h3>
|
|
||||||
<p>
|
|
||||||
Unser Angebot enthält Links zu externen Webseiten Dritter, auf deren Inhalte wir keinen Einfluss haben. Deshalb
|
|
||||||
können wir für diese fremden Inhalte auch keine Gewähr übernehmen. Für die Inhalte der verlinkten Seiten ist
|
|
||||||
stets der jeweilige Anbieter oder Betreiber der Seiten verantwortlich. Die verlinkten Seiten wurden zum
|
|
||||||
Zeitpunkt der Verlinkung auf mögliche Rechtsverstöße überprüft. Rechtswidrige Inhalte waren zum Zeitpunkt der
|
|
||||||
Verlinkung nicht erkennbar. Eine permanente inhaltliche Kontrolle der verlinkten Seiten ist jedoch ohne konkrete
|
|
||||||
Anhaltspunkte einer Rechtsverletzung nicht zumutbar. Bei Bekanntwerden von Rechtsverletzungen werden wir
|
|
||||||
derartige Links umgehend entfernen.
|
|
||||||
</p>
|
|
||||||
<h3>Urheberrecht</h3>
|
|
||||||
<p>
|
|
||||||
Die durch die Seitenbetreiber erstellten Inhalte und Werke auf diesen Seiten unterliegen dem deutschen
|
|
||||||
Urheberrecht. Die Vervielfältigung, Bearbeitung, Verbreitung und jede Art der Verwertung außerhalb der Grenzen
|
|
||||||
des Urheberrechtes bedürfen der schriftlichen Zustimmung des jeweiligen Autors bzw. Erstellers. Downloads und
|
|
||||||
Kopien dieser Seite sind nur für den privaten, nicht kommerziellen Gebrauch gestattet. Soweit die Inhalte auf
|
|
||||||
dieser Seite nicht vom Betreiber erstellt wurden, werden die Urheberrechte Dritter beachtet. Insbesondere werden
|
|
||||||
Inhalte Dritter als solche gekennzeichnet. Sollten Sie trotzdem auf eine Urheberrechtsverletzung aufmerksam
|
|
||||||
werden, bitten wir um einen entsprechenden Hinweis. Bei Bekanntwerden von Rechtsverletzungen werden wir
|
|
||||||
derartige Inhalte umgehend entfernen.
|
|
||||||
</p>
|
|
||||||
{% else %}
|
|
||||||
<h2>Contact:</h2>
|
|
||||||
<p><a href='mailto:{{ mail }}'>E-Mail</a></p>
|
|
||||||
<h2>Disclaimer:</h2>
|
|
||||||
<h3>Liability for Content</h3>
|
|
||||||
<p>
|
|
||||||
The contents of our website have been created with the greatest possible care. However, we cannot guarantee the
|
|
||||||
contents' accuracy, completeness, or topicality. According to Section 7, paragraph 1 of the TMG (Telemediengesetz
|
|
||||||
-
|
|
||||||
German Telemedia Act), we as service providers are liable for our content on these pages by general laws. However,
|
|
||||||
according to Sections 8 to 10 of the TMG, we service providers are not obliged to monitor external information
|
|
||||||
transmitted or stored or investigate circumstances pointing to illegal activity. Obligations to remove or block
|
|
||||||
the
|
|
||||||
use of information under general laws remain unaffected. However, a liability in this regard is only possible from
|
|
||||||
the moment of knowledge of a specific infringement. Upon notification of such violations, we will remove the
|
|
||||||
content
|
|
||||||
immediately.
|
|
||||||
</p>
|
|
||||||
<h3>Liability for Links</h3>
|
|
||||||
<p>
|
|
||||||
Our website contains links to external websites, over whose contents we have no control. Therefore, we cannot
|
|
||||||
accept
|
|
||||||
any liability for these external contents. The respective provider or operator of the websites is always
|
|
||||||
responsible
|
|
||||||
for the contents of the linked pages. The linked pages were checked for possible legal violations at the time of
|
|
||||||
linking. Illegal contents were not identified at the time of linking. However, permanent monitoring of the
|
|
||||||
contents
|
|
||||||
of the linked pages is not reasonable without specific indications of a violation. Upon notification of
|
|
||||||
violations,
|
|
||||||
we will remove such links immediately.
|
|
||||||
</p>
|
|
||||||
<h3>Copyright</h3>
|
|
||||||
<p>
|
|
||||||
The contents and works on these pages created by the site operator are subject to German copyright law. The
|
|
||||||
duplication, processing, distribution, and any kind of utilization outside the limits of copyright require the
|
|
||||||
written consent of the respective author or creator. Downloads and copies of these pages are only permitted for
|
|
||||||
private, non-commercial use. In so far as the contents on this site were not created by the operator, the
|
|
||||||
copyrights
|
|
||||||
of third parties are respected. In particular, third-party content is marked as such. Should you become aware of a
|
|
||||||
copyright infringement, please inform us accordingly. Upon notification of violations, we will remove such
|
|
||||||
contents
|
|
||||||
immediately.
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -11,7 +11,7 @@
|
|||||||
<div class="main-menu-dropdown">
|
<div class="main-menu-dropdown">
|
||||||
<a href="{{ url_for('index') }}">
|
<a href="{{ url_for('index') }}">
|
||||||
<img class="logo" src="{{ url_for('static', filename='graphics/logo.png') }}">
|
<img class="logo" src="{{ url_for('static', filename='graphics/logo.png') }}">
|
||||||
{{ stitle }}
|
<span>{{ title }}</span>
|
||||||
</a>
|
</a>
|
||||||
<input type="checkbox" id="main-menu-check">
|
<input type="checkbox" id="main-menu-check">
|
||||||
<label for="main-menu-check" class="show-menu">☰</label>
|
<label for="main-menu-check" class="show-menu">☰</label>
|
||||||
@ -28,9 +28,6 @@
|
|||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<footer>
|
<footer>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<a href="{{ url_for('imprint') }}">
|
|
||||||
{% if language=="de-de" %}Impressum und Kontakt{% else %}Imprint and Contact{% endif %}
|
|
||||||
</a><br>
|
|
||||||
Made with <a href="https://github.com/tiyn/beaker-blog">Beaker Blog</a>.
|
Made with <a href="https://github.com/tiyn/beaker-blog">Beaker Blog</a>.
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user