diff --git a/__init__.py b/__init__.py index fe02cfc..24da475 100644 --- a/__init__.py +++ b/__init__.py @@ -24,6 +24,11 @@ app.config.from_object(__name__) def list_dir(mypath): return [f for f in os.listdir(mypath) if isfile(os.path.join(mypath, f)) and re.match('.*\.md.*',f) is None] + +def list_img(mypath): + return [f for f in os.listdir(mypath) if isfile(os.path.join(mypath, f)) and re.match('.*\.jpg',f) is not None] + + def get_sub_pages(path, page): ppath=page.path cc=len(path.split('/')) @@ -95,17 +100,18 @@ def post(name='index'): if is_index == True and not page is None: ld=list_dir(path2) + il=list_img(path2) sp=get_sub_pages(path,page) spi=get_sub_ipages(path,page) else: ld=[] sp=[] spi=[] - + il=[] if not page is None: page_defaults(page,is_index,path) app.logger.info("Render Template"+page["template"] +"for "+path) - return render_template(page.meta["template"], ld=ld, post=page, sp=sp, spi=spi, pth=path, pagebreadcrumbs=get_bc(path,page)) + return render_template(page.meta["template"], ld=ld, post=page, sp=sp, spi=spi, il=il, pth=path, pagebreadcrumbs=get_bc(path,page)) if os.path.exists(u'{}/{}'.format(FLATPAGES_ROOT,path)): return send_from_directory(FLATPAGES_ROOT,path) diff --git a/templates/gallery.html b/templates/gallery.html new file mode 100644 index 0000000..943d71b --- /dev/null +++ b/templates/gallery.html @@ -0,0 +1,44 @@ +{% extends "layout.html" %} +{% block content %} + + + + + + +

{{post.title}}

+ + + + + + +{% endblock %} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..dbd0ed5 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,24 @@ + + + + +
+
+
+ + + {% block content %} + {% endblock %} + + +
+
+
+ + + diff --git a/templates/post.html b/templates/post.html index 548e76c..80a171b 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,47 +1,47 @@ - +{% extends "layout.html" %} +{% block content %} - -
-
-
-

{{post.title}}

{{post.date}} {{ post.html|safe }} -
- Unterordner: - +{% if spi|length > 0 %}
-Info: -
-
-
+{% endblock %}