Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
http://werc.cat-v.org/apps/blagh/ patch link was broken. So I rewrote it
diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc
index 71bcef6..5707ccd 100644
--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -10,6 +10,9 @@ fn conf_enable_blog {
if(~ $"conf_max_posts_per_page '')
conf_max_posts_per_page=32
+
+ if(~ $"conf_max_lines_per_post '')
+ conf_max_lines_per_post=10
}
fn blagh_init {
@@ -77,7 +80,7 @@ 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 | head -n $conf_max_lines_per_post
echo # Needed extra \n so markdown doesn't mess up the formatting, probably can be done in sed.
}
# XXX BUG! Markdown [references] break because multiple markdown documents are merged. Should format each blog post independently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment