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 %} + + + + +
+ +