parent
ed8c8d64ea
commit
649ccb033c
23
README.md
23
README.md
|
@ -79,18 +79,23 @@ lunch: chipotle bowl
|
||||||
dinner: Lemon Couscous w Salmon and roast broccoli
|
dinner: Lemon Couscous w Salmon and roast broccoli
|
||||||
```
|
```
|
||||||
|
|
||||||
the justfile contains scrips for creating a `.rem` file for remind(1).
|
Scrips:
|
||||||
(from there you can use the `rem2ics` utility to create a calendar file,
|
|
||||||
or `rem2ps` to create a pdf.)
|
- the justfile contains scrips for creating a `.rem` file for remind(1).
|
||||||
it also can create a simple pdf menu via groff and tbl.
|
(from there you can use the `rem2ics` utility to create a calendar file,
|
||||||
finally it print a list of ingredients needed for next week's menu
|
or `rem2ps` to create a pdf.)
|
||||||
so you can plan your shoping.
|
|
||||||
|
- `/bin/pdf.sh`
|
||||||
|
will create a simple pdf menu via groff and tbl.
|
||||||
|
|
||||||
|
- `/bin/indredients.sh`
|
||||||
|
will print a list of ingredients based on the week's menu
|
||||||
|
so you can plan your shoping.
|
||||||
|
|
||||||
## YOU WILL NEED
|
## YOU WILL NEED
|
||||||
|
|
||||||
- recutils
|
- recutils
|
||||||
- groff
|
- groff
|
||||||
- zx
|
|
||||||
|
|
||||||
## GETTING STARTED
|
## GETTING STARTED
|
||||||
|
|
||||||
|
@ -103,7 +108,7 @@ so you can plan your shoping.
|
||||||
|
|
||||||
This might eventually become part of the backend for supervegan.neocities.org
|
This might eventually become part of the backend for supervegan.neocities.org
|
||||||
|
|
||||||
- [ ] remove zx dep (i thought it would make dates easier in the beginning)
|
- [x] remove zx dep (i thought it would make dates easier in the beginning)
|
||||||
- [ ] parameterize the date for which the week should be calculated.
|
- [x] parameterize the date for which the week should be calculated.
|
||||||
- [ ] quantity for recipe ingredient?
|
- [ ] quantity for recipe ingredient?
|
||||||
- [ ] yield for recipe?
|
- [ ] yield for recipe?
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
begin=$(gdate -d'Last Sun')
|
||||||
|
end=$(gdate -d'Last Sun +6 days')
|
||||||
|
else
|
||||||
|
mydate=$1
|
||||||
|
shift
|
||||||
|
begin=`gdate -d "$mydate -$(gdate --date="$mydate" +%u) days"`
|
||||||
|
end=`gdate -d "$begin" -d'+7 days'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
recsel db/menu.rec -e "date >> '$begin'" \
|
||||||
|
| recsel -e "date << '$end'" -P breakfast,lunch,dinner -C \
|
||||||
|
| sort \
|
||||||
|
| uniq \
|
||||||
|
| xargs -I % recsel db/recipes.rec \
|
||||||
|
-t meal \
|
||||||
|
-j recipe \
|
||||||
|
-e "name = '%'" \
|
||||||
|
-G name \
|
||||||
|
-P recipe_ingredient \
|
||||||
|
| sort
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
if [ $# -eq 0 ]
|
||||||
|
then
|
||||||
|
mydate=$(gdate)
|
||||||
|
else
|
||||||
|
mydate=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
firstday=`gdate -d "$mydate -$(gdate --date="$mydate" +%u) days" +%F`
|
||||||
|
lastday=`gdate -d "$firstday +6 days" +%F`
|
||||||
|
firstdayout=`gdate -d"$firstday +1 days" +%F`
|
||||||
|
lastdayout=`gdate -d"$firstday +5 days" +%d`
|
||||||
|
firstdaygroff=`gdate -d"$firstday +1 days" +"%B %_d, %Y"`
|
||||||
|
lastdaygroff=`gdate -d"$firstday +5 days" +"%B %_d, %Y"`
|
||||||
|
|
||||||
|
|
||||||
|
tmpl=$(
|
||||||
|
cat<<EOF
|
||||||
|
.ce
|
||||||
|
.I
|
||||||
|
chez brun
|
||||||
|
.sp 2
|
||||||
|
.LP
|
||||||
|
.ps 14
|
||||||
|
${firstdaygroff} - ${lastdaygroff}
|
||||||
|
.ps
|
||||||
|
.sp 3
|
||||||
|
.LP
|
||||||
|
.TS
|
||||||
|
center expand tab(;);
|
||||||
|
l | lp+2 lp+2 lp+2 lp+2 lp+2
|
||||||
|
- | - - - - -
|
||||||
|
l | l l l l l.
|
||||||
|
;Monday;Tuesday;Wednesday;Thursday;Friday
|
||||||
|
Breakfast;T{
|
||||||
|
$(
|
||||||
|
recsel db/menu.rec -e "date >> '$firstday'" \
|
||||||
|
| recsel -e "date << '$lastday'" \
|
||||||
|
| recsel -p breakfast \
|
||||||
|
| recfmt '.ad l
|
||||||
|
{{breakfast}}
|
||||||
|
T};T{
|
||||||
|
'
|
||||||
|
)
|
||||||
|
T}
|
||||||
|
.sp
|
||||||
|
Lunch;T{
|
||||||
|
$(
|
||||||
|
recsel db/menu.rec -e "date >> '$firstday'" \
|
||||||
|
| recsel -e "date << '$lastday'" \
|
||||||
|
| recsel -p lunch \
|
||||||
|
| recfmt '.ad l
|
||||||
|
{{lunch}}
|
||||||
|
T};T{
|
||||||
|
'
|
||||||
|
)
|
||||||
|
T}
|
||||||
|
.sp
|
||||||
|
Dinner;T{
|
||||||
|
$(
|
||||||
|
recsel db/menu.rec -e "date >> '$firstday'" \
|
||||||
|
| recsel -e "date << '$lastday'" \
|
||||||
|
| recsel -p dinner \
|
||||||
|
| recfmt '.ad l
|
||||||
|
{{dinner}}
|
||||||
|
T};T{
|
||||||
|
'
|
||||||
|
)
|
||||||
|
T}
|
||||||
|
.TE
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
echo "$tmpl" \
|
||||||
|
| groff -t -ms -Tpdf -d paper=letterl -P-pletterl \
|
||||||
|
> dist/"$firstdayout"-"$lastdayout".pdf
|
||||||
|
|
Binary file not shown.
Binary file not shown.
78
justfile
78
justfile
|
@ -16,85 +16,11 @@ rem:
|
||||||
|
|
||||||
# build menu pdf from menu.rec
|
# build menu pdf from menu.rec
|
||||||
pdf:
|
pdf:
|
||||||
#!/usr/bin/env zx
|
sh bin/pdf.sh
|
||||||
const curr = new Date()
|
|
||||||
const firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()));
|
|
||||||
const lastday = new Date(curr.setDate(curr.getDate() - curr.getDay()+6));
|
|
||||||
const options = {
|
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
};
|
|
||||||
const rec = await $`recsel db/menu.rec -e ${'date >> "' + firstday + '"'}`.quiet()
|
|
||||||
.pipe($`recsel -e ${'date << "' + lastday + '"'}`).quiet()
|
|
||||||
const bkfst = await $`echo ${rec}`.quiet()
|
|
||||||
.pipe($`recsel -p breakfast`).quiet()
|
|
||||||
.pipe($`recfmt '.ad l
|
|
||||||
{{{{breakfast}}
|
|
||||||
T};T{
|
|
||||||
'`).quiet()
|
|
||||||
const lunch = await $`echo ${rec}`.quiet()
|
|
||||||
.pipe($`recsel -p lunch`).quiet()
|
|
||||||
.pipe($`recfmt '.ad l
|
|
||||||
{{{{lunch}}
|
|
||||||
T};T{
|
|
||||||
'`).quiet()
|
|
||||||
const dinner = await $`echo ${rec}`.quiet()
|
|
||||||
.pipe($`recsel -p dinner`).quiet()
|
|
||||||
.pipe($`recfmt '.ad l
|
|
||||||
{{{{dinner}}
|
|
||||||
T};T{
|
|
||||||
'`).quiet()
|
|
||||||
const firstdaygroff = new Date(firstday.setDate(firstday.getDate()+1 - firstday.getDay())).toLocaleString('en-US', options);
|
|
||||||
const lastdaygroff = new Date(lastday.setDate(lastday.getDate() - lastday.getDay()+5)).toLocaleString('en-US', options);
|
|
||||||
const tmpl=`
|
|
||||||
.ce
|
|
||||||
.I
|
|
||||||
chez brun
|
|
||||||
.sp 2
|
|
||||||
.LP
|
|
||||||
.ps 14
|
|
||||||
${firstdaygroff} - ${lastdaygroff}
|
|
||||||
.ps
|
|
||||||
.sp 3
|
|
||||||
.LP
|
|
||||||
.TS
|
|
||||||
center expand tab(;);
|
|
||||||
l | lp+2 lp+2 lp+2 lp+2 lp+2
|
|
||||||
- | - - - - -
|
|
||||||
l | l l l l l.
|
|
||||||
;Monday;Tuesday;Wednesday;Thursday;Friday
|
|
||||||
Breakfast;T{
|
|
||||||
${bkfst}
|
|
||||||
T}
|
|
||||||
.sp
|
|
||||||
Lunch;T{
|
|
||||||
${lunch}
|
|
||||||
T}
|
|
||||||
.sp
|
|
||||||
Dinner;T{
|
|
||||||
${dinner}
|
|
||||||
T}
|
|
||||||
.TE`
|
|
||||||
await $`echo ${tmpl}`.quiet()
|
|
||||||
.pipe($`groff -t -ms -Tpdf -d paper=letterl -P-pletterl > dist/${new Date(firstdaygroff).toISOString().slice(0, 10)}-${new Date(lastdaygroff).toISOString().slice(8,10)}.pdf`)
|
|
||||||
|
|
||||||
# build menus!
|
# build menus!
|
||||||
menu: rem pdf
|
menu: rem pdf
|
||||||
|
|
||||||
# shopping list
|
# shopping list
|
||||||
shopping:
|
shopping:
|
||||||
#!/usr/bin/env sh
|
sh bin/ingredients.sh
|
||||||
begin=$(gdate -d'next sun')
|
|
||||||
end=$(gdate -d'next sun +7 days')
|
|
||||||
recsel db/menu.rec -e "date >> '$begin'" \
|
|
||||||
| recsel -e "date << '$end'" -P breakfast,lunch,dinner -C \
|
|
||||||
| sort \
|
|
||||||
| uniq \
|
|
||||||
| xargs -I % recsel db/recipes.rec \
|
|
||||||
-t meal \
|
|
||||||
-j recipe \
|
|
||||||
-e "name = '%'" \
|
|
||||||
-G name \
|
|
||||||
-P recipe_ingredient \
|
|
||||||
| sort
|
|
||||||
|
|
Loading…
Reference in New Issue