add tag filtering system

This commit is contained in:
gnat 2024-10-26 03:56:09 -07:00
parent eff36df75f
commit 849d36529b

View File

@ -3,6 +3,11 @@
`(section ()
"$[echo > /tmp/footnote_count]"
(h1 (:style "display: $[test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' && echo block || echo none]") "$[cat ./html/thoughts/$(basename '{thought}') | grep '<!-- TITLE:' | sed 's/<!-- TITLE://; s/-->//']")
"$[cat ./html/thoughts/$(basename '{thought}') | grep '<!-- DATE:' | sed 's/<!-- DATE://; s/-->//']" (br)
(div (:style "height: 0; margin-top: 5px; justify-content: space-between; align-items: center; display: $[test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' && echo flex || echo none;]")
(p () "$[cat ./html/thoughts/$(basename '{thought}') | grep '<!-- DATE:' | sed 's/<!-- DATE://; s/-->//']")
(p () "categories: $[cat ./html/thoughts/$(basename '{thought}') | grep '<!-- CATEGORIES: ' | sed 's/<!-- CATEGORIES: //; s/-->//' | awk -F';' '{ for (i=1; i<=NF; i++) { sub(/^ +| +$/, \"\", $i); if ($i != \"\") printf \"<a href=\\\"?filter-category=%s\\\">%s</a>, \", $i, $i } }' | sed 's/, $//']"))
"$[test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' && echo '<br>' || true]"
(div () "$[include \"./html/thoughts/$(basename '{thought}')\"]")
"$[test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' || (echo '<h1>thoughts:</h1>'; ls ./html/thoughts | while read -r file; do echo \"<div>$(cat ./html/thoughts/$file | grep '<!-- DATE:' | sed 's/<!-- DATE://; s/-->//') <a href=?thought=$file>$(cat ./html/thoughts/$file | grep '<!-- TITLE:' | sed 's/<!-- TITLE://; s/-->//')</a></div>\"; done | sort --numeric --reverse)]")))
"$[test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' || echo '<h1>posts:</h1>']"
"$[test \"$(echo '{' 'filter-category' '}' | sed 's/ //g')\" != '{filter-category}' || test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' || (ls ./html/thoughts | while read -r file; do echo \"<div>$(cat ./html/thoughts/$file | grep '<!-- DATE:' | sed 's/<!-- DATE://; s/-->//') <a href=?thought=$file>$(cat ./html/thoughts/$file | grep '<!-- TITLE:' | sed 's/<!-- TITLE://; s/-->//')</a><br>categories: $(cat ./html/thoughts/$file | grep '<!-- CATEGORIES: ' | sed 's/<!-- CATEGORIES: //; s/-->//' | awk -F';' '{ for (i=1; i<=NF; i++) { sub(/^ +| +$/, \"\", $i); if ($i != \"\") printf \"<a href=\\\"?filter-category=%s\\\">%s</a>, \", $i, $i } }' | sed 's/, $//')</div>\"; done | sort --numeric --reverse)]"
"$[test \"$(echo '{' 'filter-category' '}' | sed 's/ //g')\" != '{filter-category}' && test \"$(echo '{' 'thought' '}' | sed 's/ //g')\" != '{thought}' || (ls ./html/thoughts | while read -r file; do grep '<!-- CATEGORIES: ' ./html/thoughts/$file | grep '{filter-category}' && echo \"<div>$(cat ./html/thoughts/$file | grep '<!-- DATE:' | sed 's/<!-- DATE://; s/-->//') <a href=?thought=$file>$(cat ./html/thoughts/$file | grep '<!-- TITLE:' | sed 's/<!-- TITLE://; s/-->//')</a><br>categories: $(cat ./html/thoughts/$file | grep '<!-- CATEGORIES: ' | sed 's/<!-- CATEGORIES: //; s/-->//' | awk -F';' '{ for (i=1; i<=NF; i++) { sub(/^ +| +$/, \"\", $i); if ($i != \"\") printf \"<a href=\\\"?filter-category=%s\\\">%s</a>, \", $i, $i } }' | sed 's/, $//')</div>\"; done | sort --numeric --reverse)]")))