diff --git a/AUTHORS b/AUTHORS index 4acd41b..3f76208 100644 --- a/AUTHORS +++ b/AUTHORS @@ -128,9 +128,13 @@ Contributed software This is a listing of authors of software in the `contrib' directory. -Nathan Kent Bullock: getstamps.py, hardcodedates.py - (No license was included, so the intent was most likely to use the - same license as that of pyblosxom, which is the MIT license) +Nathan Kent Bullock: pyblosxom/getstamps.py, pyblosxom/hardcodedates.py + +Cameron Desautels: pyblosxom/metadate.py + +Mark Ivey: blosxom/metadate_0_0_3 Eric Marsden: cgi.el, httpd.el (assigned past and future changes to FSF) + +Michael Welle: blosxom/getstamps.pl diff --git a/ChangeLog b/ChangeLog index 11a8d26..38f0580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,21 @@ 2007-08-24 Michael Olson + * AUTHORS: Add new authors for contrib files. + * NEWS: Add entries for Muse 3.11. * README: Mention that contents of contrib/blosxom and contrib/pyblosxom have different licenses than the rest of Muse. + * contrib/blosxom/getstamps.pl: New file that implements fetching + timestamps from published Muse files and placing them in a single + timestamps file. That file can then be used by blosxom's metadate + plugin. Thanks to Michael Welle for providing this file, as well + as instructions on how to use Muse with Blosxom. + + * contrib/blosxom/metadate_0_0_3: New file implementing the + metadate plugin for blosxom. + * contrib/pyblosxom/getstamps.py: Add license text. It seems safe to assume that the original author wanted this to be distributed with Pyblosxom, and hence use the MIT license like the rest of @@ -27,7 +38,7 @@ * texi/muse.texi (Blosxom Requirements): Organize information by subheading and subsubheading, and document how to use the metadate - plugin. + plugin. Briefly document using Blosxom to serve Muse entries. 2007-08-23 Michael Olson diff --git a/NEWS b/NEWS index 17b3373..05a92cc 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,13 @@ muse-mode-auto-p set to non-nil, please set muse-mode-auto-p to nil from now on. This was a workaround that some people used to deal with a bug that has now been fixed. +** Support for serving published Muse files with Blosxom. +See the end of the Blosxom Requirements section of the Muse manual for +details. + +** The metadate plugin for PyBlosxom is now included with Muse +in contrib/pyblosxom/metadate.py. + ** Compatibility fixes for Emacs21 and XEmacs *** Use copy-tree instead of copy-alist. @@ -82,6 +89,9 @@ produced by Muse. *** Document support for citations in new Citations section. +*** Document how to use the Pyblosxom metadate plugin in the +Blosxom Requirements section. + * Changes in Muse 3.10 ** Relicense to GPLv3. diff --git a/contrib/blosxom/getstamps.pl b/contrib/blosxom/getstamps.pl new file mode 100644 index 0000000..deee493 --- /dev/null +++ b/contrib/blosxom/getstamps.pl @@ -0,0 +1,111 @@ +#!/usr/bin/perl -w -- + +# +# $Id: getstamps.pl,v 1.3 2007-08-19 13:46:54 welle Exp $ +# + +# Author: Michael Welle + +# This file is available under the terms of the GNU General Public +# License, Version 2. + +# Modified by Michael Olson to add Author note. license text, and to +# fix a use of "muse" rather than $muse_file_extension. + +#my $tsfile = "/tmp/blog/timestamps"; +my $tsfile = "-"; +my $muse_file_extension = "muse"; + +# +# +# +sub process_file { + my ($file) = @_; + + + open( F, "<$file" ); + + while ( ) { + + if ( /^#date\s+(.+)$/ ) { + + close ( F ); + my $d = $1; + + $file =~ s/\.${muse_file_extension}$/\.txt/; + $file =~ s/^\.\///; + + if ( $d =~ /(\d\d\d\d)-(\d\d)-(\d\d)-(\d\d)-(\d\d)/ ) { + + printf TS "${file}=>$2/$3/$1 $4:$5\n"; + return; + + } # if + + } # if + + } # while + + close( F ); + +} # process_file + + + +# +# +# +sub traverse_directory { + my ($directory) = @_; + local *DIR; + my @files = (); + my $pfad = ""; + + + opendir( DIR, $directory ); + @files = readdir( DIR ); + closedir( DIR ); + + + foreach my $file ( @files ) { + + next if ( !( $file =~ /^.*\.${muse_file_extension}$/ ) + || ($file eq '.') || ($file eq '..')); + + + $path = "$directory/$file"; + + if( -d $path ) { + + traverse_directory( $path ); + + } else { + + process_file( $path ); + + } #if + + } #foreach + +} # traverse_directory + + +# +# Here we go... +# + +open( TS, ">${tsfile}" ); + +if ( @ARGV == 0 ) { + + traverse_directory( "." ); + +} else { + + traverse_directory( $ARGV[0] ); + +} #if + +close( TS ); + +exit 0; diff --git a/contrib/blosxom/metadate_0_0_3 b/contrib/blosxom/metadate_0_0_3 new file mode 100644 index 0000000..638eec8 --- /dev/null +++ b/contrib/blosxom/metadate_0_0_3 @@ -0,0 +1,338 @@ +# Blosxom Plugin: metadate +# Author(s): Mark Ivey +# Version: 0.0.3 +# Documentation: See the bottom of this file or type: perldoc metadate + +package metadate; + +# --- Configurable variables ----- + +# fullpath to the external metadates file (see perldoc for description) +$external_file = "$blosxom::datadir/external_metadate"; + +$use_UK_dates = 0; # Default is mm/dd/yy (US) + # Set to 1 to use dd/mm/yy (UK) + +# -------------------------------- + +use English; +use File::Basename; +use Time::Local; +use File::Find; +use File::stat; +use Time::Local; + +use vars qw( %dirs, %all ); + +my $debug = 0; # log debug messages or not? + +sub start +{ + return 1; +} + +# FIXME: make the external metadate file optional +# FIXME: handle both creation date & modification date... + +sub filter +{ + _add_from_find(); + _add_from_file(); + return 1; +} + +sub _add_from_file +{ + # read the external metadates file + unless (open(FILE, "< $external_file")) + { + warn "metadate::filter() couldn't open external file $external_file\n"; + return 0; + } + + while () + { + next if (/^\s*#/); # skip comments + if (/(.*)=>(.*)/) + { + my ($file, $time) = ($1, $2); + $file =~ s!/*$!!; # remove any trailing slashes + $file =~ s!^/*!!; # remove any leading slashes + $file = "$blosxom::datadir/$file"; + warn "metadate: $file=>$time\n" if $debug > 0; + + $time = parsedate($time); + + _add($file, $time); + } + } + close(FILE); + + return 1; +} + +sub _add_from_find +{ + find( + sub { + _add($File::Find::name, extract_date($File::Find::name,$files{$File::Find::name}) || + $files{$File::Find::name} || + stat($File::Find::name)->mtime) + }, + $blosxom::datadir + ); + + return 1; +} + +sub _add +{ + my $file = shift or return; + my $time = shift or return; + + # check %files, then %others, then check for a directory. Always add to %all + if (exists $blosxom::files{$file}) + { + $blosxom::files{$file} = $time; + } + elsif (exists $blosxom::others{$file}) + { + $blosxom::others{$file} = $time; + } + elsif (-d "$file") + { + $dirs{$file} = $time; + } + + $all{$file} = $time; +} + + +# extract_date() taken from Fletcher T. Penney's entriescache plugin +# + +# FIXME I should make _add_from_file() know about these and then +# make them user variables +$use_date_tags = 1; +$update_meta_date = 0; +$meta_timestamp = "meta-creation_timestamp:" unless defined $meta_timestamp; +$meta_date = "meta-creation_date:" unless defined $meta_date; + +sub extract_date { + my ($file, $indexed_date) = @_; + my $new_story = ""; + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); + + # This is an attempt for compatibility with Eric Sherman's entries_index_tagged + # But it does not handle as many date formats, as there are too many additional + # necessary modules that I am not willing to require + + if ( $use_date_tags != 0) { + + open (FILE, $file); + + while ($line = ) { + if ($line =~ /^$meta_timestamp\s*(\d+)/) { + # If present, this format is used + close File; + return $1; + } + + if ($line =~ /^$meta_date\s*(.*)/) { + close File; + return parsedate($1); + } + + if ($line =~ /^\s*$/) { + # Empty Line signifying end of meta-tags + if ($update_meta_date eq 1) { + if ($indexed_date eq 0) { + $indexed_date = stat($file)->mtime; + } + + ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($indexed_date); + $year += 1900; + $mon += 1; + $hour = sprintf("%02d",$hour); + $min = sprintf("%02d",$min); + $sec = sprintf("%02d",$sec); + + if ($use_UK_dates eq 1) { + $new_story .= "$meta_date $mday/$mon/$year $hour:$min:$sec\n\n"; + } else { + $new_story .= "$meta_date $mon/$mday/$year $hour:$min:$sec\n\n"; + } + + while ($line = ) { + $new_story .= $line; + } + + close FILE; + open (FILE, "> $file") or warn "Unable to update date meta-tag on $file\n"; + print FILE $new_story; + close FILE; + return 0; + } else { + close File; + return 0; + } + } + + $new_story .= $line; + } + } + return 0; +} + +# parsedate() taken from Fletcher T. Penney's entriescache plugin +# +sub parsedate +{ + my ($datestring) = @_; + #warn "Parsing $datestring\n"; + + # Possible formatting + # Month can be 3 letter abbreviation or full name (in English) + # Time must be hh:mm or hh:mm:ss in 24 hour format + # Year must be yyyy + # The remaining 1 or 2 digits are treated as date + # ie: May 25 2003 18:40 + # order is not important as long as pieces are there + + # Convert the datestring to a time() format + + # Find "Shorthand" Date + if ( $datestring =~ /\d\d?\/\d\d?\/\d\d\d?\d?/) { + if ( $use_UK_dates eq 0) { + # Use US Formatting + $datestring =~ s/(\d\d?)\/(\d\d?)\/(\d\d\d?\d?)//; + $mon = $1 - 1; + $day = $2; + $year = $3; + } else { + # Use UK Formatting + $datestring =~ s/(\d\d?)\/(\d\d?)\/(\d\d\d?\d?)//; + $mon = $2 - 1; + $day = $1; + $year = $3; + } + + # Now, clean up year if 2 digit + # You may change the 70 to whatever cutoff you like + $year += 2000 if ($year < 70 ); + $year += 1900 if ($year < 100); + } + + # Find Month + $mon = 0 if ($datestring =~ s/(Jan|January)//i); + $mon = 1 if ($datestring =~ s/(Feb|February)//i); + $mon = 2 if ($datestring =~ s/(Mar|March)//i); + $mon = 3 if ($datestring =~ s/(Apr|April)//i); + $mon = 4 if ($datestring =~ s/(May)//i); + $mon = 5 if ($datestring =~ s/(Jun|June)//i); + $mon = 6 if ($datestring =~ s/(Jul|July)//i); + $mon = 7 if ($datestring =~ s/(Aug|August)//i); + $mon = 8 if ($datestring =~ s/(Sep|September)//i); + $mon = 9 if ($datestring =~ s/(Oct|October)//i); + $mon = 10 if ($datestring =~ s/(Nov|November)//i); + $mon = 11 if ($datestring =~ s/(Dec|December)//i); + + # Find Time + if ($datestring =~ s/(\d\d?):(\d\d)(:\d\d)?//) { + $hour = $1; + $min = $2; + $sec = $3; + } + + if ($datestring =~ s/(\d\d\d\d)//) { + $year = $1; + } + + if ($datestring =~ s/(\d\d?)//) { + $day = $1; + } + + return timelocal($sec,$min,$hour,$day,$mon,$year); + +} + + +1; + +__END__ + +=head1 NAME + +Blosxom Plug-in: metadate + +=head1 SYNOPSIS + +Handles meta tags related to dates. + +=head1 VERSION + +0.0.3 + +=head1 AUTHOR + +Mark Ivey , http://zovirl.com + +=head1 DESCRIPTION + +metadate parses metadates in stories. It also +provides a way to save metadates externally from a file. +This is most useful for non-story files, such as pictures or categories which +can't contain metadates internally. + +The file $external_file should contain entries in this format: + + # comment lines start with a "#" + /software=>11/17/2003 22:45 + /software/screenshot.png=>11/18/2003 22:50 + /software/static_file.patch.asc=>11/18/2003 22:50 + +WARNING: The file format changed between version 0.0.1 and 0.0.2. It used +to contain the full path to the file. Now it contains the path from +$blosxom::datadir, to make it easier to relocate $blosxom::datadir + +metadates stores dates in %blosxom::files (for story files), %blosxom::others +(for non-story files), or %metadate::dirs (for directories). Metdates +also provides %metadates::all, which contains any file/directory metadate knows about. + +=head1 SEE ALSO + +Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/ + +Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml + +parsedate() and extract_date() taken from Fletcher T. Penney's entriescache plugin: +http://www.blosxom.com/plugins/indexing/entries_cache.htm + +=head1 BUGS + +Address bug reports and comments to the Blosxom mailing list +[http://www.yahoogroups.com/group/blosxom]. + +=head1 LICENSE + +metadate Blosxom Plugin Copyright 2003-2004, Mark Ivey + +Portions Copyright 2003, Fletcher Penney + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/texi/muse.texi b/texi/muse.texi index 8459d48..4fd05a9 100644 --- a/texi/muse.texi +++ b/texi/muse.texi @@ -1968,6 +1968,27 @@ With the metadate plugin installed in pyblosxom, the date set in this directive will be used instead of the file's modification time. The plugin is included with Muse at @file{contrib/pyblosxom/metadate.py}. +@subheading Blosxom + +It is also possible to use Blosxom, which is written in Perl, to serve +blog entries that were published with Muse. The steps are as follows. + +@enumerate +@item +Download and install blosxom from @url{http://blosxom.sourceforge.net/}. + +@item +Install the metadate plugin. It is available in +@file{contrib/blosxom/metadate_0_0_3}. + +@item +Every time you make a new blog entry, change to the blosxom data +directory and execute the @file{contrib/blosxom/getstamps.pl} script. +This script has only recently been made, and may still have some bugs, +so use with caution. + +@end enumerate + @node Blosxom Entries, Blosxom Options, Blosxom Requirements, Blosxom @comment node-name, next, previous, up @subsection Format of a Blosxom entry and automation