Summary support in Plagger 0.8
From my email sent to plagger-dev list:
I’ve been working on summary support in hackathon-summary branch at http://plagger.org/trac/browser/branches/hackathon-summary
The point of summary feature is:
-
summary, title, body and author has “is_html” or “is_text” method, to determine if the data it holds is HTML or plaintext.
-
Plagger::Util::strip_html($html) will render HTML into text using HTML::FormatText (Making it pluggable is left TODO)
-
$entry->summary->text and $entry->body->html does what you mean
-
summary is automatically extracted from feed metadata ala RSS description or Atom:summary field. If there’s not one, Summary::Auto plugin will auto-generate using Plagger::Util::summarize($entry->body)
-
actually how to generate summary from body HTML is pluggable. There’re couple of Summary::* plugins already checked in in the branch. http://plagger.org/trac/browser/branches/hackathon-summary/plagger/lib/Plagger/Plugin/Summary
The final thing left undone is how to declare which field to use in each Notify/Publish plugin without updating the templates. I’d like to say, “send full-content HTML mail to my gmail account, but plaintext of summary to my mobile. Use summary as HTML in Publish::Planet.” with a single config, not requiring to update the templates.
The syntax would be something like:
-
module: Publish::Gmail config: mailto: **@gmail.com override: body: $args->{entry}->body->html
-
module: Publish::Gmail config: mailto: **@mobile.example.com override: body: $args->{entry}->summary->text
-
module: Publish::Planet config: mailto: **@mobile.example.com override: body: $args->{entry}->summary->html
But not sure what would be the best syntax.
I’d like to apply the override/localize methodology to link(s) as well, ala:
- module: Notify::IM override: link: $args->{entry}->alternate_link(‘tinyurl’)
to display link in TinyURLed (using WWW::Shorten), for instance.
Any feedbacks would be welcome on this.