I updated my use.perl journal reader output template. It now nicely handles ECODE sections, and makes a text listing of the URLs at the end of the post.
I still have a few problems with it, but it mostly works and I will fix those in the next go around.
Notice, in the code, that I had to change the literal close ECODE tag to E-CODE to get the template to display correctly for this post.
{ use HTML::Entities; use Text::Autoformat; $entry{body} =~ s=?(p|blockquote)/?>=\n\n=gi; $entry{body} =~ s=?tt>==gi; $entry{body} =~ s|?i>|__|gi; $entry{body} =~ s|?b>|*|gi;
$last_entry = "0";
while( $entry{body} =~ s|\s*(.*?)\s*\s*|\n\n**$last_entry**\n\n|is ) { my $ecode = $1; $ecode =~ s/^/\t/gm; push @ecodes, $ecode; $last_entry++; }
$last_entry = 0;
while( $entry{body} =~ s|(.*?)|$3\[$last_entry]|is ) { push @urls, $2; $last_entry++; }
decode_entities( $entry{body} ); my $text = autoformat( $entry{body}, { right => 73, all => 1 } );
$text =~ s/\*\*(\d+)\*\*/$ecodes[$1]/g;
$text =~ s|\n{3,}|\n\n|gi; $text =~ s=^\n+|\n+$==gi;
$text .= join "\n\t", undef, undef, map { "[$_] $urls[$_]" } 0 .. $#urls; " ====================================================================== $entry{nickname}: $entry{subject} $entry{date}, $entry{id} ---------------------------------------------------------------------- $text "; }