diff --git a/README.md b/README.md index 7ceafdf..b2f6fb9 100644 --- a/README.md +++ b/README.md @@ -58,35 +58,36 @@ sub_title: it's a scary place, don't go there ``` #### Menu - + It is possible to add a menu to your homepage that links to static pages. To do so, add a `menu` key to your `settings.yaml`, for example: ```yaml -menu: - - about: "About Me" - - contact: "Contact" +menu: + - about: "About" + - first_gallery: "My first gallery" + - http://twitter.com: "Twitter" ``` -The first part (`about` and `contact`) here are the name of the files (without -the `.yaml`) and the second part are the menu title that will be displayed in -the templates. So, here, you'll need to create a ``about.yaml`` and a -``contact.yaml`` files in the root directory. Their content are similar to -galleries (see [bellow](#gallery-settingsyaml)). - -For example, this could be the content of `contact.yaml`: +For example, this could be the content of `settings.yaml` in `about` folder: ```yaml -title: "Contact" +title: "About" +static: true +public: false sections: - type: text text: Some text, HTML is allowed. ``` +The `static` option is use it for don't need to give date and cover at the static page. +If you don't want see the page in front page you can use the `public` option. + ### Gallery settings.yaml This settings.yaml will describe: * the title, subtitle and cover picture of your gallery that will be used on the homepage +* the tags is optional * if your gallery is public (if not, it will still be built but won't appear on the homepage) * the date of your gallery: this will be used on the homepage since **galleries are sorted anti chronologically** on it * the list of sections that will contains your gallery. A section will represent either one picture, a group of pictures or text. The different kind of sections will be explained in the next README section. @@ -98,6 +99,9 @@ title: Gallery title sub_title: Gallery sub-title date: 2016-01-15 cover: my_cover_picture.jpg +tags: + - #yolo + - #travel sections: - type: full-picture image: big_picture.jpg diff --git a/example/about.yaml b/example/about.yaml deleted file mode 100644 index e3d98fe..0000000 --- a/example/about.yaml +++ /dev/null @@ -1,5 +0,0 @@ -title: "Menu 1" -sections: - - type: text - text: « voici plein de blabla à rajouter et ceci est du gras et encore plein plein plein plein de text car je veux voir comment ça va wrapper car c'est important et il faut pas que j'oublie de mettre des margins en % sinon ça va pas le faire alala là ça devrait aller » - diff --git a/example/about/settings.yaml b/example/about/settings.yaml new file mode 100644 index 0000000..e32ce5c --- /dev/null +++ b/example/about/settings.yaml @@ -0,0 +1,6 @@ +title: "About" +static: true +public: false +sections: + - type: text + text: Some text, HTML is allowed. diff --git a/example/contact.yaml b/example/contact.yaml deleted file mode 100644 index edcea46..0000000 --- a/example/contact.yaml +++ /dev/null @@ -1,5 +0,0 @@ -title: "Menu 2" -sections: - - type: text - text: « voici plein de blabla à rajouter et ceci est du gras et encore plein plein plein plein de text car je veux voir comment ça va wrapper car c'est important et il faut pas que j'oublie de mettre des margins en % sinon ça va pas le faire alala là ça devrait aller » - diff --git a/example/settings-menu.yaml b/example/settings-menu.yaml index 745ebf0..e5ff2f7 100644 --- a/example/settings-menu.yaml +++ b/example/settings-menu.yaml @@ -1,4 +1,5 @@ title: "Example gallery" -menu: - - about: "Menu 1" - - contact: "Menu 2" +menu: + - about: "About" + - first_gallery: "My first gallery" + - http://twitter.com: "Twitter" diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 0c0f0e8..3d9b8c2 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -149,15 +149,16 @@ def main(): error(isinstance(gallery_settings, dict), "Your %s should be a dict" % (os.path.join(gallery, "settings.yaml"))) error(gallery_settings.get("title"), "You should specify a title in %s" % (os.path.join(gallery, "settings.yaml"))) - error(gallery_settings.get("cover"), "You should specify a path to a cover picture in %s" % (os.path.join(gallery, "settings.yaml"))) - - cover_image_path = os.path.join(gallery, gallery_settings["cover"]) - - error(os.path.exists(cover_image_path), "File for %s cover image doesn't exists at %s" % (gallery, cover_image_path)) + + if gallery_settings.get("public", True): + error(gallery_settings.get("cover"), "You should specify a path to a cover picture in %s" % (os.path.join(gallery, "settings.yaml"))) + cover_image_path = os.path.join(gallery, gallery_settings["cover"]) + error(os.path.exists(cover_image_path), "File for %s cover image doesn't exists at %s" % (gallery, cover_image_path)) gallery_title = gallery_settings["title"] gallery_sub_title = gallery_settings.get("sub_title", "") gallery_date = gallery_settings["date"] if "date" in gallery_settings else "" + gallery_tags = gallery_settings["tags"] if "tags" in gallery_settings else "" if gallery_settings.get("public", True): front_page_galleries_cover.append({ @@ -165,6 +166,7 @@ def main(): "link": gallery, "sub_title": gallery_sub_title, "date": gallery_date, + "tags": gallery_tags, "cover": cover_image_path, }) @@ -174,16 +176,14 @@ def main(): # this should probably be a factory Image.base_dir = os.path.join(os.getcwd(), gallery) Image.target_dir = os.path.join(os.getcwd(), "build", gallery) - - open(os.path.join("build", gallery, "index.html"), "w").write(gallery_index_template.render(settings=settings, gallery=gallery_settings, Image=Image).encode("Utf-8")) + + if gallery_settings.get("static") == True: + open(os.path.join("build", gallery, "index.html"), "w").write(page_template.render(settings=settings, gallery=gallery_settings, Image=Image).encode("Utf-8")) + else: + open(os.path.join("build", gallery, "index.html"), "w").write(gallery_index_template.render(settings=settings, gallery=gallery_settings, Image=Image).encode("Utf-8")) front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"])) - for item in settings.get("menu", []): - file_name, menu_name = item.items()[0] - error(os.path.exists(os.path.join(os.getcwd(), file_name + ".yaml")), "I can't find a " + file_name + ".yaml in the current working directory as specified by your menu description in your root settings.yaml") - open(os.path.join("build", file_name + ".html"), "w").write(page_template.render(settings=settings, pages=yaml.safe_load(open(file_name + ".yaml", "r")), galleries=front_page_galleries_cover).encode("Utf-8")) - Image.base_dir = os.getcwd() Image.target_dir = os.path.join(os.getcwd(), "build") @@ -192,3 +192,4 @@ def main(): if __name__ == '__main__': main() + diff --git a/prosopopee/static/css/style.css b/prosopopee/static/css/style.css index fc5ca08..d3e2a59 100644 --- a/prosopopee/static/css/style.css +++ b/prosopopee/static/css/style.css @@ -90,7 +90,7 @@ a { text-align: center; z-index: 3; background: transparent linear-gradient(rgba(255, 255, 255, 0) 0%, transparent 1%, rgba(0, 0, 0, 0.07) 26%, rgba(0, 0, 0, 0.5) 71%, rgba(0, 0, 0, 0.7) 100%) repeat scroll 0% 0%; - padding: 20% 0 0; + padding: 20% 0 10px 0; } .gallery-header { @@ -145,7 +145,6 @@ a { } .gallery-datetime { - margin-bottom: 1em; font-family: 'crimson', serif; text-transform: uppercase; letter-spacing: 2px; @@ -233,3 +232,23 @@ nav ul li > a.item-menu::before { line-height: 1; color: #ebebeb; } + +.gallery-tag { + font-size: 13px; + text-transform: uppercase; + font-style: normal; + display: inline; + font-family: "adobe-garamond-pro", serif; +} + +.gallery-tag span { + font-size: 12px; + border-bottom: solid 1px rgba(255,255,255,0.2); + display: inline-block; + margin: 0 0 0 3px; + font-weight: bold; + font-family: "europa", sans-serif; + text-transform: uppercase; + letter-spacing: 3px; + font-style: normal; +} diff --git a/prosopopee/templates/base.html b/prosopopee/templates/base.html index 06cef16..a62bd68 100644 --- a/prosopopee/templates/base.html +++ b/prosopopee/templates/base.html @@ -2,8 +2,6 @@ - - {% block css %} {% endblock %} @@ -15,7 +13,8 @@ {% endfor %} -

.

{% endblock %} diff --git a/prosopopee/templates/menu.html b/prosopopee/templates/menu.html index 90f2fb6..f7f6b1a 100644 --- a/prosopopee/templates/menu.html +++ b/prosopopee/templates/menu.html @@ -1,14 +1,19 @@ diff --git a/prosopopee/templates/page.html b/prosopopee/templates/page.html index 87b5354..927f15a 100644 --- a/prosopopee/templates/page.html +++ b/prosopopee/templates/page.html @@ -1,26 +1,32 @@ {% extends "base.html" %} {% block css %} - + + + +{% endblock %} + +{% block logo %} + {% endblock %} {% block content %}
-

{{ pages.title }}

+

{{ gallery.title }}

- {% for section in pages.sections %} + {% for section in gallery.sections %} {% include "sections/" + section.type + ".html" %} {% endfor %}

- - - + {% endblock %}