Adds dark mode
Fix compare int-str bug Fix empty values error Replace sort by attribute filter with direct order_by additional make targets
This commit is contained in:
51
Makefile
51
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:
|
||||
|
||||
@@ -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
|
||||
|
||||
17
data/development/test-empty-values/contents.lr
Normal file
17
data/development/test-empty-values/contents.lr
Normal file
@@ -0,0 +1,17 @@
|
||||
name: test empty values
|
||||
---
|
||||
yield:
|
||||
---
|
||||
ingredients:
|
||||
---
|
||||
directions:
|
||||
---
|
||||
date:
|
||||
---
|
||||
difficulty:
|
||||
---
|
||||
source:
|
||||
---
|
||||
tags:
|
||||
---
|
||||
time:
|
||||
@@ -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;
|
||||
|
||||
Submodule src/packages/force-update updated: e209b0a8a4...2c50ec35c0
@@ -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):
|
||||
|
||||
@@ -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 -%}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="tile-grid">
|
||||
{%- 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() -%}
|
||||
<a href="{{ recipe|url }}">{#--#}
|
||||
<div class="recipe-tile">
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<article class="recipe">
|
||||
<!-- date added: {{ this.date }} -->
|
||||
<section id="img-carousel" class="v-scroll center">
|
||||
{%- for img in this.attachments.images|sort(attribute='record_label') %}
|
||||
{%- for img in this.attachments.images.order_by('record_label') %}
|
||||
<img class="lozad" data-src="{{ img|url }}" height="400">
|
||||
{%- endfor %}
|
||||
</section>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
{% block body %}
|
||||
<h1>{{ localize(this.alt, 'title.latest') }}</h1>
|
||||
<div class="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) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user