It’s just data

Blosxom excerpts

Dave Walker: The discussion here got me thinking as to how to include both full feeds and meaningful summaries in my syndicated feeds.

My weblog software's design is based on blosxom's, with entries stored in the familiar title followed by body format.  On my longer entries, such as this one, the first element in the body is a div tag with a class of excerpt, something that I parse out with a set of regular expressions.  This same approach can be implemented in blosxom as a plugin:

package excerpt;

use strict;
use warnings;

our $data;

sub start {
  1;
}

sub story {
  my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
  ($data,$$body_ref) = ($$body_ref =~ /(?:<div class="excerpt">(.*?)<\/div>)?\s*(.*)/s);
  return 1;
}

1;

For entries without an excerpt, the body is left untouched, and $excerpt::data will be a string of length zero.  For entries with an excerpt, the excerpt is stripped from the body and placed into $excerpt::data.


Blosxom Excerpts, Improved

Sam Ruby codes up a tidy plugin for implementing excerpts in Blosxom.... [more]

Trackback from freeform goodness

at

My weblog software's design is based on blosxom's, with entries stored in the familiar title followed by body format. On my longer entries, such as this one, the first element in the body is a div tag with a class of excerpt, something that I parse...

Excerpt from phil ringnalda dot com: Be happy!: Comments at

Sam Ruby: Blosxom excerpts

Making excerpts with Blosxom....

Excerpt from del.icio.us/roberto/pyblosxom at

Sam Ruby: Blosxom excerpts

Making excerpts with Blosxom....

Excerpt from Public marks with tag pyblosxom at

Add your comment