mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +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"))
|
JS_DIR = Path(os.getenv("JS_DIR", "/opt/gronk/js"))
|
||||||
TEMPLATES_DIR = Path(os.getenv("TEMPLATES_DIR", "/opt/gronk/templates"))
|
TEMPLATES_DIR = Path(os.getenv("TEMPLATES_DIR", "/opt/gronk/templates"))
|
||||||
|
|
||||||
|
JINJA_ENV = jinja2.Environment(loader=jinja2.PackageLoader("gronk"),
|
||||||
JINJA_ENV = jinja2.Environment(
|
autoescape=jinja2.select_autoescape)
|
||||||
loader=jinja2.PackageLoader("gronk", str(TEMPLATES_DIR)),
|
|
||||||
autoescape=jinja2.select_autoescape
|
|
||||||
)
|
|
||||||
|
|
||||||
JINJA_TEMPLATES = {}
|
JINJA_TEMPLATES = {}
|
||||||
JINJA_TEMPLATE_TEXTARTICLE = JINJA_ENV.get_template("textarticle.html")
|
JINJA_TEMPLATE_TEXTARTICLE = JINJA_ENV.get_template("article-text.html")
|
||||||
JINJA_TEMPLATE_HOME_INDEX = JINJA_ENV.get_template("home_index.html")
|
JINJA_TEMPLATE_HOME_INDEX = JINJA_ENV.get_template("home.html")
|
||||||
JINJA_TEMPLATE_INDEX = JINJA_ENV.get_template("index.html")
|
JINJA_TEMPLATE_INDEX = JINJA_ENV.get_template("index.html")
|
||||||
JINJA_TEMPLATE_ARTICLE = JINJA_ENV.get_template("article.html")
|
JINJA_TEMPLATE_ARTICLE = JINJA_ENV.get_template("article.html")
|
||||||
|
JINJA_TEMPLATE_PERMALINK = JINJA_ENV.get_template("permalink.html")
|
||||||
|
|
||||||
LICENSE = None
|
LICENSE = None
|
||||||
GIT_REPO = None
|
GIT_REPO = None
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{% extends "article.html" %}
|
{% 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
|
<p> This file was not rendered by gronk because it is a plaintext file, not a markdown
|
||||||
file.
|
file.
|
||||||
You access the raw file <a href="{{ raw_link }}">here</a>.
|
You access the raw file <a href="{{ raw_link }}">here</a>.
|
@ -1,8 +1,5 @@
|
|||||||
<head>
|
{% extends "base.html" %}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
{% block head %}
|
||||||
<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" />
|
|
||||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||||
<script>
|
<script>
|
||||||
MathJax = {
|
MathJax = {
|
||||||
@ -12,62 +9,57 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||||
<title>{{ title }}</title>
|
{% endblock %}
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
{% block content %}
|
||||||
<div id="contentWrapper">
|
<p class="smallText metadata"> title: {{ title }} </p>
|
||||||
<div id="content">
|
{% if lecture_slides %}
|
||||||
<p class="smallText metadata"> title: {{ title }} </p>
|
<p class="smallText metadata"> lecture_slides: [
|
||||||
{% if lecture_slides %}
|
{% for slide in lecture_slides %}
|
||||||
<p class="smallText metadata"> lecture_slides: [
|
<a href="{{ slide }}">{{ slide }}</a>{% if loop.nextitem %},{% endif %}
|
||||||
{% for slide in lecture_slides %}
|
{% endfor %}
|
||||||
<a href="{{ slide }}">{{ slide }}</a>{% if loop.nextitem %},{% endif %}
|
]</p>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
]</p>
|
{% if lecture_notes %}
|
||||||
{% endif %}
|
<p class="smallText metadata"> lecture_notes: [
|
||||||
{% if lecture_notes %}
|
{% for note in lecture_notes %}
|
||||||
<p class="smallText metadata"> lecture_notes: [
|
<a href="{{ note }}">{{ note }}</a>{% if loop.nextitem %},{% endif %}
|
||||||
{% for note in lecture_notes %}
|
{% endfor %}
|
||||||
<a href="{{ note }}">{{ note }}</a>{% if loop.nextitem %},{% endif %}
|
]</p>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
]</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if uuid %}
|
{% if uuid %}
|
||||||
<p class="smallText metadata"> uuid: {{ uuid }} (<a href="/permalink?uuid={{ uuid }}">permalink</a>) </p>
|
<p class="smallText metadata"> uuid: {{ uuid }} (<a href="/permalink?uuid={{ uuid }}">permalink</a>) </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p class="smallText metadata"> tags: [
|
<p class="smallText metadata"> tags: [
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<a href="/tags/{{ tag }}">{{ tag }}</a>{% if loop.nextitem %},{% endif %}
|
<a href="/tags/{{ tag }}">{{ tag }}</a>{% if loop.nextitem %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
]</p>
|
]</p>
|
||||||
<p class="smallText metadata">
|
<p class="smallText metadata">
|
||||||
{% if author is iterable %}
|
{% if author is string %}
|
||||||
written by {{ author }}
|
written by: {{ author }}
|
||||||
{% else %}
|
{% elif author is iterable %}
|
||||||
written by {% for auth in author %}{{ auth }}{% if loop.nextitem %}, {% endif %}{% endfor %}
|
written by: [ {% for auth in author %}{{ auth }}{% if loop.nextitem %}, {% endif %}{% endfor %} ]
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<p class="smallText metadata">
|
<p class="smallText metadata">
|
||||||
syntax highlighting based on <a href="https://pygments.org/">Pygments'</a> default
|
syntax highlighting based on <a href="https://pygments.org/">Pygments'</a> default
|
||||||
colors
|
colors
|
||||||
</p>
|
</p>
|
||||||
<p class="smallText metadata">
|
<p class="smallText metadata">
|
||||||
page generated by <a href="https://git.alv.cx/alvierahman90/gronk">gronk</a>
|
page generated by <a href="https://git.alv.cx/alvierahman90/gronk">gronk</a>
|
||||||
</p>
|
</p>
|
||||||
{% if license %}
|
{% if license %}
|
||||||
<details id="license">
|
<details id="license">
|
||||||
<summary class="smallText">
|
<summary class="smallText">
|
||||||
License
|
License
|
||||||
</summary>
|
</summary>
|
||||||
<pre>{{ license }}</pre>
|
<pre>{{ license }}</pre>
|
||||||
</details>
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% block body %}
|
{% block body_content %}
|
||||||
{{ content }}
|
{{ content|safe }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
{% endblock %}
|
||||||
</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>
|
{% extends "base.html" %}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
{% block content %}
|
||||||
<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">
|
|
||||||
<h1>{{ title }}</h1>
|
<h1>{{ title }}</h1>
|
||||||
|
|
||||||
{% if not content_after_search %}
|
{% if not content_after_search %}
|
||||||
{{ content }}
|
{{ content|safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if automatic_index %}
|
{% if automatic_index %}
|
||||||
@ -33,12 +25,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if content_after_search %}
|
{% if content_after_search %}
|
||||||
{{ content }}
|
{{ content|safe }}
|
||||||
{% endif %}
|
{% 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 src="/js/fuse.js"> </script>
|
||||||
<script> const search_data = {{ index_entries|tojson }} </script>
|
<script> const search_data = {{ index_entries|tojson }} </script>
|
||||||
<script src="/js/indexsearch.js"> </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