commit 57351a5e128dc4bcdc471732b65a8d6a8ec4601b Author: relikd Date: Wed Nov 6 01:08:23 2019 +0100 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01de35e --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Created by https://www.gitignore.io/api/macos +# Edit at https://www.gitignore.io/?templates=macos + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# End of https://www.gitignore.io/api/macos \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..07c1f87 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2019 Oleg Geier + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..740a049 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +Lektor recipes +============== + +Generating a static site for recipes. +Small, fast, multi-language, indexed. + +![screenshot](img1.jpg) + +Styling is optimized for desktop, mobile, and print output. +At some point I may add search filters and offline archives for mobile devices. + +This project is built upon [Lektor](https://github.com/lektor/lektor/). + + +Install +------- + +1. [Download](https://www.getlektor.com/) Lektor and follow the instructions. + +2. Clone this repository and change to the `src` directory. + +3. Run `lektor server` to run a local server and preview the page. **Note:** Open http://127.0.0.1:5000/en/ instead of the default `/` path.\** + + +### Deploy + +You need to add a deployment setting to the project file. +Either apply something from the [official docs](https://www.getlektor.com/docs/deployment/), +or run a custom rsync command: + +``` +rsync -rclzv --delete --exclude=.* SRC DST +``` + +\** You don't have to worry about the redirect. +The `root/index.html` is copied to the destination. +Instead, you could also delete `root/` and change the project file. +Set `url_prefix` to `/` for one of the alternates. + + +### Modify + +Thanks to Lektor you have a simple content management system (see screenshot below). +Two things to note: + +1. Measurements have to be added manually to settings. Don't forget to __pluralize__ (c, cup, cups, etc.) + +2. You can __group ingredients__ if the line ends with a colon (`:`) + +Also, see [Lektor docs](https://www.getlektor.com/docs/) and [jinja2 template](https://jinja.palletsprojects.com/en/2.10.x/templates/) documentation. + + +![screenshot](img2.jpg) + +![screenshot](img3.jpg) diff --git a/img1.jpg b/img1.jpg new file mode 100644 index 0000000..6d18ebc Binary files /dev/null and b/img1.jpg differ diff --git a/img2.jpg b/img2.jpg new file mode 100644 index 0000000..ecd3199 Binary files /dev/null and b/img2.jpg differ diff --git a/img3.jpg b/img3.jpg new file mode 100644 index 0000000..d3bfac4 Binary files /dev/null and b/img3.jpg differ diff --git a/src/assets/static/col2.js b/src/assets/static/col2.js new file mode 100644 index 0000000..fdb1b84 --- /dev/null +++ b/src/assets/static/col2.js @@ -0,0 +1,10 @@ +(function(){// show at least 2 columns on mobile devices + var viewport = document.head.querySelector("meta[name=viewport]"); + if (viewport && screen.width < 485) { + document.head.removeChild(viewport); + var x = document.createElement("meta"); + x.setAttribute("name", "viewport"); + x.setAttribute("content", "width=485"); + document.head.appendChild(x); + } +})(); \ No newline at end of file diff --git a/src/assets/static/lozad.min.js b/src/assets/static/lozad.min.js new file mode 100644 index 0000000..625e656 --- /dev/null +++ b/src/assets/static/lozad.min.js @@ -0,0 +1,9 @@ +/*! lozad.js - v1.9.0 - 2019-02-09 +* https://github.com/ApoorvSaxena/lozad.js +* Copyright (c) 2019 Apoorv Saxena; Licensed MIT */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";var g=Object.assign||function(t){for(var e=1;e * { + background-color: #FFF; + border: 1px solid var(--cRed1); + border-radius: 0.3em; + padding: 0.3em 0.5em; + margin: 0.2em; +} +.tags a:hover, .tags .active, a:hover .recipe-tile { + background-color: var(--cRed1); + color: #FFF; +} +header .tags { max-width: 600px; margin: 0 auto } +.cluster dt { margin-top: 0.7em; font-size: 1.6em } +.cluster dd { margin-top: 0.4em } +.cluster dd a { white-space: nowrap } + +@media(max-width: 500px) { + .cluster dd { margin-left: 0 } + .cluster dd a { white-space: unset } +} + +/* + * Grid overview + */ +.pagination { text-align: center; margin-top: 1em; } +.recipe-tile { + background-color: var(--cBg2); + color: var(--cTxt); + display: inline-block; + vertical-align: top; + margin: 6px; + width: 200px; + text-align: center; +} +.recipe-tile .img-placeholder { + background-color: #777; + color: var(--cBg2); + width: 200px; + height: 150px; + font: bold 25px/150px 'Courier New', monospace; +} +a:hover .recipe-tile img { mix-blend-mode: overlay } +.recipe-tile p { height: 2.6em; margin: 0.3em 10px; overflow-y: auto } +.tile-grid { width: fit-content; max-width: 1060px; margin: 0 auto } +.latest .tile-grid { max-width: 636px } +/* max-width = prev + 2*30; width = x * (200 + 2*6); */ +@media screen and (max-width: 1120px) { .tile-grid { max-width: 848px } } +@media screen and (max-width: 908px) { .tile-grid { max-width: 636px } } +@media screen and (max-width: 696px) { .tile-grid { max-width: 424px !important } } +@media screen and (max-width: 484px) { .tile-grid { max-width: 212px !important } } + +@media print and (orientation: portrait) { .tile-grid { width: 636px } } +@media print and (orientation: landscape) { .tile-grid { width: 1060px } } +@media print { + a:hover .recipe-tile img { mix-blend-mode: unset !important } + .recipe-tile, .recipe-tile .img-placeholder, a:hover .recipe-tile { + background-color: #FFF; color: #000 } +} + +/* + * Individual recipe + */ +.recipe h2 { font-size: 0.8em; margin: 0 0 1em 0 } +.recipe #img-carousel { padding: 0 50px; margin: 0 -30px } +.recipe #source { margin-left: -1em; margin-bottom: -1.5em } +.recipe #metrics { float: right; margin: 0 0 15px 25px; max-width: 180px } +.recipe #metrics > * { text-indent: -20px; margin-left: 20px; padding-top: 0.3em } +.recipe #ingredients { float: left; margin: 0 25px 15px 0; max-width: 300px } +.recipe #directions ul { list-style-type: circle } +/* Colored, 3-part, difficulty bar */ +.difficulty.easy > div:nth-child(1) { background-color: #3C3 } +.difficulty.medium > div:nth-child(1), +.difficulty.medium > div:nth-child(2) { background-color: #FC3 } +.difficulty.hard > div:nth-child(1), +.difficulty.hard > div:nth-child(2), +.difficulty.hard > div:nth-child(3) { background-color: #F30 } +.difficulty > * { vertical-align: middle; } +.difficulty > div:nth-child(1) { border-radius: 50% 0 0 50% } +.difficulty > div:nth-child(3) { border-radius: 0 50% 50% 0 } +.difficulty > div { + display: inline-block; + width: 1em; height: 1em; + border: 1px solid #555; +} + +@media screen and (max-width: 800px) { + .recipe #img-carousel img { height: auto; width: 100%; padding: 0 } + .recipe #metrics { float: unset; max-width: fit-content; margin: 20px auto } +} +@media(max-width: 600px) { .recipe #ingredients { float: unset; max-width: 100% } } +@media(max-width: 500px) { .recipe #img-carousel { padding: 0 10px } } + +@media print { #source, #rating, .difficulty { display: none } } +@media print and (orientation: landscape) { #img-carousel img { display: none } } +@media print and (orientation: portrait) { + #img-carousel img:not(:first-child) { display: none } + .recipe #metrics { float: unset; padding-bottom: 1em } +} diff --git a/src/content/contents.lr b/src/content/contents.lr new file mode 100644 index 0000000..286996c --- /dev/null +++ b/src/content/contents.lr @@ -0,0 +1 @@ +_model: root diff --git a/src/content/groupby/contents.lr b/src/content/groupby/contents.lr new file mode 100644 index 0000000..7008e77 --- /dev/null +++ b/src/content/groupby/contents.lr @@ -0,0 +1,5 @@ +_model: clusters +--- +_template: querylist.html +--- +_slug: recipes/by \ No newline at end of file diff --git a/src/content/groupby/difficulty/contents+de.lr b/src/content/groupby/difficulty/contents+de.lr new file mode 100644 index 0000000..aba9f4c --- /dev/null +++ b/src/content/groupby/difficulty/contents+de.lr @@ -0,0 +1 @@ +name: Aufwand \ No newline at end of file diff --git a/src/content/groupby/difficulty/contents+en.lr b/src/content/groupby/difficulty/contents+en.lr new file mode 100644 index 0000000..e4a1947 --- /dev/null +++ b/src/content/groupby/difficulty/contents+en.lr @@ -0,0 +1 @@ +name: Difficulty \ No newline at end of file diff --git a/src/content/groupby/difficulty/contents.lr b/src/content/groupby/difficulty/contents.lr new file mode 100644 index 0000000..cd0ff38 --- /dev/null +++ b/src/content/groupby/difficulty/contents.lr @@ -0,0 +1,9 @@ +sort_key: 10 +--- +group_key: difficulty +--- +xdata: + +easy +medium +hard diff --git a/src/content/groupby/ingredient/contents+de.lr b/src/content/groupby/ingredient/contents+de.lr new file mode 100644 index 0000000..8bd64ae --- /dev/null +++ b/src/content/groupby/ingredient/contents+de.lr @@ -0,0 +1 @@ +name: Zutaten \ No newline at end of file diff --git a/src/content/groupby/ingredient/contents+en.lr b/src/content/groupby/ingredient/contents+en.lr new file mode 100644 index 0000000..d2475f4 --- /dev/null +++ b/src/content/groupby/ingredient/contents+en.lr @@ -0,0 +1 @@ +name: Ingredients \ No newline at end of file diff --git a/src/content/groupby/ingredient/contents.lr b/src/content/groupby/ingredient/contents.lr new file mode 100644 index 0000000..99650bc --- /dev/null +++ b/src/content/groupby/ingredient/contents.lr @@ -0,0 +1,3 @@ +sort_key: 5 +--- +group_key: ingredients diff --git a/src/content/groupby/rating/contents+de.lr b/src/content/groupby/rating/contents+de.lr new file mode 100644 index 0000000..9162c3d --- /dev/null +++ b/src/content/groupby/rating/contents+de.lr @@ -0,0 +1 @@ +name: Bewertung \ No newline at end of file diff --git a/src/content/groupby/rating/contents+en.lr b/src/content/groupby/rating/contents+en.lr new file mode 100644 index 0000000..ada3c1d --- /dev/null +++ b/src/content/groupby/rating/contents+en.lr @@ -0,0 +1 @@ +name: Rating \ No newline at end of file diff --git a/src/content/groupby/rating/contents.lr b/src/content/groupby/rating/contents.lr new file mode 100644 index 0000000..e407f30 --- /dev/null +++ b/src/content/groupby/rating/contents.lr @@ -0,0 +1,5 @@ +sort_key: 15 +--- +group_key: rating +--- +reverse_order: yes diff --git a/src/content/groupby/time/contents+de.lr b/src/content/groupby/time/contents+de.lr new file mode 100644 index 0000000..271bb31 --- /dev/null +++ b/src/content/groupby/time/contents+de.lr @@ -0,0 +1 @@ +name: Zeit \ No newline at end of file diff --git a/src/content/groupby/time/contents+en.lr b/src/content/groupby/time/contents+en.lr new file mode 100644 index 0000000..2dfe3fd --- /dev/null +++ b/src/content/groupby/time/contents+en.lr @@ -0,0 +1 @@ +name: Time \ No newline at end of file diff --git a/src/content/groupby/time/contents.lr b/src/content/groupby/time/contents.lr new file mode 100644 index 0000000..400ed5e --- /dev/null +++ b/src/content/groupby/time/contents.lr @@ -0,0 +1,13 @@ +sort_key: 20 +--- +group_key: time +--- +xdata: + +15 +30 +60 +120 +180 +360 +9999 diff --git a/src/content/recipes/contents.lr b/src/content/recipes/contents.lr new file mode 100644 index 0000000..dfb26d8 --- /dev/null +++ b/src/content/recipes/contents.lr @@ -0,0 +1 @@ +_model: recipes \ No newline at end of file diff --git a/src/content/recipes/vanilla-cut-out-cookies/contents+de.lr b/src/content/recipes/vanilla-cut-out-cookies/contents+de.lr new file mode 100644 index 0000000..89536ef --- /dev/null +++ b/src/content/recipes/vanilla-cut-out-cookies/contents+de.lr @@ -0,0 +1,16 @@ +name: Vanille Ausstech-Kekse +--- +yield: 26-28 Kekse +--- +ingredients: + +1/2 Tasse Margarine, oder Kokos Öl +1/2 Tasse Ahornsirup +1/2 TL Vanille Extrakt +1/4 TL Vanilleshote +1 Prise Salz +2 1/4 Tassen Mehl, glutenfrei +--- +directions: + +No translation yet. Click the flag (🇱🇷) at the bottom. \ No newline at end of file diff --git a/src/content/recipes/vanilla-cut-out-cookies/contents+en.lr b/src/content/recipes/vanilla-cut-out-cookies/contents+en.lr new file mode 100644 index 0000000..13ffb5c --- /dev/null +++ b/src/content/recipes/vanilla-cut-out-cookies/contents+en.lr @@ -0,0 +1,26 @@ +name: Vanilla cut-out cookies +--- +yield: 26-28 cookies +--- +ingredients: + +1/2 cup non-dairy butter, or coconut oil +1/2 cup maple syrup +1/2 tsp vanilla extract +1/4 tsp vanilla bean +dash salt +2 1/4 cups gluten-free flour blend +--- +directions: + +1) Preheat oven to 350°F. Line 2 cookie sheets with parchment paper. Prepare a rolling area with two additional sheets of parchment paper for that, and have your cookie cutter(s) handy. + +2) Place butter in a large mixing bowl and whip it with a mixer until it’s creamy. Add sweetener, vanilla extract and bean, and salt and mix once again to combine. Add in flour and use a wooden spoon to mix. Then get in there with your hands and mix everything together by working the dough until you can shape it into a ball {note: as depending on the flour mix you use there may be a slight variance, know that the consistency of the dough should not be sticky but should press together when pinched — be sure to knead it really well first for some time — if it’s a little sticky, add a little more flour (try 1-2 tbsp); if it’s a little dry add a little more sweetener (try 1 tbsp)}. Shape the dough into 2 balls and then flatten each into a disk. + +3) Roll out one of the dough balls between two sheets of parchment paper to ¼” thickness {or thinner or thicker depending on how you want your cookies to turn out}. Use a cookie cutter to cut out the cookies. Carefully transfer to a prepared cookie sheets, spacing them ½” apart {they won’t spread as they bake}. Gather up any dough scraps and repeat until all dough is used up. Repeat the process with the second dough ball. + +4) Bake in a pre-heated oven for approximately 11-13 minutes, until the edges just begin to become golden. Remove from oven and place on a cooling rack. {Note: cookies will harden a little within minutes of cooling, so don’t overbake}. Allow the cookies to cool for 10 minutes and enjoy! + +__Note:__ +You can make your own glutenfree flour blend by combining: +1 cup brown rice flour, ¾ cup tapioca starch, ½ cup sweet rice flour, ½ tsp guar gum diff --git a/src/content/recipes/vanilla-cut-out-cookies/contents.lr b/src/content/recipes/vanilla-cut-out-cookies/contents.lr new file mode 100644 index 0000000..88f63d2 --- /dev/null +++ b/src/content/recipes/vanilla-cut-out-cookies/contents.lr @@ -0,0 +1,11 @@ +tags: cookies, sweet, xmas, glutenfree +--- +time: 30 +--- +rating: 4 +--- +difficulty: easy +--- +source: https://www.unconventionalbaker.com/recipes/gluten-free-vegan-vanilla-cut-out-cookies/ +--- +date: 2019-05-15 diff --git a/src/content/recipes/vanilla-cut-out-cookies/image.jpg b/src/content/recipes/vanilla-cut-out-cookies/image.jpg new file mode 100644 index 0000000..b355680 Binary files /dev/null and b/src/content/recipes/vanilla-cut-out-cookies/image.jpg differ diff --git a/src/content/recipes/vanilla-cut-out-cookies/image2.jpg b/src/content/recipes/vanilla-cut-out-cookies/image2.jpg new file mode 100644 index 0000000..5fce270 Binary files /dev/null and b/src/content/recipes/vanilla-cut-out-cookies/image2.jpg differ diff --git a/src/content/recipes/vanilla-cut-out-cookies/image3.jpg b/src/content/recipes/vanilla-cut-out-cookies/image3.jpg new file mode 100644 index 0000000..17dcbe6 Binary files /dev/null and b/src/content/recipes/vanilla-cut-out-cookies/image3.jpg differ diff --git a/src/content/settings/contents+de.lr b/src/content/settings/contents+de.lr new file mode 100644 index 0000000..0b1faad --- /dev/null +++ b/src/content/settings/contents+de.lr @@ -0,0 +1 @@ +measures: EL, TL, kg, g, L, dl, cl, ml, cm, Msp, Prise, Tasse, Tassen, Dose, Dosen, kleine, Bund, Packung, Packungen, Scheibe, Scheiben, Schuss, Stängel, Tropfen, Tube \ No newline at end of file diff --git a/src/content/settings/contents+en.lr b/src/content/settings/contents+en.lr new file mode 100644 index 0000000..effd13d --- /dev/null +++ b/src/content/settings/contents+en.lr @@ -0,0 +1 @@ +measures: kg, g, L, dl, cl, ml, oz, lb, pt, qt, cm, tsp, tbsp, c, cup, cups, pkg, pck, drop, drops, tube, dash, dashes, ounce, ounces, small, medium, large, box, can, pinch, tin, clove, cloves \ No newline at end of file diff --git a/src/content/settings/contents.lr b/src/content/settings/contents.lr new file mode 100644 index 0000000..524aabb --- /dev/null +++ b/src/content/settings/contents.lr @@ -0,0 +1,9 @@ +_model: settings +--- +_hidden: yes +--- +replace_frac: yes +--- +replace_temp: yes +--- +show_empty_tags: no diff --git a/src/content/tags/bread/contents+de.lr b/src/content/tags/bread/contents+de.lr new file mode 100644 index 0000000..b52cbce --- /dev/null +++ b/src/content/tags/bread/contents+de.lr @@ -0,0 +1 @@ +name: Brot diff --git a/src/content/tags/bread/contents.lr b/src/content/tags/bread/contents.lr new file mode 100644 index 0000000..8a1905a --- /dev/null +++ b/src/content/tags/bread/contents.lr @@ -0,0 +1 @@ +name: Bread diff --git a/src/content/tags/cake/contents+de.lr b/src/content/tags/cake/contents+de.lr new file mode 100644 index 0000000..1fdb80c --- /dev/null +++ b/src/content/tags/cake/contents+de.lr @@ -0,0 +1 @@ +name: Kuchen diff --git a/src/content/tags/cake/contents.lr b/src/content/tags/cake/contents.lr new file mode 100644 index 0000000..2283244 --- /dev/null +++ b/src/content/tags/cake/contents.lr @@ -0,0 +1 @@ +name: Cake diff --git a/src/content/tags/chocolate/contents+de.lr b/src/content/tags/chocolate/contents+de.lr new file mode 100644 index 0000000..94cdb88 --- /dev/null +++ b/src/content/tags/chocolate/contents+de.lr @@ -0,0 +1 @@ +name: Schokolade diff --git a/src/content/tags/chocolate/contents.lr b/src/content/tags/chocolate/contents.lr new file mode 100644 index 0000000..f7aa370 --- /dev/null +++ b/src/content/tags/chocolate/contents.lr @@ -0,0 +1 @@ +name: Chocolate diff --git a/src/content/tags/contents.lr b/src/content/tags/contents.lr new file mode 100644 index 0000000..d72010e --- /dev/null +++ b/src/content/tags/contents.lr @@ -0,0 +1,5 @@ +_model: tags +--- +_slug: recipes/tags +--- +_template: querylist.html diff --git a/src/content/tags/cookies/contents+de.lr b/src/content/tags/cookies/contents+de.lr new file mode 100644 index 0000000..3079952 --- /dev/null +++ b/src/content/tags/cookies/contents+de.lr @@ -0,0 +1 @@ +name: Kekse diff --git a/src/content/tags/cookies/contents.lr b/src/content/tags/cookies/contents.lr new file mode 100644 index 0000000..0613a7e --- /dev/null +++ b/src/content/tags/cookies/contents.lr @@ -0,0 +1 @@ +name: Cookies diff --git a/src/content/tags/dip/contents.lr b/src/content/tags/dip/contents.lr new file mode 100644 index 0000000..0145d3f --- /dev/null +++ b/src/content/tags/dip/contents.lr @@ -0,0 +1 @@ +name: Dip diff --git a/src/content/tags/dressing/contents.lr b/src/content/tags/dressing/contents.lr new file mode 100644 index 0000000..d662d31 --- /dev/null +++ b/src/content/tags/dressing/contents.lr @@ -0,0 +1 @@ +name: Dressing diff --git a/src/content/tags/drinks/contents.lr b/src/content/tags/drinks/contents.lr new file mode 100644 index 0000000..bd24de0 --- /dev/null +++ b/src/content/tags/drinks/contents.lr @@ -0,0 +1 @@ +name: Drinks diff --git a/src/content/tags/glutenfree/contents+de.lr b/src/content/tags/glutenfree/contents+de.lr new file mode 100644 index 0000000..986bd67 --- /dev/null +++ b/src/content/tags/glutenfree/contents+de.lr @@ -0,0 +1 @@ +name: Glutenfrei diff --git a/src/content/tags/glutenfree/contents.lr b/src/content/tags/glutenfree/contents.lr new file mode 100644 index 0000000..af204d2 --- /dev/null +++ b/src/content/tags/glutenfree/contents.lr @@ -0,0 +1 @@ +name: Glutenfree diff --git a/src/content/tags/ingredient/contents+de.lr b/src/content/tags/ingredient/contents+de.lr new file mode 100644 index 0000000..b1cb8a3 --- /dev/null +++ b/src/content/tags/ingredient/contents+de.lr @@ -0,0 +1 @@ +name: Zutat diff --git a/src/content/tags/ingredient/contents.lr b/src/content/tags/ingredient/contents.lr new file mode 100644 index 0000000..edc91cf --- /dev/null +++ b/src/content/tags/ingredient/contents.lr @@ -0,0 +1 @@ +name: Ingredient diff --git a/src/content/tags/main-dish/contents+de.lr b/src/content/tags/main-dish/contents+de.lr new file mode 100644 index 0000000..b83fc3d --- /dev/null +++ b/src/content/tags/main-dish/contents+de.lr @@ -0,0 +1 @@ +name: Hauptspeise diff --git a/src/content/tags/main-dish/contents.lr b/src/content/tags/main-dish/contents.lr new file mode 100644 index 0000000..b83ec71 --- /dev/null +++ b/src/content/tags/main-dish/contents.lr @@ -0,0 +1 @@ +name: Main dish diff --git a/src/content/tags/raw/contents.lr b/src/content/tags/raw/contents.lr new file mode 100644 index 0000000..434f901 --- /dev/null +++ b/src/content/tags/raw/contents.lr @@ -0,0 +1 @@ +name: Raw diff --git a/src/content/tags/salad/contents+de.lr b/src/content/tags/salad/contents+de.lr new file mode 100644 index 0000000..a6b710c --- /dev/null +++ b/src/content/tags/salad/contents+de.lr @@ -0,0 +1 @@ +name: Salat diff --git a/src/content/tags/salad/contents.lr b/src/content/tags/salad/contents.lr new file mode 100644 index 0000000..f0a1475 --- /dev/null +++ b/src/content/tags/salad/contents.lr @@ -0,0 +1 @@ +name: Salad diff --git a/src/content/tags/sauce/contents+de.lr b/src/content/tags/sauce/contents+de.lr new file mode 100644 index 0000000..fdacb8b --- /dev/null +++ b/src/content/tags/sauce/contents+de.lr @@ -0,0 +1 @@ +name: Soße diff --git a/src/content/tags/sauce/contents.lr b/src/content/tags/sauce/contents.lr new file mode 100644 index 0000000..728d057 --- /dev/null +++ b/src/content/tags/sauce/contents.lr @@ -0,0 +1 @@ +name: Sauce diff --git a/src/content/tags/spread/contents+de.lr b/src/content/tags/spread/contents+de.lr new file mode 100644 index 0000000..ca6fce9 --- /dev/null +++ b/src/content/tags/spread/contents+de.lr @@ -0,0 +1 @@ +name: Aufstrich diff --git a/src/content/tags/spread/contents.lr b/src/content/tags/spread/contents.lr new file mode 100644 index 0000000..79b76e6 --- /dev/null +++ b/src/content/tags/spread/contents.lr @@ -0,0 +1 @@ +name: Spread diff --git a/src/content/tags/sweet/contents+de.lr b/src/content/tags/sweet/contents+de.lr new file mode 100644 index 0000000..7394311 --- /dev/null +++ b/src/content/tags/sweet/contents+de.lr @@ -0,0 +1 @@ +name: Süßes diff --git a/src/content/tags/sweet/contents.lr b/src/content/tags/sweet/contents.lr new file mode 100644 index 0000000..48bbf33 --- /dev/null +++ b/src/content/tags/sweet/contents.lr @@ -0,0 +1 @@ +name: Sweet diff --git a/src/content/tags/xmas/contents+de.lr b/src/content/tags/xmas/contents+de.lr new file mode 100644 index 0000000..28bcedd --- /dev/null +++ b/src/content/tags/xmas/contents+de.lr @@ -0,0 +1 @@ +name: Weihnachten diff --git a/src/content/tags/xmas/contents.lr b/src/content/tags/xmas/contents.lr new file mode 100644 index 0000000..2c0c422 --- /dev/null +++ b/src/content/tags/xmas/contents.lr @@ -0,0 +1 @@ +name: Xmas diff --git a/src/databags/i18n+de.ini b/src/databags/i18n+de.ini new file mode 100644 index 0000000..d98cd63 --- /dev/null +++ b/src/databags/i18n+de.ini @@ -0,0 +1,25 @@ +[duration] +label = Zeit +day = Tag +days = Tage +hour = Std +hours = Std +min = Min +mins = Min + +[yield] +label = Menge + +[difficulty] +label = Aufwand +_unset = Aufwand unklar +easy = Einfach +medium = Mittel +hard = Schwer + +[title] +latest = Zuletzt hinzugefügt +all_recipes = Alle Rezepte +recipes = Rezepte +ingredients = Zutaten +directions = Zubereitung \ No newline at end of file diff --git a/src/databags/i18n+en.ini b/src/databags/i18n+en.ini new file mode 100644 index 0000000..fad9e5e --- /dev/null +++ b/src/databags/i18n+en.ini @@ -0,0 +1,25 @@ +[duration] +label = Time +day = day +days = days +hour = hour +hours = hours +min = minutes +mins = min + +[yield] +label = Yield + +[difficulty] +label = Difficulty +_unset = Difficulty not set +easy = Easy +medium = Medium +hard = Hard + +[title] +latest = Latest recipes +all_recipes = All recipes +recipes = Recipes +ingredients = Ingredients +directions = Directions \ No newline at end of file diff --git a/src/models/cluster.ini b/src/models/cluster.ini new file mode 100644 index 0000000..559b9dc --- /dev/null +++ b/src/models/cluster.ini @@ -0,0 +1,44 @@ +[model] +name = Cluster +label = {{ this.name }} +hidden = yes +protected = yes + +[children] +enabled = no + +[attachments] +enabled = no + +[fields.name] +label = Name +width = 1/2 +type = string + +[fields.group_key] +label = Grouping Attribute +width = 1/3 +type = string + +[fields.sort_key] +label = Sort order +width = 1/5 +default = 0 +type = sort_key + +[fields.null_fallback] +label = Null Fallback +width = 1/3 +type = string +default = ??? + +[fields.reverse_order] +label = Reverse Sort +width = 1/5 +type = boolean + +[fields.xdata] +label = Extended Data +description = Used for ordinal sort order or merging integer cluster +width = 1/2 +type = strings diff --git a/src/models/clusters.ini b/src/models/clusters.ini new file mode 100644 index 0000000..d62b88b --- /dev/null +++ b/src/models/clusters.ini @@ -0,0 +1,12 @@ +[model] +name = Cluster +label = Cluster +hidden = yes +protected = yes + +[children] +model = cluster +order_by = sort_key + +[attachments] +enabled = no diff --git a/src/models/recipe.ini b/src/models/recipe.ini new file mode 100644 index 0000000..6bf8e21 --- /dev/null +++ b/src/models/recipe.ini @@ -0,0 +1,67 @@ +[model] +name = Recipe +label = {{ this._id }} +hidden = yes + +[children] +enabled = no + +[fields.name] +label = Name +width = 2/3 +type = string +size = large + +[fields.date] +label = Date / Datum +width = 1/3 +type = date +size = large + +[fields.time] +label = Time / Zeit +width = 1/8 +type = select +choices = 5, 10, 15, 20, 30, 45, 60, 75, 90, 105, 120, 150, 180, 240, 360, 480, 720, 1440 +choice_labels = 5m, 10m, 15m, 20m, 30m, 45m, 1h, 1h 15m, 1h 30m, 1h 45m, 2h, 2h 30m, 3h, 4h, 6h, 8h, 12h, 24h + +[fields.difficulty] +label = Difficulty +width = 1/8 +type = select +choices = easy, medium, hard +choice_labels = Easy, Medium, Hard + +[fields.rating] +label = Rating +width = 1/8 +type = select +choices = 1, 2, 3, 4, 5 +choice_labels = ★☆☆☆☆, ★★☆☆☆, ★★★☆☆, ★★★★☆, ★★★★★ + +[fields.yield] +label = Yield / Menge +width = 1/2 +type = string + +[fields.ingredients] +label = Ingredients / Zutaten +description = 42 g Ingredient, Notes (add additional measures in settings) +width = 2/3 +type = strings + +[fields.tags] +label = Tags / Kategorie +width = 1/3 +type = checkboxes +source = site.query('/tags', alt) + +[fields.directions] +label = Directions / Zubereitung +description = Markdown formatting applies: ### Header, __bold__, _italic_ +type = markdown + +[fields.source] +label = Source / Quelle +type = url +size = small diff --git a/src/models/recipes.ini b/src/models/recipes.ini new file mode 100644 index 0000000..07f0cff --- /dev/null +++ b/src/models/recipes.ini @@ -0,0 +1,16 @@ +[model] +name = Recipes +label = Recipes +hidden = yes +protected = yes + +[attachments] +enabled = no + +[children] +model = recipe +order_by = name + +[pagination] +enabled = yes +per_page = 60 diff --git a/src/models/root.ini b/src/models/root.ini new file mode 100644 index 0000000..3b635b0 --- /dev/null +++ b/src/models/root.ini @@ -0,0 +1,6 @@ +[model] +name = Root Page +label = root + +[attachments] +enabled = no diff --git a/src/models/settings.ini b/src/models/settings.ini new file mode 100644 index 0000000..00d9ca8 --- /dev/null +++ b/src/models/settings.ini @@ -0,0 +1,34 @@ +[model] +name = Settings +label = Settings +hidden = yes +protected = yes + +[children] +enabled = no + +[attachments] +enabled = no + +[fields.measures] +label = Measures +description = Comma separated list +width = 3/5 +type = text +default = kg, g, L, dl, cl, ml, oz, lb, pt, qt, cm, tsp, tbsp, c, cup, cups, pkg, pck + +[fields.replace_frac] +label = Replace 1/2 with ½, ⅔, et.c +width = 1/5 +type = boolean + +[fields.replace_temp] +label = Replace °C/°F with ℃/℉ +width = 1/5 +type = boolean + +[fields.show_empty_tags] +label = Show empty tags +description = Even if no recipes exist in that category +width = 1/4 +type = boolean diff --git a/src/models/tag.ini b/src/models/tag.ini new file mode 100644 index 0000000..eb2fcc3 --- /dev/null +++ b/src/models/tag.ini @@ -0,0 +1,18 @@ +[model] +name = Tag +label = {{ this.name }} +hidden = yes + +[attachments] +enabled = no + +[children] +replaced_with = site.query('/recipes', alt).filter(F.tags.contains(this)) + +[pagination] +enabled = yes +per_page = 60 + +[fields.name] +label = Name +type = string diff --git a/src/models/tags.ini b/src/models/tags.ini new file mode 100644 index 0000000..9d63eaf --- /dev/null +++ b/src/models/tags.ini @@ -0,0 +1,12 @@ +[model] +name = Tags +label = Tags +hidden = yes +protected = yes + +[children] +model = tag +order_by = name + +[attachments] +enabled = no diff --git a/src/packages/helper/.gitignore b/src/packages/helper/.gitignore new file mode 100644 index 0000000..463960b --- /dev/null +++ b/src/packages/helper/.gitignore @@ -0,0 +1,5 @@ +dist +build +*.pyc +*.pyo +*.egg-info diff --git a/src/packages/helper/README.md b/src/packages/helper/README.md new file mode 100644 index 0000000..fa419da --- /dev/null +++ b/src/packages/helper/README.md @@ -0,0 +1,3 @@ +# Helper + +Just some python functions that are necessary for the project. diff --git a/src/packages/helper/lektor_helper.py b/src/packages/helper/lektor_helper.py new file mode 100644 index 0000000..85b5562 --- /dev/null +++ b/src/packages/helper/lektor_helper.py @@ -0,0 +1,251 @@ +# -*- coding: utf-8 -*- +from lektor.pluginsystem import Plugin +from lektor.databags import Databags +import unicodedata +import os +import shutil + +# ------- +# Sorting + + +def sortKeyInt(x): + return int(x[0]) if x[0] else 0 + + +def sortKeyStr(x): + return noUmlaut(x[0]).lower() + + +def groupByDictSort(dic, sorter=None, reverse=False): + if type(sorter) == list: # sort by pre-defined, ordered list + return sorted(dic, reverse=bool(reverse), key=lambda x: + sorter.index(x[0]) if x[0] in sorter else 0) + fn = sortKeyInt if sorter == 'int' else sortKeyStr + return sorted(dic, reverse=bool(reverse), key=fn) + +# ----------------------- +# Pure text manupulations + + +def noUmlaut(text): + try: + text = unicode(text, 'utf-8') + except (TypeError, NameError): + pass + text = unicodedata.normalize('NFD', text) + text = text.encode('ascii', 'ignore') + text = text.decode("utf-8") + return str(text) + + +def pluralize(n, single, multi): + if n == 0: + return '' + return u'{} {}'.format(n, single if n == 1 else multi) + + +def replaceFractions(txt): + res = '' + for x in txt.split(): + try: + i = ['1/2', '1/3', '2/3', '1/4', '3/4', '1/8', '-'].index(x) + res += [u'½', u'⅓', u'⅔', u'¼', u'¾', u'⅛', u' - '][i] + except ValueError: + res += ' ' + x + return res.lstrip() + + +def numFillWithText(num, fill=u'★', empty=u'☆', total=5): + num = int(num) if num else 0 + return fill * num + empty * (total - num) + +# ------------------ +# Array manipulation + + +def updateSet_if(dic, parent, parentkey, value): + try: + key = parent[parentkey] + except KeyError: + return + if not key: + key = '' + try: + dic[key] + except KeyError: + dic[key] = set() + dic[key].add(value) + + +def updateSet_addMultiple(dic, key, others): + try: + dic[key] + except KeyError: + dic[key] = set() + dic[key].update(others) + + +def findCluster(key, clusterList=[30, 60, 120]): + key = int(key) if key else 0 + if key > 0: + for cluster in clusterList: + if key < cluster: + key = cluster + break + return key + +# -------------------- +# Ingredient splitting + + +def splitIngredientLine(line): + state = 1 + capture = False + indices = [0, len(line)] + for i, char in enumerate(line): + if char.isspace(): + capture = False + indices[state] = i + state += 1 + continue + elif capture: + continue + elif state == 1 and char in '0123456789-.,': + state -= 1 + elif state > 1: + break + capture = True + return indices + + +def parseIngredientLine(line, measureList=[], rep_frac=False): + idx = splitIngredientLine(line) + val = line[:idx[0]] + if rep_frac: + val = replaceFractions(val) + measure = line[idx[0]:idx[1]].lstrip() + if measure.lower() in measureList: + name = line[idx[1]:].lstrip() + else: + measure = '' + name = line[idx[0]:].lstrip() + note = '' + name_note = name.split(',', 1) + if len(name_note) > 1: + name, note = [x.strip() for x in name_note] + return {'value': val, 'measure': measure, 'name': name, 'note': note} + +# -------------------- +# Other Helper methods + + +def groupByMergeCluster(dic, arr=[30, 60, 120], reverse=False): + arr = sorted([int(x) for x in arr]) + groups = dict() + for key, recipes in dic: + key = findCluster(key, arr) + if key == 0 and not reverse: + key = '' + updateSet_addMultiple(groups, key, recipes) + return sorted(groups.items(), reverse=bool(reverse)) + +# ---------------- +# Main entry point + + +class HelperPlugin(Plugin): + name = u'Helper' + description = u'Some helper methods, filters, and templates.' + alt = None + availableTags = set() + + # ----------- + # Event hooks + # ----------- + + def on_before_build_all(self, builder, **extra): + # display only tags that contain at least one recipe + pad = self.env.new_pad() + for r in pad.query('recipes'): + self.availableTags.update(r['tags']) + + def on_after_prune(self, builder, **extra): + # redirect to /en/ + for file in ['index.html']: + src_f = os.path.join(self.env.root_path, 'root', file) + if os.path.exists(src_f): + dst_f = os.path.join(builder.destination_path, file) + with open(dst_f, 'wb') as df: + with open(src_f, 'rb') as sf: + shutil.copyfileobj(sf, df) + + def on_process_template_context(self, context, **extra): + self.alt = context['alt'] + + def on_setup_env(self, **extra): + # self.env.load_config().iter_alternatives() + # pad = self.env.new_pad() + # pad.query('groupby', alt=alt) + + def localizeDic(key, subkey=None): + bag = Databags(self.env).lookup('i18n+{}.{}'.format(self.alt, key)) + return bag[subkey] if subkey else bag + + def to_duration(time, cluster=None): + time = int(time) if time else 0 + if (time <= 0): + return '' + # Calls itself without cluster argument + if cluster: + cluster = [int(x) for x in cluster] + idx = cluster.index(time) + if idx == 0: + return '<' + to_duration(time) + timeA = to_duration(cluster[idx - 1]) + if idx + 1 >= len(cluster): + return '>' + timeA + else: + return u'{} – {}'.format(timeA, to_duration(time)) + days = time // (60 * 24) + time -= days * (60 * 24) + L = localizeDic('duration') + return ' '.join([ + pluralize(days, L['day'], L['days']), + pluralize(time // 60, L['hour'], L['hours']), + pluralize(time % 60, L['min'], L['mins'])]).strip() + + def ingredientsForRecipe(recipe): + set = self.env.new_pad().get('settings', alt=self.alt) + meaList = [x.strip() for x in set['measures'].lower().split(',')] + repFrac = set['replace_frac'] + + for line in recipe['ingredients']: + line = line.strip() + if not line: + continue + elif line.endswith(':'): + yield {'group': line} + else: + yield parseIngredientLine(line, meaList, repFrac) + + def groupByAttribute(recipeList, attribute): + groups = dict() + for recipe in recipeList: + if attribute == 'ingredients': + for ing in ingredientsForRecipe(recipe): + updateSet_if(groups, ing, 'name', recipe) + else: + updateSet_if(groups, recipe, attribute, recipe) + # groups[undefinedKey].update(groups.pop('_undefined')) + return groups.items() + + self.env.jinja_env.filters['duration'] = to_duration + self.env.jinja_env.filters['rating'] = numFillWithText + self.env.jinja_env.filters['replaceFractions'] = replaceFractions + self.env.jinja_env.filters['enumIngredients'] = ingredientsForRecipe + self.env.jinja_env.filters['groupByAttribute'] = groupByAttribute + self.env.jinja_env.filters['groupSort'] = groupByDictSort + self.env.jinja_env.filters['groupMergeCluster'] = groupByMergeCluster + self.env.jinja_env.globals['localize'] = localizeDic + self.env.jinja_env.globals['availableTags'] = self.availableTags diff --git a/src/packages/helper/setup.py b/src/packages/helper/setup.py new file mode 100644 index 0000000..feda639 --- /dev/null +++ b/src/packages/helper/setup.py @@ -0,0 +1,38 @@ +import ast +import io +import re + +from setuptools import setup, find_packages + +with io.open('README.md', 'rt', encoding="utf8") as f: + readme = f.read() + +_description_re = re.compile(r'description\s+=\s+(?P.*)') + +with open('lektor_helper.py', 'rb') as f: + description = str(ast.literal_eval(_description_re.search( + f.read().decode('utf-8')).group(1))) + +setup( + author=u'relikd', + author_email='oleg@relikd.de', + description=description, + keywords='Lektor plugin', + license='MIT', + long_description=readme, + long_description_content_type='text/markdown', + name='lektor-helper', + packages=find_packages(), + py_modules=['lektor_helper'], + # url='[link to your repository]', + version='0.1', + classifiers=[ + 'Framework :: Lektor', + 'Environment :: Plugins', + ], + entry_points={ + 'lektor.plugins': [ + 'helper = lektor_helper:HelperPlugin', + ] + } +) diff --git a/src/recipes.lektorproject b/src/recipes.lektorproject new file mode 100644 index 0000000..01c204b --- /dev/null +++ b/src/recipes.lektorproject @@ -0,0 +1,14 @@ +[project] +name = recipe lekture +url_style = relative + +[alternatives.en] +name = English +primary = yes +url_prefix = /en/ +locale = en_US + +[alternatives.de] +name = German +url_prefix = /de/ +locale = de_DE diff --git a/src/root/index.html b/src/root/index.html new file mode 100644 index 0000000..a812018 --- /dev/null +++ b/src/root/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/templates/cluster.html b/src/templates/cluster.html new file mode 100644 index 0000000..96dd315 --- /dev/null +++ b/src/templates/cluster.html @@ -0,0 +1,39 @@ +{% extends "layout.html" %} +{% block title %}{{ this.name }}{% endblock %} +{% block body %} + + {%- if this.group_key in ['rating', 'time'] -%} + {%- set sortType = 'int' -%} + {%- elif this.xdata -%} + {%- set sortType = this.xdata + [''] -%} + {%- endif -%} + + {%- set all = site.query('/recipes', this.alt) | groupByAttribute(this.group_key) | groupSort(sortType, this.reverse_order) -%} + + {%- if this.group_key == 'time' -%} + {%- set all = all | groupMergeCluster(this.xdata, this.reverse_order) -%} + {%- endif -%} + +

