mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-21 23:09:52 +00:00
update templates
This commit is contained in:
parent
49a215a587
commit
b4aa431f4d
13
gronk.py
13
gronk.py
@ -28,18 +28,15 @@ CSS_DIR = Path(os.getenv("CSS_DIR", "/opt/gronk/css"))
|
||||
JS_DIR = Path(os.getenv("JS_DIR", "/opt/gronk/js"))
|
||||
TEMPLATES_DIR = Path(os.getenv("TEMPLATES_DIR", "/opt/gronk/templates"))
|
||||
|
||||
|
||||
JINJA_ENV = jinja2.Environment(
|
||||
loader=jinja2.PackageLoader("gronk", str(TEMPLATES_DIR)),
|
||||
autoescape=jinja2.select_autoescape
|
||||
)
|
||||
JINJA_ENV = jinja2.Environment(loader=jinja2.PackageLoader("gronk"),
|
||||
autoescape=jinja2.select_autoescape)
|
||||
|
||||
JINJA_TEMPLATES = {}
|
||||
JINJA_TEMPLATE_TEXTARTICLE = JINJA_ENV.get_template("textarticle.html")
|
||||
JINJA_TEMPLATE_HOME_INDEX = JINJA_ENV.get_template("home_index.html")
|
||||
JINJA_TEMPLATE_TEXTARTICLE = JINJA_ENV.get_template("article-text.html")
|
||||
JINJA_TEMPLATE_HOME_INDEX = JINJA_ENV.get_template("home.html")
|
||||
JINJA_TEMPLATE_INDEX = JINJA_ENV.get_template("index.html")
|
||||
JINJA_TEMPLATE_ARTICLE = JINJA_ENV.get_template("article.html")
|
||||
|
||||
JINJA_TEMPLATE_PERMALINK = JINJA_ENV.get_template("permalink.html")
|
||||
|
||||
LICENSE = None
|
||||
GIT_REPO = None
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "article.html" %}
|
||||
{% block body %}
|
||||
{% block body_content %}
|
||||
<p> This file was not rendered by gronk because it is a plaintext file, not a markdown
|
||||
file.
|
||||
You access the raw file <a href="{{ raw_link }}">here</a>.
|
@ -1,8 +1,5 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
||||
{% extends "base.html" %}
|
||||
{% block head %}
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script>
|
||||
MathJax = {
|
||||
@ -12,12 +9,9 @@
|
||||
}
|
||||
</script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
{% endblock %}
|
||||
|
||||
<body>
|
||||
<div id="contentWrapper">
|
||||
<div id="content">
|
||||
{% block content %}
|
||||
<p class="smallText metadata"> title: {{ title }} </p>
|
||||
{% if lecture_slides %}
|
||||
<p class="smallText metadata"> lecture_slides: [
|
||||
@ -44,10 +38,10 @@
|
||||
{% endfor %}
|
||||
]</p>
|
||||
<p class="smallText metadata">
|
||||
{% if author is iterable %}
|
||||
written by {{ author }}
|
||||
{% else %}
|
||||
written by {% for auth in author %}{{ auth }}{% if loop.nextitem %}, {% endif %}{% endfor %}
|
||||
{% if author is string %}
|
||||
written by: {{ author }}
|
||||
{% elif author is iterable %}
|
||||
written by: [ {% for auth in author %}{{ auth }}{% if loop.nextitem %}, {% endif %}{% endfor %} ]
|
||||
{% endif %}
|
||||
</p>
|
||||
<p class="smallText metadata">
|
||||
@ -65,9 +59,7 @@
|
||||
<pre>{{ license }}</pre>
|
||||
</details>
|
||||
{% endif %}
|
||||
{% block body %}
|
||||
{{ content }}
|
||||
{% block body_content %}
|
||||
{{ content|safe }}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
18
templates/base.html
Normal file
18
templates/base.html
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
||||
<title>{{ title }}</title>
|
||||
{% block head %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a> (commit {{ gronk_commit }}) {% if notes_git_head_sha1 %}notes commit {{ notes_git_head_sha1 }}{% endif %}</p>
|
||||
</div>
|
||||
</body>
|
18
templates/home.html
Normal file
18
templates/home.html
Normal file
@ -0,0 +1,18 @@
|
||||
{% extends "article.html" %}
|
||||
{% block content %}
|
||||
{{ post['content']|safe }}
|
||||
<p>
|
||||
Browse <a href="/notes">here</a> or by tag <a href="/tags">here</a>.
|
||||
</p>
|
||||
|
||||
<div id="searchWrapper">
|
||||
<input autocomplete="off" placeholder="search" id="search" autofocus>
|
||||
</div>
|
||||
<p class="smallText" style="margin-top: 0; text-align: center;"> Press <kbd>Enter</kbd> to open first result or <kbd>Shift</kbd>+<kbd>Enter</kbd> to open in new tab</p>
|
||||
<div id="results">
|
||||
</div>
|
||||
|
||||
<script src="/js/fuse.js"> </script>
|
||||
<script> const search_data = {{ search_data|tojson }} </script>
|
||||
<script src="/js/search.js"> </script>
|
||||
{% endblock %}
|
@ -1,27 +0,0 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
||||
<title>{{ post['content'] }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
{{ post['content']|safe }}
|
||||
<p>
|
||||
Browse <a href="/notes">here</a> or by tag <a href="/tags">here</a>.
|
||||
</p>
|
||||
|
||||
<div id="searchWrapper">
|
||||
<input autocomplete="off" placeholder="search" id="search" autofocus>
|
||||
</div>
|
||||
<p class="smallText" style="margin-top: 0; text-align: center;"> Press <kbd>Enter</kbd> to open first result or <kbd>Shift</kbd>+<kbd>Enter</kbd> to open in new tab</p>
|
||||
<div id="results">
|
||||
</div>
|
||||
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a> (commit {{ n2w_commit }}) {% if notes_git_head_sha1 %}notes commit {{ notes_git_head_sha1 }}{% endif %}</p>
|
||||
</div>
|
||||
<script src="/js/fuse.js"> </script>
|
||||
<script> const search_data = {{ search_data|tojson }} </script>
|
||||
<script src="/js/search.js"> </script>
|
||||
</body>
|
@ -1,17 +1,9 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="content">
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
{% if not content_after_search %}
|
||||
{{ content }}
|
||||
{{ content|safe }}
|
||||
{% endif %}
|
||||
|
||||
{% if automatic_index %}
|
||||
@ -33,12 +25,9 @@
|
||||
{% endif %}
|
||||
|
||||
{% if content_after_search %}
|
||||
{{ content }}
|
||||
{{ content|safe }}
|
||||
{% endif %}
|
||||
<p style="font-size: 0.7em;"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a></p>
|
||||
</div>
|
||||
<script src="/js/fuse.js"> </script>
|
||||
<script> const search_data = {{ index_entries|tojson }} </script>
|
||||
<script src="/js/indexsearch.js"> </script>
|
||||
</body>
|
||||
|
||||
{% endblock %}
|
||||
|
10
templates/permalink.html
Normal file
10
templates/permalink.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% block content %}
|
||||
<p>
|
||||
You should be being redirected...
|
||||
Otherwise, click <a id="manual_redirect">here</a>.
|
||||
</p>
|
||||
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a></p>
|
||||
<script> const data = {{ data|tojson }} </script>
|
||||
<script src="/js/permalink.js"> </script>
|
||||
{% endblock %}
|
@ -1,19 +0,0 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<p>
|
||||
You should be being redirected...
|
||||
Otherwise, click <a id="manual_redirect">here</a>.
|
||||
</p>
|
||||
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a></p>
|
||||
</div>
|
||||
<script> const data = {{ data|tojson }} </script>
|
||||
<script src="/js/permalink.js"> </script>
|
||||
</body>
|
Loading…
Reference in New Issue
Block a user