initial thridculture edits

This commit is contained in:
q 2025-09-23 17:59:02 -04:00
commit 0ba2a2e03b
172 changed files with 6733 additions and 24 deletions

View file

@ -8,6 +8,9 @@ fn conf_enable_blog {
if(~ $"conf_blog_editors '')
conf_blog_editors=blog-editors
if(~ $"conf_blog_only_pull '')
conf_blog_only_pull=0
if(~ $"conf_max_posts_per_page '')
conf_max_posts_per_page=32
}
@ -23,10 +26,10 @@ fn blagh_init {
# && test -d / `{echo '-a -d '^$blagh_root^$blagh_dirs}
blagh_url=$base_url^$blagh_uri
blagh_root=$sitedir^$blagh_uri
if(check_user $conf_blog_editors) {
if(check_user $conf_blog_editors && ! ~ $"conf_blog_only_pull '1') {
editor_mode=on
if(~ $"post_arg_date '')
post_date=`{datei|sed 's,-,/,g'}
post_date=`{/bin/date -I|sed 's,-,/,g'}
if not
post_date=$post_arg_date
ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'
@ -46,7 +49,7 @@ fn blagh_init {
if not if(~ $req_path $blagh_uri^index.rss)
blagh_setup_feed_handlers rss20.tpl 'text/xml; charset=utf-8'
if not if(~ $req_path $blagh_uri^feed.json)
if not if(~ $req_path $blagh_uri^feed.json)
blagh_setup_feed_handlers jsonfeed.tpl 'application/json; charset=utf-8'
if not if(~ $req_path $blagh_uri^new_post && ! ~ $#editor_mode 0) {
@ -71,6 +74,7 @@ fn blagh_setup_feed_handlers {
}
fn blagh_body {
echo '<div class="bfeed">'
if (! ~ $"blogTitle '')
echo '<h1>'$"blogTitle'</h1>'
@ -81,11 +85,13 @@ fn blagh_body {
# XXX Not sure why this fixes issues with blog setup, probably bug in fltr_cache!
for(p in `{get_post_list $blagh_root^$blagh_dirs}) {
l=`{echo -n $p|sed 's!'$sitedir^'/?(.*)([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])(/[^/]+/)!\2 /\1\2\3!'}
sed '1s!.*![&]('^$l(2)^') ('^$l(1)^')!' < $p/index.md
sed '1s!.*![&]('^$l(2)^') ('^$l(1)^')!' < $p/index.md |
sed 's!\([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]\)!<div class="date">&</div>!'
echo # Needed extra \n so markdown doesn't mess up the formatting, probably can be done in sed.
} | $formatter
# XXX BUG! Markdown [references] break because multiple markdown documents are merged. Should format each blog post independently.
# TODO: use fltr_cache directly, that can fix the previous bug plus provide a perf boost by caching title generation.
echo '</div>'
}
fn get_post_list {
@ -104,7 +110,6 @@ fn mkbpost {
_status=($_status 'You need to provide a post body.')
if(! ~ $"bpdate [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])
_status=($_status 'Invalid date: '''^$"bpdate^'''') # XXX Should make semantic check.
if(~ $#_status 0) {
umask 002 # Let group write
if(! ~ $"bpid '')

View file

@ -25,14 +25,14 @@ fn statpost {
# rfc2822 last time channel content changed.
lbd=`{ndate -m `{date `{mtime `{ls $blagh_root$blagh_dirs/[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/[0-9] | tail -1} | awk '{print $1}'}}}
echo '<lastBuildDate>'$"lbd'</lastBuildDate>'
# rfc2822 publication date for content in the channel.
for(f in `{get_post_list $blagh_root$blagh_dirs}){
statpost $f
# rfc2822 publication date for this post.
pubdate=`{ndate -m `{date `{mtime $f | awk '{print $1}'}}}
pubdate=`{ndate -m `{date `{mtime $f | awk '{print $1}'}}}
%}
<item>
<title><![CDATA[%($title%)]]></title>
<author><![CDATA[%($by%)@noreply.cat-v.org (%($by%))]]></author>
<author><![CDATA[%($by%)]]></author>
<link>%($post_uri%)</link>
<guid isPermaLink="true">%($post_uri%)</guid>
<pubDate>%($pubdate%)</pubDate>