Update code of menu
This commit is contained in:
parent
93c0a522b7
commit
a290c2bea3
@ -11,7 +11,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||||||
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
||||||
index_template = templates.get_template("index.html")
|
index_template = templates.get_template("index.html")
|
||||||
gallery_index_template = templates.get_template("gallery-index.html")
|
gallery_index_template = templates.get_template("gallery-index.html")
|
||||||
menu_template = templates.get_template("menu.html")
|
page_template = templates.get_template("page.html")
|
||||||
|
|
||||||
class Cache(object):
|
class Cache(object):
|
||||||
cache_file_path = os.path.join(os.getcwd(), ".prosopopee_cache")
|
cache_file_path = os.path.join(os.getcwd(), ".prosopopee_cache")
|
||||||
@ -149,8 +149,10 @@ def main():
|
|||||||
|
|
||||||
if settings.get('menu'):
|
if settings.get('menu'):
|
||||||
for item in settings["menu"]:
|
for item in settings["menu"]:
|
||||||
item_file = item.replace(" ", "_").lower()
|
for link in item:
|
||||||
open(os.path.join("build", item_file+".html"), "w").write(menu_template.render(settings=yaml.safe_load(open(item_file+".yaml", "r")), galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
item_file = link
|
||||||
|
error(os.path.exists(os.path.join(os.getcwd(), item_file+".yaml")), "I can't find a "+item_file+".yaml in the current working directory")
|
||||||
|
open(os.path.join("build", item_file+".html"), "w").write(page_template.render(settings=settings, pages=yaml.safe_load(open(item_file+".yaml", "r")), galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
||||||
|
|
||||||
open(os.path.join("build", "index.html"), "w").write(index_template.render(settings=settings, galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
open(os.path.join("build", "index.html"), "w").write(index_template.render(settings=settings, galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
||||||
|
|
||||||
|
@ -18,20 +18,7 @@
|
|||||||
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
|
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
|
||||||
<hr>
|
<hr>
|
||||||
{% if settings.menu -%}
|
{% if settings.menu -%}
|
||||||
<nav>
|
{% include 'menu.html' %}
|
||||||
<div class="nav-wrapper">
|
|
||||||
<ul>
|
|
||||||
{% if settings.home -%}
|
|
||||||
<li><a href=index.html class=first-item-menu>{{ settings.home }}</a></li>
|
|
||||||
{% else -%}
|
|
||||||
<li><a href=index.html class=first-item-menu>HOME</a></li>
|
|
||||||
{% endif -%}
|
|
||||||
{% for line in settings.menu -%}
|
|
||||||
<li><a href={{ line.lower().replace(" ", "_") }}.html class=item-menu>{{ line }}</a></li>
|
|
||||||
{% endfor -%}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,61 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<link type="text/css" rel="stylesheet" href="static/css/fonts.css" media="screen,projection"/>
|
|
||||||
<link type="text/css" rel="stylesheet" href="static/css/style.css" media="screen,projection"/>
|
|
||||||
<link type="text/css" rel="stylesheet" href="static/css/style-page.css" media="screen,projection"/>
|
|
||||||
|
|
||||||
<!--Let browser know website is optimized for mobile-->
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
||||||
<title>{{ settings.title }}</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="gallery-header static-header">
|
|
||||||
<img id="logo" src="static/img/logo.svg" />
|
|
||||||
<h1>{{ settings.title }}</h1>
|
|
||||||
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
|
|
||||||
<hr>
|
|
||||||
{% if settings.menu -%}
|
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<ul>
|
<ul>
|
||||||
{% if settings.home -%}
|
|
||||||
<li><a href=index.html class=first-item-menu>{{ settings.home }}</a></li>
|
|
||||||
{% else -%}
|
|
||||||
<li><a href=index.html class=first-item-menu>HOME</a></li>
|
|
||||||
{% endif -%}
|
|
||||||
{% for line in settings.menu -%}
|
{% for line in settings.menu -%}
|
||||||
<li><a href={{ line.lower().replace(" ", "_") }}.html class=item-menu>{{ line }}</a></li>
|
{% if loop.first %}
|
||||||
|
<li><a href={{ line }}.html class=first-item-menu>{{ line }}</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a href={{ line }}.html class=item-menu>{{ line }}</a></li>
|
||||||
|
{% endif %}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% endif -%}
|
|
||||||
</div>
|
|
||||||
<section class="text">
|
|
||||||
<h2>{{ settings.menu_title }}</h2>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% for section in settings.sections %}
|
|
||||||
{% include "sections/" + section.type + ".html" %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div class="back-to-home">
|
|
||||||
<hr>
|
|
||||||
<a href="./index.html">
|
|
||||||
<div id="logo" src="static/img/logo.svg"/>
|
|
||||||
HOME
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
48
prosopopee/templates/page.html
Normal file
48
prosopopee/templates/page.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link type="text/css" rel="stylesheet" href="static/css/fonts.css" media="screen,projection"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="static/css/style.css" media="screen,projection"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="static/css/style-page.css" media="screen,projection"/>
|
||||||
|
|
||||||
|
<!--Let browser know website is optimized for mobile-->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>{{ settings.title }}</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="gallery-header static-header">
|
||||||
|
<img id="logo" src="static/img/logo.svg" />
|
||||||
|
<h1>{{ settings.title }}</h1>
|
||||||
|
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
|
||||||
|
<hr>
|
||||||
|
{% if settings.menu -%}
|
||||||
|
{% include 'menu.html' %}
|
||||||
|
{% endif -%}
|
||||||
|
</div>
|
||||||
|
<section class="text">
|
||||||
|
<h2>{{ pages.title }}</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% for section in settings.sections %}
|
||||||
|
{% include "sections/" + section.type + ".html" %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="back-to-home">
|
||||||
|
<hr>
|
||||||
|
<a href="./index.html">
|
||||||
|
<div id="logo" src="static/img/logo.svg"/>
|
||||||
|
HOME
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user