fix include for markdown, remove postbuild

This commit is contained in:
yosh 2024-04-02 17:35:40 -04:00
parent 4e5d2cde31
commit 742b5aa0b7
2 changed files with 2 additions and 69 deletions

View File

@ -58,8 +58,8 @@ include() {
# if the path contains a slash, then treat it as-is
# else, try getting it from $_INCDIR
case "$1" in
*/*.md) __lowdown "$1" ;;
*.md) __lowdown "$_INCDIR"/"$1" ;;
*/*.md) __process_md "$1" ;;
*.md) __process_md "$_INCDIR"/"$1" ;;
*/*) __process_shp "$1" ;;
*) __process_shp "$_INCDIR"/"$1" ;;
esac

View File

@ -1,67 +0,0 @@
# generate feed.atom for blog and articles
blog_uuid=ab54972a-c095-4177-8a36-b77d48d86bec
articles_uuid=9268eb67-28dd-48c8-8855-fdb6f9e444d4
for type in blog articles; do
cd "$_SRCDIR/$type"
all_ctimes=""
all_mtimes=""
entries=""
# sort the posts by ctime, which allows us to be independent of filename
# this allows for more flexibility :D
# unlike the index.html file, we can't just sort at the end
# because we have multiple lines of everything. so we have
# to do a 2-pass
feed="$_BUILDDIR/$type/feed.atom"
for f in *.md; do
mtime="" ctime=""
set_md_metadata "$f"
all_ctimes="$ctime $f$_NL$all_ctimes"
all_mtimes="${mtime:-"$ctime"}$_NL$all_mtimes"
done
while IFS= read -r _entry; do
_entry="${_entry#* }"
{
ctime="" mtime=""
_entry="${_entry##*/}"
set_md_metadata
# xml-compatible title
title="$(__lowdown <<-EOF
$title
EOF
)"
title="${title#*>}"
title="${title%<*}"
# if mtime null, set it to ctime for the purposes of updated stuff
: "${mtime:="$ctime"}"
entries="$entries"'
<entry>
<title>'"$title"'</title>
<link rel="alternate" href="'"/~yosh/$type/${_entry%.md}.html"'"/>
<id>urn:uuid:'"$uuid"'</id>
<published>'"$ctime"'</published>
<updated>'"$mtime"'</updated>
<content type="html">'"$(__lowdown | escapepipe)"'</content>
</entry>'
} < "$_entry"
done <<-EOF
$(echo "$all_ctimes" | sort -r | head -n 10)
EOF
header='<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>yosh'\''s '"$type"'</title>
<link href="https://unix.dog/~yosh/'"$type"'"/>
<author><name>yosh</name></author>
<updated>'"$(echo "$all_mtimes" | sort -r | head -n 1)"'</updated>
<id>urn:uuid:'"$(eval "printf %s \${${type}_uuid}")"'</id>'
printf '%s\n%s\n</feed>' "$header" "$entries" > "$feed"
done