changeset 302:6f1aaf5309c7

Merging in latest release
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 21 Dec 2008 23:53:28 +0000
parents 05ef582dfa3b (current diff) 4985d2fda1dd (diff)
children c45e82e72bc4
files cgi-bin/comments.cgi
diffstat 12 files changed, 147 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Oct 28 00:44:56 2008 +0000
+++ b/.hgignore	Sun Dec 21 23:53:28 2008 +0000
@@ -9,4 +9,5 @@
 ./debian/*.substvars
 ./debian/files
 ./debian/chronicle/*
-./debian/chronicle.debhelper.log
\ No newline at end of file
+./debian/chronicle.debhelper.log
+./.version
--- a/.hgsigs	Tue Oct 28 00:44:56 2008 +0000
+++ b/.hgsigs	Sun Dec 21 23:53:28 2008 +0000
@@ -11,3 +11,6 @@
 f2d74e0a495e35b84fdab9b0de4d572c37ffd67c 0 iEYEABECAAYFAki8RMMACgkQwM/Gs81MDZ0lUwCgv6yoXneuXhUVMM+OdpsI50GXIm0AoNyYt7PboZgR2NFW061EU/IaXGMQ
 3475517f0d0e6d7c482f80f7da4f5e2d4fbbc337 0 iEYEABECAAYFAki8RMwACgkQwM/Gs81MDZ1m/gCgktXNwGDIp8cCaU/WGEY0inbpJ0gAniqaXyrN0s8HwPtTyb0u5+qgwN/r
 c9758e7a2a4b640f20432450e75b9b0227ed62ec 0 iEYEABECAAYFAkjuVQ4ACgkQwM/Gs81MDZ0eoACglWwPJg5D2EMMXmK3rZG/4U9lPMMAoKsH2VDsk+EJnxe+qO1OePScotHK
+a86f5aad996646c0d3f9915c266c0dc97cd33a28 0 iEYEABECAAYFAkk6+goACgkQwM/Gs81MDZ3R8ACfcCvg8igl+CzrLyriREfMjJTqmRUAoJ8sp/rlvvhtG4c1wp9QhQr5GlXK
+65ba5f7aaa5083b54c59157a3578f7315533a8d7 0 iEYEABECAAYFAkk+wFcACgkQwM/Gs81MDZ07uwCeNuyKsqenC/MJZeIVQmybjJoWm0MAnA5/wwvniGN5CVNaVzCY05EFwFlD
+b593b701d0574f0327def561e88df325e8bfd442 0 iEYEABECAAYFAklAKBcACgkQwM/Gs81MDZ3CIACeMQ6cOItrcc4ge+uXs9yEG9YgvGcAoJxgbsiUuRxwoo8wUJUI6GusVB7h
--- a/.hgtags	Tue Oct 28 00:44:56 2008 +0000
+++ b/.hgtags	Sun Dec 21 23:53:28 2008 +0000
@@ -10,3 +10,5 @@
 7b0e9663a4748a3da0b26a1130b37e45e623a8b7 release-3.0
 a73c11c99d635a6d5c7d459479342b13d99fc1ac release-3.1
 c60b7c5184cd72f5bca1b0214b77af5837865e01 release-3.2
+cc70a7663938ecc7722f635aa8846ef801ead171 release-3.3
+eba6872a5309d922647cb69d5150751c1bc88426 release-3.4
--- a/.release	Tue Oct 28 00:44:56 2008 +0000
+++ b/.release	Sun Dec 21 23:53:28 2008 +0000
@@ -5,7 +5,7 @@
 #   http://release.repository.steve.org.uk/
 #
 # Steve
-# -- 
+# --
 #
 
 
@@ -30,6 +30,11 @@
 
 
 #
+#  Version number
+#
+version=.version
+
+#
 #  Upload location.
 #
 upload=steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle
--- a/AUTHORS	Tue Oct 28 00:44:56 2008 +0000
+++ b/AUTHORS	Sun Dec 21 23:53:28 2008 +0000
@@ -30,4 +30,7 @@
    - Provided fixup for the default comment handling of the default theme.
 
   Bob Walker [bob [@] uk.org.randomness]
-   - Added titles to RSS feeds
\ No newline at end of file
+   - Added titles to RSS feeds
+
+  Nicolau Werneck [nwerneck [@] com.gmail]
+   - Added UTF-8 support for textile formatted input files.
\ No newline at end of file
--- a/COMMENTS	Tue Oct 28 00:44:56 2008 +0000
+++ b/COMMENTS	Sun Dec 21 23:53:28 2008 +0000
@@ -1,8 +1,9 @@
 
 
-  Chronicle, since version 2.0, supports the submission of comments
- upon published posts.  This document describes how you would go
- about enabling this support.
+  Chronicle supports the submission of comments upon published posts,
+ via an optional CGI script.
+
+  This document describes how you would go about enabling this support.
 
 
 
@@ -15,11 +16,13 @@
   There are two ways this software is typically used:
 
    Single Machine
+   --------------
      The blog input is stored upon your web-server and you generate
     the output directly to a http-accessible directory upon that
     machine.
 
    Multiple Machines
+   -----------------
      The blog input lives upon one machine, and once you've generated
     the output you copy it over to a remote web-server where it may
     be viewed.
@@ -32,7 +35,7 @@
 Common Setup
 ------------
 
-  Install the included file cgi-bin/comments.cgi upon the web-server
+  Install the included file comments.cgi upon the web-server
  which hosts the blog, and adjust the settings at the start of that
  file to specify:
 
--- a/Makefile	Tue Oct 28 00:44:56 2008 +0000
+++ b/Makefile	Sun Dec 21 23:53:28 2008 +0000
@@ -13,7 +13,7 @@
 #  Only used to build distribution tarballs.
 #
 DIST_PREFIX = ${TMP}
-VERSION     = 3.2
+VERSION     = 3.4
 BASE        = chronicle
 
 
@@ -44,6 +44,7 @@
 	@find . -name '*.1' -exec rm \{\} \;
 	@find . -name '*.bak' -exec rm \{\} \;
 	@find . -name '*.tmp' -exec rm \{\} \;
+	@if [ -e .version ]; then rm -f .version; fi
 	@if [ -d comments ]; then rm -rf comments; fi
 	@if [ -d output   ]; then rm -rf output; fi
 	@if [ -e build-stamp ]; then rm -f build-stamp; fi
@@ -94,15 +95,16 @@
 	mv $(DIST_PREFIX)/$(BASE)-$(VERSION).tar.gz .
 	rm -rf $(DIST_PREFIX)/$(BASE)-$(VERSION)
 	gpg --armour --detach-sign $(BASE)-$(VERSION).tar.gz
+	echo $(VERSION) > .version
+
 
 
 #
 #  Tidy the code
 #
 tidy:
-	if [ -x /usr/bin/perltidy ]; then \
-	perltidy -b -nt -bt=2 -sbt=1 -bl  -mbl=3 -sbl -bbs -bbb -anl  -lp bin/chronicle ;\
-	perltidy -b -nt -bt=2 -sbt=1 -bl  -mbl=3 -sbl -bbs -bbb -anl  -lp cgi-bin/comments.cgi \
+	if [ -x ~/bin/perltidy ]; then \
+           ~/bin/perltidy ./bin/chronicle ./cgi-bin/comments.cgi \
 	; fi
 
 
--- a/README	Tue Oct 28 00:44:56 2008 +0000
+++ b/README	Sun Dec 21 23:53:28 2008 +0000
@@ -114,7 +114,7 @@
 \==========================/
 
 
-  Or, with specific test:
+  Or, with specific text:
 
 /-------------------------------------------------\
 This is a line of text
--- a/bin/chronicle	Tue Oct 28 00:44:56 2008 +0000
+++ b/bin/chronicle	Sun Dec 21 23:53:28 2008 +0000
@@ -30,6 +30,11 @@
    --pre-build   Specify a command to execute prior to building the blog.
    --post-build  Specify a command to execute once the blog has been built.
 
+  Sorting Options:
+
+   --recent-dates-first  Show recent entries first in the archive view.
+   --recent-tags-first   Show recent entries first in the tag view.
+
   Optional Features:
 
    --force        Force the copying of static files from the blog theme.
@@ -487,6 +492,11 @@
     $CONFIG{ 'force' } = 0;
 
     #
+    #  UTF-8 for textile
+    #
+    $CONFIG{ 'charset' } = 'utf-8';
+
+    #
     #  Comments enabled globally.
     #
     $CONFIG{ 'comment-days' } = 0;
@@ -543,8 +553,13 @@
             "lower-case",     \$CONFIG{ 'lower-case' },
             "comment-days=s", \$CONFIG{ 'comment-days' },
 
+            # sorting
+            "recent-tags-first",  \$CONFIG{ 'recent-tags-first' },
+            "recent-dates-first", \$CONFIG{ 'recent-dates-first' },
+
             # input format.
-            "format=s", \$CONFIG{ 'format' },
+            "format=s",  \$CONFIG{ 'format' },
+            "charset=s", \$CONFIG{ 'charset' },
 
             # prefix
             "url-prefix=s", \$CONFIG{ 'url_prefix' },
@@ -637,6 +652,37 @@
         exit;
     }
 
+    #
+    #  Make sure we have no duplicate titles.
+    #
+    my %titles;
+    foreach my $key ( keys(%results) )
+    {
+
+        #
+        #  Get the title for this file.
+        #
+        my $title = $results{ $key }->{ 'title' };
+        next if ( !defined($title) );
+
+        #
+        #  If we've seen this already then abort
+        #
+        if ( $titles{ $title } )
+        {
+            print "Non-unique title: $title\n";
+            print "Shared by (at least):\n";
+            print "\t" . $key . "\n";
+            print "\t" . $titles{ $title } . "\n";
+            print "\nAborting\n";
+            exit;
+        }
+        else
+        {
+            $titles{ $title } = $key;
+        }
+    }
+
     return %results;
 }
 
@@ -1013,7 +1059,16 @@
     #
     #  Sort the entries by date
     #
-    my @sortedEntries = reverse sort bywhen @$entries;
+    my @sortedEntries;
+
+    if ( $CONFIG{ 'recent-tags-first' } )
+    {
+        @sortedEntries = sort bywhen @$entries;
+    }
+    else
+    {
+        @sortedEntries = reverse sort bywhen @$entries;
+    }
 
     #
     #  Now write the output as a HTML page.
@@ -1162,7 +1217,16 @@
     #
     #  Sort the entries by date
     #
-    my @sortedEntries = reverse sort bywhen @$entries;
+    my @sortedEntries;
+    if ( $CONFIG{ 'recent-dates-first' } )
+    {
+        @sortedEntries = sort bywhen @$entries;
+    }
+    else
+    {
+        @sortedEntries = reverse sort bywhen @$entries;
+    }
+
 
     #
     #  Now write the output as a HTML page.
@@ -2308,10 +2372,23 @@
     }
 
     #
-    #  Convert.
+    #  Convert, via the textile helper.
     #
-    $text = Text::Textile::textile($text);
-    return ($text);
+    my $textile = new Text::Textile;
+
+    if ( defined( $CONFIG{ 'charset' } ) )
+    {
+        $CONFIG{ 'verbose' } &&
+          print "Formatting via textile with charset $CONFIG{'charset'}\n";
+
+        $textile->charset( $CONFIG{ 'charset' } );
+    }
+
+    #
+    #  Now return HTML
+    #
+    my $html = $textile->process($text);
+    return ($html);
 }
 
 
--- a/cgi-bin/comments.cgi	Tue Oct 28 00:44:56 2008 +0000
+++ b/cgi-bin/comments.cgi	Sun Dec 21 23:53:28 2008 +0000
@@ -74,14 +74,14 @@
 #
 #  If any are missing just redirect back to the blog homepage.
 #
-if (    !defined($name)
-     || !length($name)
-     || !defined($mail)
-     || !length($mail)
-     || !defined($body)
-     || !length($body)
-     || !defined($id)
-     || !length($id) )
+if ( !defined($name) ||
+     !length($name) ||
+     !defined($mail) ||
+     !length($mail) ||
+     !defined($body) ||
+     !length($body) ||
+     !defined($id) ||
+     !length($id) )
 {
     if ($ajax)
     {
--- a/debian/changelog	Tue Oct 28 00:44:56 2008 +0000
+++ b/debian/changelog	Sun Dec 21 23:53:28 2008 +0000
@@ -1,3 +1,27 @@
+chronicle (3.4-1) unstable; urgency=medium
+
+  * Abort if non-unique titles are encountered.
+    (Closes: #508268)
+  * Allow date + tag views to be sorted "most recent first",
+    via new command line arguments / configuration file options.
+
+ -- Steve Kemp <skx@debian.org>  Wed, 10 Dec 2008 20:22:02 +0000
+
+chronicle (3.3-1) unstable; urgency=medium
+
+  * Default to UTF-8 when processing input in textile formats.  Allow
+    --charset=foo to override this.
+    Thanks to  Nicolau Werneck for the patch.
+
+ -- Steve Kemp <skx@debian.org>  Sun, 6 Dec 2008 22:16:22 +0000
+
+chronicle (3.2-2) unstable; urgency=medium
+
+  * Install the file cgi-bin/comments.cgi alongside the other example
+    files.  (Closes: #504270)
+
+ -- Steve Kemp <skx@debian.org>  Sun, 2 Nov 2008 14:55:41 +0000
+
 chronicle (3.2-1) unstable; urgency=high
 
   * New upstream release.
--- a/debian/rules	Tue Oct 28 00:44:56 2008 +0000
+++ b/debian/rules	Sun Dec 21 23:53:28 2008 +0000
@@ -45,7 +45,7 @@
 	dh_testroot
 	dh_installchangelogs
 	dh_installdocs
-	dh_installexamples bin/chronicle-rss-importer bin/check-titles
+	dh_installexamples bin/chronicle-rss-importer bin/check-titles cgi-bin/comments.cgi
 	dh_installman chronicle.1 chronicle-spooler.1
 	dh_compress
 	dh_fixperms