# HG changeset patch # User steve # Date 1187114298 0 # Node ID f0884c3c035a783819cb3fecadcf78cc6b50ddfe # Parent b8a289afc7833ee16c9bb9bae12600882a5c0991 2007-08-14 17:58:18 by steve Support textile / markdown / html by default. diff -r b8a289afc783 -r f0884c3c035a Makefile --- a/Makefile Tue Aug 14 17:47:09 2007 +0000 +++ b/Makefile Tue Aug 14 17:58:18 2007 +0000 @@ -8,14 +8,14 @@ # -- # http://www.steve.org.uk/ # -# $Id: Makefile,v 1.3 2007-08-13 23:22:03 steve Exp $ +# $Id: Makefile,v 1.4 2007-08-14 17:58:18 steve Exp $ # # Only used to build distribution tarballs. # DIST_PREFIX = ${TMP} -VERSION = 0.1 +VERSION = 0.2 BASE = chronicle diff -r b8a289afc783 -r f0884c3c035a bin/chronicle --- a/bin/chronicle Tue Aug 14 17:47:09 2007 +0000 +++ b/bin/chronicle Tue Aug 14 17:58:18 2007 +0000 @@ -54,7 +54,7 @@ -- http://www.steve.org.uk/ - $Id: chronicle,v 1.7 2007-08-14 14:22:05 steve Exp $ + $Id: chronicle,v 1.8 2007-08-14 17:58:18 steve Exp $ =cut @@ -245,6 +245,7 @@ $CONFIG{'output'} = "./output"; $CONFIG{'template'} = "./themes/default"; $CONFIG{'url-prefix'} = ""; + $CONFIG{'format'} = 'html'; } @@ -294,7 +295,7 @@ if ( $VERSION ) { - my $REVISION = '$Revision: 1.7 $'; + my $REVISION = '$Revision: 1.8 $'; if ( $REVISION =~ /1.([0-9.]+) / ) { $REVISION = $1; @@ -1094,6 +1095,27 @@ close( ENTRY ); # + # Convert the body if we're supposed to. + # + if ( $CONFIG{'format'} eq 'html' ) + { + # nop + } + elsif( lc($CONFIG{'format'}) eq 'markdown' ) + { + $body = markdown2HTML( $body ); + } + elsif( lc($CONFIG{'format'}) eq 'textile' ) + { + $body = textile2HTML( $body ); + } + else + { + print "Unkown blog entry format. Leaving text as raw\n"; + } + + # + # # If we have title then we can store it # my $entryTags; @@ -1336,3 +1358,93 @@ } } } + + + +=begin doc + + Convert from markdown to HTML. + +=end doc + +=cut + +sub markdown2HTML +{ + my( $text ) = (@_); + + # + # Make sure we have the module installed. Use eval to + # avoid making this mandatory. + # + my $test = "use Text::Markdown;"; + + # + # Test loading the module. + # + eval( $test ); + if ( $@ ) + { + print < html then output. +# +# textile +# ------- +# The blog entries are converted from textile -> html then output. +# +# format = html +# + + +# # We can disable the sidebar if we want # # no-tags = 1