# HG changeset patch # User Christophe Lincoln # Date 1490396383 -3600 # Node ID 798212b3ce40a97edbc7543af1ed75c05f346c4b # Parent 05ccbdd25ab551694cf23248e375a58235e8db84 Better blog archive, fix rss feed diff -r 05ccbdd25ab5 -r 798212b3ce40 plugins/blog/blog.cgi --- a/plugins/blog/blog.cgi Mon Mar 20 00:52:01 2017 +0100 +++ b/plugins/blog/blog.cgi Fri Mar 24 23:59:43 2017 +0100 @@ -76,14 +76,14 @@ p="$1" . ${blog}/${p}/post.conf d="$TITLE" - + # Author info if [ -f "${PEOPLE}/${AUTHOR}/account.conf" ]; then . ${PEOPLE}/${AUTHOR}/account.conf else echo "ERROR: ${PEOPLE}/${AUTHOR}/account.conf" fi - + echo "

$TITLE

" echo "
" cat ${blog}/${p}/post.txt | wiki_parser @@ -110,6 +110,11 @@ done } +# RSS feed requested +if [ "$(GET blog)" == "rss" ]; then + rss && exit 0 +fi + # # Index main page can display the latest Blog posts # @@ -153,7 +158,7 @@ DATE=$(date '+%Y-%m-%d') else . ${blog}/${p}/post.conf - fi + fi cat << EOT

$(gettext "Blog post"): $p

@@ -165,12 +170,12 @@
-
- +

$(gettext "Code Helper:") $(cat lib/jseditor.html) @@ -203,13 +208,13 @@ fi [ -f "${blog}/${p}/post.xml" ] || gen_rss header "Location: $script?blog&p=$p" ;; - + *\ rm\ *) if check_auth && admin_user; then rm -rf ${blog}/"$(GET p)" fi header "Location: $script?blog" ;; - + *\ archives\ *) # List all posts with title only d="Blog archives" @@ -217,41 +222,52 @@ html_header user_box blog_tools - echo "

Blog archives

" - echo "
"
+		cat << EOT
+

Blog archives

+
+ + + + + +EOT for p in $(ls $blog | sort -nr) do . ${blog}/${p}/post.conf - echo "\ -$DATE :$TITLE" - done - echo "" + cat << EOT + + + + +EOT + done + echo "
$(gettext "Date")$(gettext "Title")
$DATE$TITLE
" html_footer && exit 0 ;; - + *\ blog\ *) - if [ "$(GET blog)" == "rss" ]; then - rss && exit 0 - fi d="Blog posts" count="10" header html_header user_box blog_tools + # Exit if plugin is disabled if [ ! -d "$blog" ]; then echo "

" gettext "Blog plugin is not yet active."; echo "

" html_footer && exit 0 fi + # Single post if [ "$(GET p)" ]; then show_post "$(GET p)" else show_posts ${count} echo "

$(gettext "Blog archives")

" - fi + fi + html_footer && exit 0 ;; esac - +