# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 28
# self = https://watcher.sour.is/conv/ifqfzya
@type_v

This is how I render the blog


$ ls -1 p
2021-02-28 15:34:42 Welcome
2021-02-28 15:35:21 How to add a navigation menu
2021-02-28 15:35:39 How to add custom titles
2021-03-09 19:45:23 How to render 
Markdown How to add a navigation menu.html How to add custom titles.html How to render Markdowntml Welcome.html
@adi @type_v


cat bin/mkws
...
for p in "$srcdir"/p/*
do
        test "${p##*.}" == "html" && continue
        echo "Making p/$(echo "${p##*/}" | cut -c21-).html"
        pp "$sharedir"/l.upphtml "$p" "$1" > "p/$(echo "${p##*/}" | cut -c21-).html"

done
...
@adi @type_v \n\n
\ncat bin/mkws\n...\nfor p in "$srcdir"/p/*\ndo\n        test "${p##*.}" == "html" && continue\n        echo "Making p/$(echo "${p##*/}" | cut -c21-).html"\n        pp "$sharedir"/l.upphtml "$p" "$1" > "p/$(echo "${p##*/}" | cut -c21-).html"\n\ndone\n...\n
@adi @type_v \n\n
\ncat bin/mkws\n...\nfor p in "$srcdir"/p/*\ndo\n        test "${p##*.}" == "html" && continue\n        echo "Making p/$(echo "${p##*/}" | cut -c21-).html"\n        pp "$sharedir"/l.upphtml "$p" "$1" > "p/$(echo "${p##*/}" | cut -c21-).html"\n\ndone\n...\n
@adi @type_v \n\n
\n$  cat blog.upphtml\n<h1>Blog</h1>\n<h2>News and a collection of tips and tricks for <code>mkws</code></h2>\n<ol id=i>\n#!\nfind p -mindepth 1 | sort -r | while read -r f\ndo\ntest "${f##*.}" == "html" && continue;\nt=$(echo "${f##*/}" | cut -c21-)\n#!\n<li>\n<h2><a href=p/$(echo "$t" | pe).html>$t</a></h2>\n<time>$(echo "${f##*/}" | cut -c1-10 )</time>\n</li>\n#!\ndone\n#!\n</ol>\n
@adi @type_v \n\n
\n$  cat blog.upphtml\n<h1>Blog</h1>\n<h2>News and a collection of tips and tricks for <code>mkws</code></h2>\n<ol id=i>\n#!\nfind p -mindepth 1 | sort -r | while read -r f\ndo\ntest "${f##*.}" == "html" && continue;\nt=$(echo "${f##*/}" | cut -c21-)\n#!\n<li>\n<h2><a href=p/$(echo "$t" | pe).html>$t</a></h2>\n<time>$(echo "${f##*/}" | cut -c1-10 )</time>\n</li>\n#!\ndone\n#!\n</ol>\n
@adi @type_v


$  cat blog.upphtml
<h1>Blog</h1>
<h2>News and a collection of tips and tricks for <code>mkws</code></h2>
<ol id=i>
#!
find p -mindepth 1 | sort -r | while read -r f
do
test "${f##*.}" == "html" && continue;
t=$(echo "${f##*/}" | cut -c21-)
#!
<li>
<h2><a href=p/$(echo "$t" | pe).html>$t</a></h2>
<time>$(echo "${f##*/}" | cut -c1-10 )</time>
</li>
#!
done
#!
</ol>
@adi @type_v \n\n
\ncat share/f.upp\n
\ f\n...\n```">nhttps://clbin.com/XiMw4\n\n```\ncat bin/mkws\n...\necho "Making feed"\npp "$sharedir"/f.upp "$1" > f\n...\n```
@adi @type_v


cat share/f.upp

https://clbin.com/XiMw4


cat bin/mkws
...
echo "Making feed"
pp "$sharedir"/f.upp "$1" > f
...
@adi @type_v \n\n
\ncat share/f.upp\n
\ f\n...\n```">nhttps://clbin.com/XiMw4\n\n```\ncat bin/mkws\n...\necho "Making feed"\npp "$sharedir"/f.upp "$1" > f\n...\n```
@adi @type_v Might be a good blog post in itself. 😁
@adi @type_v Might be a good blog post in itself. 😁
@type_v @adi pe is pe.c https://clbin.com/X1GkA, an utility for percent encoding strings.
@type_v @adi pe is pe.c https://clbin.com/X1GkA, an utility for percent encoding strings.
@adi @type_v Ah, and\n\n
\n$ cat share/l.upphtml\n...\n<main>\n#!\nif test "${1%/*}" == "./p"\nthen\n#!\n<article>\n#!\ncmark "$1" | \\\nsed "s/\\\n\\(<h1>.*<\\/h1>\\)/\\\n\\1<time>$(echo "${1##*/}" | cut -c1-10 )<\\/time>/g"\n#!\n</article>\n#!\nelse\npp "$1"\nfi\n#!\n</main>\n
@adi @type_v Ah, and\n\n
\n$ cat share/l.upphtml\n...\n<main>\n#!\nif test "${1%/*}" == "./p"\nthen\n#!\n<article>\n#!\ncmark "$1" | \\\nsed "s/\\\n\\(<h1>.*<\\/h1>\\)/\\\n\\1<time>$(echo "${1##*/}" | cut -c1-10 )<\\/time>/g"\n#!\n</article>\n#!\nelse\npp "$1"\nfi\n#!\n</main>\n...\n
@adi @type_v Ah, and\n\n
\n$ cat share/l.upphtml\n...\n<main>\n#!\nif test "${1%/*}" == "./p"\nthen\n#!\n<article>\n#!\ncmark "$1" | \\\nsed "s/\\\n\\(<h1>.*<\\/h1>\\)/\\\n\\1<time>$(echo "${1##*/}" | cut -c1-10 )<\\/time>/g"\n#!\n</article>\n#!\nelse\npp "$1"\nfi\n#!\n</main>\n...\n
@adi @type_v Ah, and


$ cat share/l.upphtml
...
<main>
#!
if test "${1%/*}" == "./p"
then
#!
<article>
#!
cmark "$1" | \
sed "s/\
\(<h1>.*<\/h1>\)/\
\1<time>$(echo "${1##*/}" | cut -c1-10 )<\/time>/g"
#!
</article>
#!
else
pp "$1"
fi
#!
</main>
...
@adi @type_v You could delete the ifs there and just render the Markdown if all you're building is a blog.
@adi @type_v You could delete the ifs there and just render the Markdown if all you're building is a blog.
@adi Thanks! Having a model for how to adjust the script to a subdirectory is really helpful!
@type_v @adi I'm fairly new to the world of UNIX and shell scripting, so I have a lot to learn, but the idea of a bloat-free, easily portable SSG was really appealing. I appreciate the development and newbie support! ;)
@type_v Please post your website :p
@type_v Please post your website :p
@type_v I'm not that old either, I've been using Linux one way or another for some 20 years, but only started learning UNIX as properly as I can for about 5-6 years.
@type_v I'm not that old either, I've been using Linux one way or another for some 20 years, but only started learning UNIX as properly as I can for about 5-6 years.
@adi @type_v Also, if you feel satisfied with my work, please consider donating here https://www.buymeacoffee.com/adriangrigore 😊
@adi @type_v Also, if you feel satisfied with my work, please consider donating here https://www.buymeacoffee.com/adriangrigore 😊