diff --git a/Makefile b/Makefile index 4565b0c..4f2d922 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,51 @@ -PROJDIR := 'src' +PROJDIR := src help: @echo - @echo 'make clean - Removes all temporary server-build files (not ./bin)' - @echo 'make server - Start lektor server with live change updates' - @echo 'make build - Build deployable website into ./bin' - @echo 'make deploy - Custom rsync command to sync ./bin to remote server' + @echo ' dev - Switch to development branch' + @echo ' dist - Switch to distribution branch' + @echo ' clean - Removes all temporary server-build files (not ./bin)' + @echo ' plugins - Clean and rebuild plugin cache' + @echo ' clean-all - Rebuild everything (not ./bin)' @echo - @echo 'make find-links - Search for cross reference between recipes' + @echo ' server - Start lektor server with live change updates' + @echo ' build - Build deployable website into ./bin' + @echo ' deploy - Custom rsync command to sync ./bin to remote server' + @echo + @echo + @echo ' find-links - Search for cross reference between recipes' @echo -# Project build & clean +define switch_to + @echo Set source to $(1) + @rm $(PROJDIR)/content/recipes; ln -s $(1) $(PROJDIR)/content/recipes +endef + +# Clean + +dev: + $(call switch_to, '../../data/development/') + +dist: + $(call switch_to, '../../data/distribution/') clean: - @cd '$(PROJDIR)' && \ - temp_path="$$(lektor project-info --output-path)" && \ - if [[ -d "$$temp_path" ]]; then \ - echo "rm -rf $$temp_path"; rm -rf "$$temp_path"; \ - fi + @echo 'Cleaning output' + @cd '$(PROJDIR)' && lektor clean --yes -v + +plugins: + @echo 'Cleaning plugins' + @cd '$(PROJDIR)' && lektor plugins flush-cache && lektor plugins list + +clean-all: clean plugins + +# Build server: - @cd '$(PROJDIR)' && \ - (rm content/recipes; ln -s ../../data/development/ content/recipes) && \ - lektor server + @cd '$(PROJDIR)' && lektor server build: @cd '$(PROJDIR)' && \ - (rm content/recipes; ln -s ../../data/distribution/ content/recipes) && \ lektor build --output-path ../bin --buildstate-path ../build-state -f ENABLE_APPCACHE deploy: diff --git a/README.md b/README.md index 8807073..5566b8a 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ Install 1. Download [Lektor](https://www.getlektor.com/) and follow the instructions. -2. Clone this repository and change to the `src` directory. +2. Clone this repository and change to the root directory. -3. Run `make server` to run a local server and preview the page. +3. Run `make dev server` to run a local server and preview the page. -4. For distribution run `make build` and add an [official deploy](https://www.getlektor.com/docs/deployment/). +4. For distribution run `make dist build` and add an [official deploy](https://www.getlektor.com/docs/deployment/). ### Modify diff --git a/data/development/test-empty-values/contents.lr b/data/development/test-empty-values/contents.lr new file mode 100644 index 0000000..72d796c --- /dev/null +++ b/data/development/test-empty-values/contents.lr @@ -0,0 +1,17 @@ +name: test empty values +--- +yield: +--- +ingredients: +--- +directions: +--- +date: +--- +difficulty: +--- +source: +--- +tags: +--- +time: diff --git a/src/assets/static/style.css b/src/assets/static/style.css index 9c3d0cf..af531ac 100644 --- a/src/assets/static/style.css +++ b/src/assets/static/style.css @@ -2,6 +2,12 @@ --cBg1: #FAF9F7; --cBg2: #EAE9E7; --cBg3: #9A9997; --cRed1: #DC3A59; --cRed2: #AA203A; --cRed3: #EE6A84; } +@media (prefers-color-scheme: dark) { + :root { --cTxt: #DDD; + --cBg1: #191816; --cBg2: #292725; --cBg3: #373635; + --cRed1: #B31; --cRed2: #F64; --cRed3: #FB9; + } +} .center { text-align: center } .small { font-size: 0.8em } @@ -69,7 +75,7 @@ footer table { margin: -10px 0 } */ .tags { display: flex; flex-wrap: wrap; justify-content: center } .tags > * { - background: #FFF; + background: var(--cBg1); border: 1px solid var(--cRed1); border-radius: 0.3em; padding: 0.3em 0.5em; diff --git a/src/packages/force-update b/src/packages/force-update index e209b0a..2c50ec3 160000 --- a/src/packages/force-update +++ b/src/packages/force-update @@ -1 +1 @@ -Subproject commit e209b0a8a4bb8081a74e034b0444e2dde8fb15c8 +Subproject commit 2c50ec35c0320414f883cccd52710766a77b2e10 diff --git a/src/packages/time-duration/lektor_time_duration.py b/src/packages/time-duration/lektor_time_duration.py index e77197c..b0e5696 100644 --- a/src/packages/time-duration/lektor_time_duration.py +++ b/src/packages/time-duration/lektor_time_duration.py @@ -73,7 +73,8 @@ def group_by_time_cluster(dic, arr=[30, 60, 120], reverse=False): except KeyError: groups[key] = set() groups[key].update(recipes) - return sorted(groups.items(), reverse=bool(reverse)) + return sorted(groups.items(), reverse=bool(reverse), + key=lambda x: x[0] if x[0] != '' else 999999999) class TimeDurationPlugin(Plugin): diff --git a/src/templates/cache.manifest b/src/templates/cache.manifest index 05dc3a5..284e723 100644 --- a/src/templates/cache.manifest +++ b/src/templates/cache.manifest @@ -33,7 +33,7 @@ CACHE MANIFEST {%- endfor -%} {%- endif -%} - {% set img = x.attachments.images|sort(attribute='record_label')|first -%} + {% set img = x.attachments.images.order_by('record_label').first() -%} {%- if img -%} {{- _add_(cacheList, img.thumbnail(200, 150, 'crop')) -}} {%- endif -%} diff --git a/src/templates/macros/recipes.html b/src/templates/macros/recipes.html index 46bb165..366ecd4 100644 --- a/src/templates/macros/recipes.html +++ b/src/templates/macros/recipes.html @@ -2,7 +2,7 @@
{%- for recipe in recipes -%} {%- if limit == 0 or loop.index <= limit -%} - {%- set img = recipe.attachments.images|sort(attribute='record_label')|first -%} + {%- set img = recipe.attachments.images.order_by('record_label').first() -%} {#--#}
diff --git a/src/templates/recipe.html b/src/templates/recipe.html index 0aecc1f..f2383a5 100644 --- a/src/templates/recipe.html +++ b/src/templates/recipe.html @@ -4,7 +4,7 @@
diff --git a/src/templates/root.html b/src/templates/root.html index 04150b1..ca6a956 100644 --- a/src/templates/root.html +++ b/src/templates/root.html @@ -3,6 +3,6 @@ {% block body %}

{{ localize(this.alt, 'title.latest') }}

- {{ render_recipe_list(site.query('recipes', this.alt) | sort(attribute='date', reverse=True), limit=6) }} + {{ render_recipe_list(site.query('recipes', this.alt).order_by('-date', 'name'), limit=6) }}
{% endblock %}