basic barebones

pull/1/head
Luke Smith 3 years ago
commit a80dd9575b
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252

1
.gitignore vendored

@ -0,0 +1 @@
dest

@ -0,0 +1,63 @@
# Based Cooking Website
## Rules for submission
Add reciples as `.md` files to the `src/` directory.
Look at already existing `.md` files for expemlars
or see [example](example.md).
Recipe must be based, i.e. good traditional and substantial food. Nothing
ironic, meme-tier hyper-sugary, meat-substitute, etc.
## Images
Each recipe can have a title image at the top and perhaps
several instructional images as absolutely necessary.
Do not add stock images you found on the internet.
Take a good picture yourself of the actual dish created.
If you see a bad or substandard iamge, you may submit a better one.
Images should be in `.webp` format.
If you submit an image for say, `chicken-parmesan.md`, it should be added as `pix/chicken-parmesan.webp`.
I will create smaller images from that which is seen on the page,
and upon being clicked, the user will see the full-size image.
If you would like to add additional directional images,
they should be numbered with two digits like: `pix/chicken-parmesan-01.webp`, etc.
## About the site
The front page, for now, will just be a list of recipes
and when adding a `.md` page, please manually add a link to it in the list.
As more articles are added, the site will be reorganized, categorized
or will implement server-side scripting or searches.
This is not necessary yet though.
I don't really want images of recipes on the mainpage yet.
I'll think about how best to do it to minimize bandwidth if possible.
This site is generated with [Roman Zolotarev](https://www.romanzolotarev.com/)'s
[ssg5](https://www.romanzolotarev.com/ssg.html) which is also included in this
repo for replicability.
## curl/Search function in the future
I eventually want a command-line/curl interface to this site.
Part of this would be an implicit search function.
So suppose someone wants a recipe with chicken, I'd like
`curl based.cooking/chicken` to return articles with that title.
If there is only one result, that page is opened.
Just something to think about.
Then people could make a simple two or three character alias to get a simple text recipe.
## License
This website and all its content is in the public domain.
By submitting text or images or anything else to this repository,
you waive any pretense of ownership to it,
although you are welcome and recommended to give yourself credit
at the botton of a submitted page for you adding it
(including personal or donation links).

@ -0,0 +1,31 @@
# This is the dish title
If necessary, provide a very brief description of the dish in one or two sentences.
For most dishes, this will be unnecessary.
If there is a title image of this dish, it should be above this paragraph.
## Ingredients
- List the ingredients
- in an unordered list
- similar to this.
- List amounts if necessary.
- Put (optional) at the end of optional ingredients
## Directions
1. Now using an ordered list,
2. give the directions to prepare the dish.
3. If necessary,
4. an image can be included between some directions if needed to explain something particular.
5. But that should be kept to a minimum to reduce bandwidth and aid in simplicity.
## Contribution
Here, just put your name and links to yourself (maybe a website or donation link) if you want.
You may say "Anonymous" or a screenname if desired.
If you add something substantial to an already existing recipe (including and image) you may add your name below with the contribution in parens.
- Luke Smith - [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)
- Luke Smith (photo credit) - [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,7 @@
# based.cooking
# Rules
- Add a .md file to add a recipe.
-

@ -0,0 +1,8 @@
<footer>
<a href="index.html">🏡 Based Cooking Homepage</a> </br>
All site content is in the Public Domain.
</footer>
</body>
</html>

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang=en">
<head>
<title></title>
<meta charset=UTF-8>
<link rel=stylesheet href=style.css>
<link rel="shortcut icon" type="image/x-icon" href="favicon.png">
</head>
<body>

@ -0,0 +1,36 @@
# Chicken Parmesan
The recipe that started this very site.
## Ingredients
- chicken breasts
- tomatoes (San Marzano is best)
- mozzarella cheese
- parmesan cheese
- bread crumbs
- eggs
- flour
- [pasta sauce](pasta-sauce.html)
## Directions
1. Slice the chicken breasts through their width so that they are as flat as possible.
2. Pound breasts as flat as possible.
3. Add flour to a bowl or basin large enough to fit a breast, add pepper.
4. Crack eggs into another large bowl or basin and wisk them.
5. Add breadcrumbs to yet another large bowl or basin. Add generous amounts of grated parmesian.
6. One by one, take each breast and dip and cover it in the flour, then the egg, then the bread crumbs.
7. Cover a pan with olive oil and heat it just under when it begins to smoke.
8. Fry the bread crumb-coated chicken breasts in the oil. Add butter generously while frying to ensure frying oil does not evaporate.
9. Move fried breasts to an oiled or buttered pan, add mozarella and parmesan on them.
10. Broil/cook the breasts only long enough for the cheese to melt.
11. Serve the breasts with [pasta sauce](pasta-sauce.html) either above or below. This is often served with [pasta](pasta.md).
## Note
There is some controversy over when to add the pasta sauce to this dish.
Some place it on the chicken before cooking it with the mozarella.
The sauce, if left on the chicken too long will make the breadcrumbs go soggy.
That also will make leftovers mushy (while still tasty).
I recommend keeping the breasts separate and only adding the sauce when served.

@ -0,0 +1,33 @@
# Chicken Stock or Bone Broth
Chicken stock, or "bone broth" is not a final dish in itself, but is used in many soups and other dishes to add great taste to something otherwise very simple.
While it is easy to make, it sells for very expensive in the store, so it's a good thing to know to make by yourself since it can be done very cheaply.
## Ingredients
- a whole raw chicken with organs removed (Drumsticks or thighs along might suffice if a whole chicken is unavailable.)
- onions
- celery
- carrots
- optional aromatic ingredients
- a bay leaf
- thyme
- rosemary
- crushed peppercorns
## Directions
1. Cut onions, celery and carrots into large chunks (you don't even need to remove the onion peels), add to a large empty pot (stock pot).
2. Add the chicken to the pot as well. It is fine to butcher the chicken to reduce its size, but include all bones and tendons as well.
3. Add any aromatic seasonings.
4. Fill the pot with water up slightly past all the ingredients.
5. Bring contents to a boil, then reduce heat and let simmer for at least 45 minutes.
6. You may want to remove with a spoon or other instrument the bubbles that form on the top. This will give you a clearer stock, but it is not necessary.
7. Strain the liquid, now stock, into another container for storage or use.
You may also eat the remaining chicken, possibly for lunchmeat, but since it has imparted its flavor to the stock, it will be slightly more bland so some seasoning might be advised.
You may eat or compost the remaining vegetables.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,28 @@
# Slow-cooked Chicken Tacos
## Ingredients
- chicken breasts
- two or three onions (preferrably red)
- seasoning:
- adobo seasoning
- paprika
- cheese (either shredded Mexican blend or crumbling cheese)
- small torillas
- lime
- cilatro, tomato, lettuce, other desired taco contents
## Directions
1. Quarter two onions and spread on the bottom of a slow-cooker.
2. Place chicken breasts on top of onions.
3. Season slow-cooker contents liberally with adobo seasoning an paprika any any other desired seasoning, squeeze half of lime too if desired.
4. Let cook on low for 8 hours. Cooking on high for less time is possible as well, but a slower cook is preferrable.
7. Dice the tomato, cilantro, any lettuce and the third onion for taco contents.
9. Shred chicken with forks once coooked. Optionally add a dash more seasoning for taste or appearance.
10. Add chicken, cheese and all the diced ingredients to torillas.
11. Squeeze remainder of lime over finished product.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,5 @@
# Example page
Here is an example page.
Will this be added.

@ -0,0 +1,31 @@
# Gnocchi
Gnocchi is a pasta based on potato, making it a less bloating alternative to other kinds of pasta.
They are substantial and can be roasted in butter and other ingredients.
## Ingredients
- potatoes
- flour
- tomato
- parmesan
- butter
- sage or oregano or thyme
## Directions
1. Boil potatoes (with their skins) until mashable.
2. Slice potatoes in two and scoop them out of their skin.
3. Mash with a potato-masher while adding kosher salt.
4. Slowly begin to add flour while mashing and kneading until there are no lumps of potato and the potato/flour mixture takes on a dough-like consistency.
5. Begin to boil more water with lots of kosher salt added.
6. Flour a work surface, pinch off some of the dough and roll it on the surface into a long chubby snake.
7. Slice the dough snake into small pieces. Press the pieces with your finger to make an indentation.
8. Add the pieces to the boiling water. They will rise to the top when they have ready.
9. In a pan, melt butter and add sprigs of sage (oregano or thyme will work as well, albeit are less traditional). Smashed tomato juices are also a nice addition.
10. Add the cooked gnocchi to the pan and roast them in butter for a minute or two until slighly browned. As pan begins to dry, add some pasta water.
12. Serve gnocchi on a plate, add parmesan cheese liberally. Add garnish if desired.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,33 @@
# 🍳 Based Cooking 🍲
Only Based cooking. No ads, no tracking, nothing but based cooking.
## Recipe list
- [Gnocchi](gnocchi.html)
- [Slow-cooked Chicken Tacos](chicken-tacos.html)
- [Beef Stroganoff](stroganoff.html)
## Basics
- [Chicken Stock and Bone Broth](chicken-stock-bone-broth.html)
- [Pasta (store bought)](pasta.html)
- [Pasta Sauce](pasta-sauce.html)
- [Rice](rice.html)
## More Info
- [Table Salt vs. Kosher Salt?](salt.html)
- [Slow Cooking Benefits and Tips](slow-cooking-tips.html)
- [Get a Mortar and Pestle](mortar-and-pestle.html)
## About this site
Founded to prodive a simple online cookbook without ads and obese web design.
### It's easy to contribute!
- Submit new recipes via git via [Github](https://github.com/lukesmithxyz/based.recipes) or [Gitlab](https://gitlab.com/lukesmithxyz/based.recipes).
- If a recipe has no image for it, make the recipe as presented and submit a picture above or to [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz).
- Donate to the individual people who contribute pages whose names are at the bottom of each page.
- Donate Bitcoin to the site's long-term maintainence fund: `bc1q763s4ud0hgfa66ce64gyh6tsss49vyk5cqcm6w` ([QR code](pix/bitcoin-based-cooking.webp))

@ -0,0 +1,17 @@
# Get a Mortar and Pestle
![mortar-and-pestle](pix/mortar-and-pestle.webp)
Mortars and pestles are tools which have unfortunely been nearly forgotten in modern American kitchens, but they
have been around since the stone age for a reason.
They are one of the most useful appliances and require no electricity.
They easily smash garlic, nuts and other things (also automatically removes skins).
This is much better than simple slicing because it squeezes out the juices and tastes of things.
You can also easily make paste (like pesto) and out of herbs and other simple ingredients.
Many people use a hard-to-clean and expensive electronic food processor to do things like this,
but a larger mortar and pestle could get the job done just as easily.
Do not get procelain mortar and pestles; they are non-functional and loud.
I have two granite ones which work very well (see pic above).

@ -0,0 +1,23 @@
# Pasta sauce
This is very simple pasta sauce.
Unlike modern store-bought sauces, there is no added sugar, only the subtle taste of San Marzano tomatoes.
## Ingredients
- a can of San Marzano tomatoes (or home-grown with some extra pulp)
- onion or garlic
- olive oil
- oregano or basil (Dried or diced)
## Directions
1. Heat up olive oil on saucepan.
2. Add and roast either diced or grated onion or crush and sliced garlic until translucent.
3. Add San Marzano tomatoes, include the liquids from the can if possible.
4. Simmer contents of the pan and crush the tomatoes on the pan with your instrument of choice.
5. Additionally add desired herbs.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,31 @@
# Pasta (store bought)
This is a simple outline of how to cook pasta.
TL;DR: you boil it.
Pasta is usually eaten with some kind of [pasta sauce](pasta-sauce.html) or used in another dish.
## Ingredients
- pasta
- basil (optional)
- butter (optional)
## Directions
1. Fill a large pot about half or 3/4th full with water.
2. Salt the water profusely. The rule of thumb is that water for boiling pasta should taste as salty as the sea.
3. Bring water to a rolling boil.
4. Now add pasta.
5. Keep it boiling, but decrease heat as it tries to overflow.
6. Wait until pasta is at the preferred softness (see below), then strain it.
7. While the pasta is sitting in your strainer, you may add basil leaves or other herbs and aromatics. I also recommend taking a knob or so of room tempurature butter and add it in and stirring it, melting it into the pasta.
### How long should pasta be cooked?
The often recommended way to cook most pasta is *al dente*, which often means "slightly undercooked," or with a subtle firmness that makes it still substantial.
Cooking pasta more than that is no great crime,
but if you keep it in their for *too* long, it'll become mush.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

@ -0,0 +1,31 @@
# Rice
Rice is easy to make in any pot.
The simple use of different spices can change
## Ingredients
- rice
- [chicken stock](chicken-stock.html) (optional)
- onion or garlic (optional)
- lime and cilantro (optional, for a Mexican taste)
## Directions
1. Add some ammount of rice to a pot that has a cover.
2. Add twice as much liquid to the same pot. Water is typical, but for extra flavor, use stock or broth.
3. If desired, dice onion or garlic and mix into rice.
4. Cover the pot, put it on the stove and turn the heat on the highest level.
5. As soon as you hear the water beginning to bubble and boil over, turn the heat down to low and allow it to simmer.
6. Wait for twenty minutes or so until the liquid has evaporated and the rice will be ready.
### For Mexican rice
For Mexican rice, you might want to avoid cooking in stock to avoid taste clashes.
6. Dice up some cilantro.
7. Mix in cilantro to finished rice, along with some squeezes of lime juice.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,41 @@
# Table Salt vs. Kosher Salt
Table salt is the salt on your table: teeny-tiny grains in a little shaker.
Kosher salt is the salt that should be in your kitchen: large, thick grains.
Some people new to cooking get confused on the difference and when to use one or the other.
The long story short is you should always use kosher salt for cooking.
Table salt is much more intense and is only for brisk post-cooking flavoring at the table.
Kosher salt is more subtle, dissolves slower and thus releases its flavor slower.
Note also that you should add a larger mass of kosher salt where you might only
add a pinch of table salt, since table salt is much stronger partially because
it dissolves so quickly.
## Table salt is not lindy.
Table salt has iodine and other additives.
Its history is somewhat analogous to the addition of flouride to municiple
water supplies. Nearly a hundred years ago, the U.S. government began working
with corporations to add iodine to salt ostensibly because they were concerned
about people having iodine deficiencies.
A healthy diet including eggs, dairy and some seafood should get enough iodine
elsewhere to not need it in the form of table salt supplements, so don't feel
like to you need to use it.
## Why is kosher salt called "kosher" salt?
Hebrews and then Jews revile eating meat with any blood in it. Larger grain
salt was better for the process called "koshering" whereby meat is covered in
salt and the salt draws out the liquid blood. Note that table salt is not
non-kosher in Mosaic law either, it is simply not suited for this "koshering"
process because it simply dissolves into the meat.
For one reason or another, this association caught on and we now call coarse
grain salt "kosher." Note that kosher salt is more or less the natural form of
salt, it is not, as one might imagine, some new innovation to comply with
Jewish dietary practice.

@ -0,0 +1,17 @@
# Slow Cooking Benefits and Tips
You can buy a Slow Cooker for cheap, but it is still one of the most precious tools you can have in a kitchen.
## Benefits
- It's cheap: slow-cooking turns the toughest and cheapest cuts of meat into that "fall off the bone" goodness. Chuck steak and pork shoulder/Boston butts are some of the cheapest meats and are sure hard to eat, but put them in a slow-cooker and it's gourmet stuff.
- It is easy and low-effort: ingredients take very little time to prep and the cooking happens overnight or while you're at work.
- It's an objective science: a lot of people have a hard time developing the best techniques for kneading or pan-frying or other culinary skills, but slow-cooking just requires you put the ingredients in. No magic, just follow directions.
- It's relaxing: by the time your food is done, you've had plenty of time to clean up, so you can serve and eat your meal without having to worry about cleaning up afterwards.
- It's portable: you can cook for an event or your friends because you load up your slow-cooker and go.
## Tips
- Things that need more cooking should always go at the bottom. For example, potatoes take forever to cook, so put them under your meat. They'll get the extra cooking they need while getting marinated in juices.
- Only slow-cook dry herbs, not freshly-picked herbs, although you can add freshly-picked herbs in the last 10 or 20 minutes for some extra flavor.
- Only take off the top to check how things are doing in absolute emergencies. It loses a lot more heat than you might expect when you open that.

@ -0,0 +1,32 @@
# Beef Stroganoff
This is American-style stroganoff.
## Ingredients
- beef
- [chicken stock](chicken-stock-bone-broth.html)
- onions
- flour
- butter
- Worchestershire sauce or something similar
- dijon or honey dijon mustard
- egg noodles
## Directions
1. Dice an onion.
2. Cut beef into bite-size strips. Ground beef can also be used (although not traditional), if beef is compacted into strips of similar size.
3. Season the beef with kosher salt, freshly-ground pepper, or any other desired seasoning.
4. Heat a skillet on high with butter or olive oil. Cook the onions until about translucent.
5. Begin adding the beef strips and let them cook, stirring to prevent sticking or unequal cooking.
6. Meanwhile, heat up a pot of highly salted water until it boils. Then add the egg noodles. Do not cook for too long as egg noodles might begin disintegrating when overcooked.
7. Once beef is cooked, pour off the liquid produced from the meat.
8. Add the chicken stock to the pan and continue cooking.
9. Make roux (by mixing a small amount of flour with either water or melted butter). Mix this into the beef and stock as it cooks to thicken it to the desired consistency.
10. Add Worchestershire sauce and the dijon mustard to taste.
11. Serve on a plate with a scoop of egg noodles covered with the beef sauce.
## Contribution
- Luke Smith -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)

@ -0,0 +1,19 @@
body {
max-width: 800px ;
margin: auto ;
margin-bottom: 500px ;
}
h1 {
text-align: center ;
}
footer {
text-align: center ;
}
img {
max-width: 600px ;
margin: auto ;
display: block ;
}

@ -0,0 +1,49 @@
# Reciple name
This is a brief, one or two sentence description of the dish.
Optionally include a picture of the dish here, stored in `pix/` with the same base name as this file.
Please take your own picture after having followed exactly this recipe.
## Ingredients
- Just do
- a very simple
- markdown list for this
- with amounts.
## Directions
1. Now include the directions.
2. I suppose this list should be numbered
3. just for convenience's sake.
4. If necessary, include directional images between these items.
![like this](lol.jpg)
5. Looks good.
6. Obvious,
## Contributers
<!--
Put your name or identifier here if you want.
Limit yourself to a single line with links like this:
-->
- **Luke Smith** -- [website](https://lukesmith.xyz), [donate](https://lukesmith.xyz/donate)
- Billy Smith -- [website](https://lukesmith.xyz) (improved kneading technique added)
<!--
If someone add a *substantial* improvement, they can add their name to the
bottom of the list (at least for the time being). In that case, the original
author's line should still be at the top and bold.
-->
<!--
Other Rules:
- Images should be as small as possible in size, preferably .webp files.
- Minor edits (spell checkings) do not warrant credit at the bottom.
- Everything you add here should be public domain. Getting credit at the bottom for adding the article is not a claim to ownership.
-->

263
ssg5

@ -0,0 +1,263 @@
#!/bin/sh -e
#
# https://rgz.ee/bin/ssg5
# Copyright 2018-2019 Roman Zolotarev <hi@romanzolotarev.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
main() {
test -n "$1" || usage
test -n "$2" || usage
test -n "$3" || usage
test -n "$4" || usage
test -d "$1" || no_dir "$1"
test -d "$2" || no_dir "$2"
src=$(readlink_f "$1")
dst=$(readlink_f "$2")
IGNORE=$(
if ! test -f "$src/.ssgignore"
then
printf ' ! -path "*/.*"'
return
fi
while read -r x
do
test -n "$x" || continue
printf ' ! -path "*/%s*"' "$x"
done < "$src/.ssgignore"
)
# files
title="$3"
h_file="$src/_header.html"
f_file="$src/_footer.html"
test -f "$f_file" && FOOTER=$(cat "$f_file") && export FOOTER
test -f "$h_file" && HEADER=$(cat "$h_file") && export HEADER
list_dirs "$src" |
(cd "$src" && cpio -pdu "$dst")
fs=$(
if test -f "$dst/.files"
then list_affected_files "$src" "$dst/.files"
else list_files "$1"
fi
)
if test -n "$fs"
then
echo "$fs" | tee "$dst/.files"
if echo "$fs" | grep -q '\.md$'
then
if test -x "$(which lowdown 2> /dev/null)"
then
echo "$fs" | grep '\.md$' |
render_md_files_lowdown "$src" "$dst" "$title"
else
if test -x "$(which Markdown.pl 2> /dev/null)"
then
echo "$fs" | grep '\.md$' |
render_md_files_Markdown_pl "$src" "$dst" "$title"
else
echo "couldn't find lowdown nor Markdown.pl"
exit 3
fi
fi
fi
echo "$fs" | grep '\.html$' |
render_html_files "$src" "$dst" "$title"
echo "$fs" | grep -Ev '\.md$|\.html$' |
(cd "$src" && cpio -pu "$dst")
fi
printf '[ssg] ' >&2
print_status 'file, ' 'files, ' "$fs" >&2
# sitemap
base_url="$4"
date=$(date +%Y-%m-%d)
urls=$(list_pages "$src")
test -n "$urls" &&
render_sitemap "$urls" "$base_url" "$date" > "$dst/sitemap.xml"
print_status 'url' 'urls' "$urls" >&2
echo >&2
}
readlink_f() {
file="$1"
cd "$(dirname "$file")"
file=$(basename "$file")
while test -L "$file"
do
file=$(readlink "$file")
cd "$(dirname "$file")"
file=$(basename "$file")
done
dir=$(pwd -P)
echo "$dir/$file"
}
print_status() {
test -z "$3" && printf 'no %s' "$2" && return
echo "$3" | awk -v singular="$1" -v plural="$2" '
END {
if (NR==1) printf NR " " singular
if (NR>1) printf NR " " plural
}'
}
usage() {
echo "usage: ${0##*/} src dst title base_url" >&2
exit 1
}
no_dir() {
echo "${0##*/}: $1: No such directory" >&2
exit 2
}
list_dirs() {
cd "$1" && eval "find . -type d ! -name '.' ! -path '*/_*' $IGNORE"
}
list_files() {
cd "$1" && eval "find . -type f ! -name '.' ! -path '*/_*' $IGNORE"
}
list_dependant_files () {
e="\\( -name '*.html' -o -name '*.md' -o -name '*.css' -o -name '*.js' \\)"
cd "$1" && eval "find . -type f ! -name '.' ! -path '*/_*' $IGNORE $e"
}
list_newer_files() {
cd "$1" && eval "find . -type f ! -name '.' $IGNORE -newer $2"
}
has_partials() {
grep -qE '^./_.*\.html$|^./_.*\.js$|^./_.*\.css$'
}
list_affected_files() {
fs=$(list_newer_files "$1" "$2")
if echo "$fs" | has_partials
then list_dependant_files "$1"
else echo "$fs"
fi
}
render_html_files() {
while read -r f
do render_html_file "$3" < "$1/$f" > "$2/$f"
done
}
render_md_files_lowdown() {
while read -r f
do
lowdown \
< "$1/$f" |
render_html_file "$3" \
> "$2/${f%\.md}.html"
done
}
render_md_files_Markdown_pl() {
while read -r f
do
Markdown.pl < "$1/$f" |
render_html_file "$3" \
> "$2/${f%\.md}.html"
done
}
render_html_file() {
# h/t Devin Teske
awk -v title="$1" '
{ body = body "\n" $0 }
END {
body = substr(body, 2)
if (body ~ /<[Hh][Tt][Mm][Ll]/) {
print body
exit
}
if (match(body, /<[[:space:]]*[Hh]1(>|[[:space:]][^>]*>)/)) {
t = substr(body, RSTART + RLENGTH)
sub("<[[:space:]]*/[[:space:]]*[Hh]1.*", "", t)
gsub(/^[[:space:]]*|[[:space:]]$/, "", t)
if (t) title = t " &mdash; " title
}
n = split(ENVIRON["HEADER"], header, /\n/)
for (i = 1; i <= n; i++) {
if (match(tolower(header[i]), "<title></title>")) {
head = substr(header[i], 1, RSTART - 1)
tail = substr(header[i], RSTART + RLENGTH)
print head "<title>" title "</title>" tail
} else print header[i]
}
print body
print ENVIRON["FOOTER"]
}'
}
list_pages() {
e="\\( -name '*.html' -o -name '*.md' \\)"
cd "$1" && eval "find . -type f ! -path '*/.*' ! -path '*/_*' $IGNORE $e" |
sed 's#^./##;s#.md$#.html#;s#/index.html$#/#'
}
render_sitemap() {
urls="$1"
base_url="$2"
date="$3"
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<urlset'
echo 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
echo 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9'
echo 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'
echo 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
echo "$urls" |
sed -E 's#^(.*)$#<url><loc>'"$base_url"'/\1</loc><lastmod>'\
"$date"'</lastmod><priority>1.0</priority></url>#'
echo '</urlset>'
}
main "$@"

@ -0,0 +1,10 @@
#!/bin/sh
# If you're Luke, add an arg to update the website too.
#rm dest -rf
#mkdir -p dest
ssg5 src dest "Based Cooking (https://based.cooking)" "https://based.cooking"
[ -n "$1" ] &&
rsync -auvrlP --delete-after ~/.local/src/food/ root@based.cooking:/var/www/cooking
Loading…
Cancel
Save