summaryrefslogtreecommitdiff
path: root/apps/blagh/app.rc
diff options
context:
space:
mode:
authorGravatar Jeremiah Dow <jeremdow@gmail.com> 2011-03-17 22:16:48 -0400
committerGravatar Jeremiah Dow <jeremdow@gmail.com> 2011-03-17 22:16:48 -0400
commit02bab6a363c4b7dc16cc328c36de352c061433b4 (patch)
tree815649eaef08abd647341784265e5e1f72ee618a /apps/blagh/app.rc
parent6f3401ebd4d8d2f7d138738f60ecbc376c8d3258 (diff)
downloadjeremdow.us-02bab6a363c4b7dc16cc328c36de352c061433b4.tar.gz
rewrite blagh index handling
Diffstat (limited to 'apps/blagh/app.rc')
-rw-r--r--apps/blagh/app.rc29
1 files changed, 10 insertions, 19 deletions
diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc
index 7c74dc1..c89640c 100644
--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -88,28 +88,19 @@ fn blagh_body {
fn get_post_list {
# /./->/|/ done to sort -t| and order by date
# Note: $paths in blagh_dirs should not contain '/./' or '|'
- eval ls -F $*^/./`{req_path_date}/ >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed -e 's,/+\|/+,/,' -e $conf_max_posts_per_page^'q'
+ eval ls -F $*^/.`{req_path_date} >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed -e 's,/+\|/+,/,' -e $conf_max_posts_per_page^'q'
}
fn req_path_date {
- if(~ $req_path *.rss *.atom) {
- echo [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]
- }
- if not {
- year=`{echo $req_path | awk -F'/' '{print $2}'}
- month=`{echo $req_path | awk -F'/' '{print $3}'}
- day =`{echo $req_path | awk -F'/' '{print $4}'}
-
- if(~ $year '')
- year='[0-9][0-9][0-9][0-9]'
-
- if(~ $month '')
- month='[0-9][0-9]'
-
- if(~ $day '')
- day='[0-9][0-9]'
-
- echo $year/$month/$day
+ switch($req_path){
+ case /[0-9][0-9][0-9][0-9]/
+ echo $req_path[0-9][0-9]/[0-9][0-9]/
+ case /[0-9][0-9][0-9][0-9]/[0-9][0-9]/
+ echo $req_path[0-9][0-9]/
+ case /[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/
+ echo $req_path
+ case *
+ echo /[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/
}
}