{{ this.name }}

+
+ {%- for attrib, recipes in all -%} +
{%- if this.group_key == 'rating' -%} + {{ attrib | rating }} + {%- elif not attrib -%} + {{ this.null_fallback }} + {%- elif this.group_key == 'time' -%} + {{ attrib | duration(this.xdata) }} + {%- elif this.group_key == 'difficulty' -%} + {{ localize('difficulty', attrib) }} + {%- else -%} + {{ attrib }} + {%- endif -%}
+
+ {%- set pipe = joiner(' | ') -%} + {%- for recipe in recipes | sort(attribute='name') -%} + {{ pipe() }}{{ recipe.name }} + {%- endfor -%} +
+ {%- endfor %} +
+{% endblock %} \ No newline at end of file diff --git a/src/templates/layout.html b/src/templates/layout.html new file mode 100644 index 0000000..233aff8 --- /dev/null +++ b/src/templates/layout.html @@ -0,0 +1,48 @@ + + + + + + +{% block title %}Welcome{% endblock %} · recipe lekture + +
+ + +
+ {%- set allowEmptyTags = site.get('settings', alt=this.alt)['show_empty_tags'] -%} + {%- for tag in site.query('/tags', this.alt) %} + {%- if allowEmptyTags or tag._id in availableTags -%} + {{ tag.name }} + {%- endif -%} + {%- endfor %} +
+
+
+ {% block body %}{% endblock %} +
+
{#--#} + {#--#} + {#--#} + {#--#} +
Build with Lektor, template by relikd. + {%- if this.alt == 'de' -%} + 🇱🇷 + {%- else -%} + 🇩🇪 + {%- endif -%} +
{#--#} +
+ + diff --git a/src/templates/macros/pagination.html b/src/templates/macros/pagination.html new file mode 100644 index 0000000..b709023 --- /dev/null +++ b/src/templates/macros/pagination.html @@ -0,0 +1,33 @@ +{%- macro render_pagination_all(pagination) -%} + {%- if pagination.pages > 1 -%} + + {%- endif -%} +{%- endmacro -%} + +{% macro render_pagination_prev_next(pagination) %} + +{% endmacro %} \ No newline at end of file diff --git a/src/templates/macros/recipes.html b/src/templates/macros/recipes.html new file mode 100644 index 0000000..95d4be3 --- /dev/null +++ b/src/templates/macros/recipes.html @@ -0,0 +1,21 @@ +{%- macro render_recipe_list(recipes, limit=0) -%} +
+ {%- for recipe in recipes -%} + {%- if limit == 0 or loop.index <= limit -%} + {%- set img = recipe.attachments.images|sort(attribute='record_label')|first -%} + {#--#} +
+
+ {%- if img -%} + + {%- else -%} + No Image + {%- endif -%} +
+

{{ recipe.name }}

+
{#--#} +
+ {%- endif -%} + {%- endfor %} +
+{%- endmacro -%} diff --git a/src/templates/querylist.html b/src/templates/querylist.html new file mode 100644 index 0000000..7d5b404 --- /dev/null +++ b/src/templates/querylist.html @@ -0,0 +1,10 @@ +{% extends "layout.html" %} +{% block title %}{{ this.datamodel.name }}{% endblock %} +{% block body %} +

{{ this.datamodel.name }}

+ +{% endblock %} \ No newline at end of file diff --git a/src/templates/recipe.html b/src/templates/recipe.html new file mode 100644 index 0000000..da24632 --- /dev/null +++ b/src/templates/recipe.html @@ -0,0 +1,63 @@ +{% extends "layout.html" %} +{% block title %}{{ this.name }}{% endblock %} +{% block body %} +
+ + + {% if this.source -%} + + {% endif %} +

{{ this.name }}

+ +
+
{{ this.rating|rating }}
+
+
+ {%- if this.difficulty %} + {{ localize('difficulty', this.difficulty) }} + {%- else %} + {{ localize('difficulty._unset') }} + {%- endif %} +
+
{{ localize('duration.label') }}: {{ this.time|duration if this.time else '—' }}
+
{{ localize('yield.label') }}: {{ this.yield if this.yield else '—' }}
+
+ +
+

{{ localize('title.ingredients') }}:

+
    + {%- for ing in this|enumIngredients %} + {%- if ing['group'] %} +
  • {{ ing['group'] }}
  • + {%- else %} +
  • + {%- if ing['value'] %}{{ ing['value'] }} {% endif -%} + {%- if ing['measure'] %}{{ ing['measure'] }} {% endif -%} + {{ ing['name'] }} + {%- if ing['note'] -%} + {{ ', ' ~ ing['note'] }} + {%- endif -%} +
  • + {%- endif %} + {%- endfor %} +
+
+ +
+

{{ localize('title.directions') }}:

+ {% if site.get('settings', alt=this.alt)['replace_temp'] -%} + {{ this.directions|string|replace('°C', '℃')|replace('°F', '℉')|markdown }} + {% else -%} + {{ this.directions }} + {% endif -%} +
+ +
+
+{% endblock %} diff --git a/src/templates/recipes.html b/src/templates/recipes.html new file mode 100644 index 0000000..0e4bbd7 --- /dev/null +++ b/src/templates/recipes.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% from "macros/recipes.html" import render_recipe_list %} +{% from "macros/pagination.html" import render_pagination_all %} +{% block title %}{{ localize('title.recipes') }}{% endblock %} +{% block body %} +

{{ localize('title.recipes') }}

+ {{ render_recipe_list(this.pagination.items) }} + {{ render_pagination_all(this.pagination) }} +{% endblock %} \ No newline at end of file diff --git a/src/templates/root.html b/src/templates/root.html new file mode 100644 index 0000000..9d9cca5 --- /dev/null +++ b/src/templates/root.html @@ -0,0 +1,8 @@ +{% extends "layout.html" %} +{% from "macros/recipes.html" import render_recipe_list %} +{% block body %} +

{{ localize('title.latest') }}

+
+ {{ render_recipe_list(site.query('recipes', this.alt) | sort(attribute='date', reverse=True), limit=6) }} +
+{% endblock %} diff --git a/src/templates/tag.html b/src/templates/tag.html new file mode 100644 index 0000000..934ce40 --- /dev/null +++ b/src/templates/tag.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% from "macros/recipes.html" import render_recipe_list %} +{% from "macros/pagination.html" import render_pagination_all %} +{% block title %}{{ this.name }}{% endblock %} +{% block body %} +

Tag: {{ this.name }}

+ {{ render_recipe_list(this.pagination.items) }} + {{ render_pagination_all(this.pagination) }} +{% endblock %} \ No newline at end of file