Reformatting journal entries

brian_d_foy on 2002-11-13T19:14:37

I updated my template for my use.perl journal reader. Most things show up in a readable form thanks to Damian Conway's black magic in Text::AutoFormat. Most other things are special cases for the wierd things people do with HTML.

This code is the entire file that Text::Template uses to form each message.

{
use HTML::Entities;
use Text::Autoformat;

$entry{body} =~ s==\n\n=gi; $entry{body} =~ s===gi; $entry{body} =~ s||__|gi; $entry{body} =~ s||*|gi;

decode_entities( $entry{body} );

my $text = autoformat( $entry{body}, { right => 73, all => 1 } );

$text =~ s|\n{3,}|\n\n|gi; $text =~ s=^\n+|\n+$==gi;

"====================================================================== $entry{nickname}: $entry{subject} $entry{date}, $entry{id} ----------------------------------------------------------------------

$text " }


I still want to add link parsing so the URLs show up at the end of the message, but I am not that concerned about it at the moment.