Mercurial > hg > chronicle
changeset 166:df0201e39fed
Added 'cut' implementation.
author | Steve Kemp <steve@steve.org.uk> |
---|---|
date | Tue, 11 Mar 2008 20:18:47 +0000 |
parents | 170ae024c82f |
children | 8b9e6aeff4c4 |
files | Makefile README bin/chronicle themes/blog.steve.org.uk/box.inc themes/blog.steve.org.uk/style.css |
diffstat | 5 files changed, 100 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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 <cut> tags. + + For example: + + +/--------------------------\ +This is a line of text +<cut>This is hidden +So is this +</cut> +This is displayed. +\==========================/ + + + Or, with specific test: + +/-------------------------------------------------\ +This is a line of text +<cut text="Click to read more...">This is hidden +So is this +</cut> +This is displayed. +\=================================================/ + Comment Support ---------------
--- 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'} =~ /<cut/i ) + { + $blog->{'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'} =~ /<cut/i ) + { + $blog->{'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'} =~ /<cut/i ) + { + $blog->{'body'} = processCut( $blog->{'body'}, $blog->{'link'} ); + } push( @$entries, $blog ); } } @@ -1153,6 +1167,52 @@ +=begin doc + + Process the body for <cut text="xx"></cut> + +=end doc + +=cut + +sub processCut +{ + my( $body, $link ) = ( @_ ); + + $link = $CONFIG{'url_prefix'} . $link; + + my $cut_text = ""; + + if ( $body =~ /(.*)<cut([^>]*)>(.*)<\/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 .= " <a href=\"$link\">$cut_text</a> "; + $body .= $post; + + } + + return( $body ); +} + + =begin doc
--- 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 @@ <ul> <li><a href="http://debian-administration.org/">Debian Administration</a></li> <li><a href="http://www.steve.org.uk/">My Website</a></li> +<li><a href="http://mail-scanning.com/">Anti Spam Filtering</a></li> <li><a href="http://www.steve.org.uk/contact/">Get In Touch</a></li> </ul> </div>
--- 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;