Skip to content

Instantly share code, notes, and snippets.

@anjandev
Created May 21, 2018 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anjandev/c517e79042148c136b98334867c545d8 to your computer and use it in GitHub Desktop.
Save anjandev/c517e79042148c136b98334867c545d8 to your computer and use it in GitHub Desktop.
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