NAME

Posy::Plugin::ShortBody - Posy plugin to give the start of an entry body

VERSION

This describes version 0.30 of Posy::Plugin::ShortBody.

SYNOPSIS

    @plugins = qw(Posy::Core
	...
	Posy::Plugin::ShortBody));
    @entry_actions = qw(header
	    ...
	    parse_entry
	    short_body
	    render_entry
	);

DESCRIPTION

Purpose: Populates the flavour template variable $entry_short_body with the first sentence of the entry body (defined as everything before the first ., !, or ?) and strips out HTML tags along the way. Perfect for providing shortened, plaintext versions of stories for an RSS feed or summary index.

This creates a 'short_body' entry action, which should be placed after 'parse_entry' in the entry_action list, and before 'render_entry'.

Configuration

This expects configuration settings in the $self->{config} hash, which, in the default Posy setup, can be defined in the main "config" file in the data directory.

short_body_remove_header

If true, removes the first header it encounters in the body, and uses the first sentence after that. (1 is true, 0 is false) (default: true)

short_body_replace_body

If the short_body_replace_body option is true, then this replaces $entry_body with the short body contents. This is useful when one wishes to speed processing when one knows that only the short body is going to be used (such as in chrono/category index pages). This needs to be done with care, naturally. (default: false)

OBJECT METHODS

Documentation for developers and those wishing to write plugins.

init

Do some initialization; make sure that default config values are set.

Entry Action Methods

Methods implementing per-entry actions.

short_body

$self->short_body($flow_state, $current_entry, $entry_state)

Parses $current_entry->{body} into $current_entry->{short_body} If $self->{config}->{short_body_replace_body} is true, then also sets $current_entry->{body}.

REQUIRES

Posy
Posy::Core

Test::More

SEE ALSO

perl(1). Posy

BUGS

Please report any bugs or feature requests to the author.

AUTHOR

Kathryn Andersen (RUBYKAT)
perlkat AT katspace dot com
http://www.katspace.com

COPYRIGHT AND LICENCE

Copyright (c) 2004-2005 by Kathryn Andersen

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.