# HG changeset patch # User Steve Kemp # Date 1205266727 0 # Node ID df0201e39fed01307a4d20f67b5d4715b802f0e4 # Parent 170ae024c82f320b997a521f6e0e249219da066e Added 'cut' implementation. diff -r 170ae024c82f -r df0201e39fed Makefile --- a/Makefile Wed Jan 16 18:50:40 2008 +0000 +++ b/Makefile Tue Mar 11 20:18:47 2008 +0000 @@ -113,11 +113,11 @@ # # NOTE: Removes empty local directories. # -update: +update: hg pull --update steve: - chronicle --theme-dir=./themes --theme=default --url-prefix=http://www.steve.org.uk/Software/chronicle/demo/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo/" --no-comments - chronicle --theme-dir=./themes --theme=copyrighteous --url-prefix=http://www.steve.org.uk/Software/chronicle/demo2/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo2/" --no-comments - chronicle --theme-dir=./themes --theme=blocky --url-prefix=http://www.steve.org.uk/Software/chronicle/demo3/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo3/" --no-comments + ./bin/chronicle --theme-dir=./themes --theme=default --url-prefix=http://www.steve.org.uk/Software/chronicle/demo/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo/" --no-comments + ./bin/chronicle --theme-dir=./themes --theme=copyrighteous --url-prefix=http://www.steve.org.uk/Software/chronicle/demo2/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo2/" --no-comments + ./bin/chronicle --theme-dir=./themes --theme=blocky --url-prefix=http://www.steve.org.uk/Software/chronicle/demo3/ --pre-build="/bin/rm -rf ./output" --post-build="rsync -v -r output/* steve@www.steve.org.uk:/home/www/www.steve.org.uk/htdocs/Software/chronicle/demo3/" --no-comments diff -r 170ae024c82f -r df0201e39fed README --- a/README Wed Jan 16 18:50:40 2008 +0000 +++ b/README Tue Mar 11 20:18:47 2008 +0000 @@ -32,7 +32,7 @@ Installation ------------ - It is possible to run the software without installing it, just + It is possible to run the software without installing it, just by placing blog entries in the ./blog directory and running ./bin/chronicle. @@ -74,6 +74,33 @@ is used in preference to the current date if none is present. +Entry Cutting +------------- + + If you wish to truncate an entry you may do so via the tags. + + For example: + + +/--------------------------\ +This is a line of text +This is hidden +So is this + +This is displayed. +\==========================/ + + + Or, with specific test: + +/-------------------------------------------------\ +This is a line of text +This is hidden +So is this + +This is displayed. +\=================================================/ + Comment Support --------------- diff -r 170ae024c82f -r df0201e39fed bin/chronicle --- a/bin/chronicle Wed Jan 16 18:50:40 2008 +0000 +++ b/bin/chronicle Tue Mar 11 20:18:47 2008 +0000 @@ -837,6 +837,11 @@ { my $blog = readBlogEntry( $file ); + if ( $blog->{'body'} =~ /{'body'} = processCut( $blog->{'body'}, $blog->{'link'} ); + } + push( @$tmp, $blog ) if (keys( %$blog ) ); } my @tmp2 = sort bywhen @$tmp; @@ -963,6 +968,11 @@ my $blog = readBlogEntry( $f ); if (keys( %$blog ) ) { + if ( $blog->{'body'} =~ /{'body'} = processCut( $blog->{'body'}, $blog->{'link'} ); + } + $CONFIG{'verbose'} && print "\tAdded: $f\n"; push( @$entries, $blog ); } @@ -1094,6 +1104,10 @@ my $blog = readBlogEntry( $f ); if (keys( %$blog ) ) { + if ( $blog->{'body'} =~ /{'body'} = processCut( $blog->{'body'}, $blog->{'link'} ); + } push( @$entries, $blog ); } } @@ -1153,6 +1167,52 @@ +=begin doc + + Process the body for + +=end doc + +=cut + +sub processCut +{ + my( $body, $link ) = ( @_ ); + + $link = $CONFIG{'url_prefix'} . $link; + + my $cut_text = ""; + + if ( $body =~ /(.*)]*)>(.*)<\/cut>(.*)/gis ) + { + my $pre = $1; + my $cut = $2; + my $hid = $3; + my $post = $4; + + # + # See if they supplied text="xxxxx" + # + if ( defined( $cut ) && ( $cut =~ /text=['"]([^'"]+)['"]/i ) ) + { + $cut_text = $1; + } + + $body = $pre; + + if (! length( $cut_text ) ) + { + $cut_text = "This entry has been cut, click to read on."; + } + $body .= " $cut_text "; + $body .= $post; + + } + + return( $body ); +} + + =begin doc diff -r 170ae024c82f -r df0201e39fed themes/blog.steve.org.uk/box.inc --- a/themes/blog.steve.org.uk/box.inc Wed Jan 16 18:50:40 2008 +0000 +++ b/themes/blog.steve.org.uk/box.inc Tue Mar 11 20:18:47 2008 +0000 @@ -4,6 +4,7 @@ diff -r 170ae024c82f -r df0201e39fed themes/blog.steve.org.uk/style.css --- a/themes/blog.steve.org.uk/style.css Wed Jan 16 18:50:40 2008 +0000 +++ b/themes/blog.steve.org.uk/style.css Tue Mar 11 20:18:47 2008 +0000 @@ -57,7 +57,7 @@ font-weight: bold; font-size: 120%; padding: 0.26ex 10px; - + } div.entry div.date { text-align: right; @@ -82,6 +82,12 @@ float: left; } +div.entry div.body ul +{ + list-style-type: disc; + list-style-position: inside; + margin: 0 0 1em 0; +} ul { list-style-type: none;