From 0ed66231cb182f36611444dbd643ad5dbd7e2c1c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 8 Feb 2008 16:02:14 +0000 Subject: (format_changelog_changelogs) factorize formatting unlocalized changelogs --- Rpmdrake/formatting.pm | 8 ++++++++ Rpmdrake/pkg.pm | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'Rpmdrake') diff --git a/Rpmdrake/formatting.pm b/Rpmdrake/formatting.pm index 3b987c67..29f187ea 100644 --- a/Rpmdrake/formatting.pm +++ b/Rpmdrake/formatting.pm @@ -35,6 +35,7 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( $spacing + format_changelog_changelogs format_changelog_string format_field format_header @@ -101,6 +102,13 @@ sub format_changelog_string { [ map { [ "$spacing$_\n", if_(/^\*/, { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD }) ] } split("\n", $_[0]) ]; } +sub format_changelog_changelogs { + my (@changelogs) = @_; + format_changelog_string(join("\n", map { + "* " . localtime2changelog($_->{time}) . " $_->{name}\n\n$_->{text}\n"; + } @changelogs)); +} + sub format_update_field { my ($name) = @_; '' . eval { escape_text_for_TextView_markup_format($name) } . ''; diff --git a/Rpmdrake/pkg.pm b/Rpmdrake/pkg.pm index 27c8d56b..8dbd11ea 100644 --- a/Rpmdrake/pkg.pm +++ b/Rpmdrake/pkg.pm @@ -153,8 +153,7 @@ sub extract_header { }; add2hash($pkg, { description => rpm_description($p->description), files => scalar($p->files) ? [ $p->files ] : [ N("(none)") ], - changelog => format_changelog_string(join("\n", map { - "* " . localtime2changelog($_->{time}) . " $_->{name}\n\n$_->{text}\n" } $p->changelogs)) }); + changelog => format_changelog_changelogs($p->changelogs) }); $p->pack_header; # needed in order to call methods on objects outside ->traverse } elsif ($xml_info_pkgs{$name}) { if ($xml_info eq 'info') { @@ -164,9 +163,7 @@ sub extract_header { add2hash($pkg, { files => [ @files ? @files : N("(none)") ] }); } elsif ($xml_info eq 'changelog') { add2hash($pkg, { - changelog => format_changelog_string(join("\n", map { - "* " . localtime2changelog($_->{time}) . " $_->{name}\n\n$_->{text}\n"; - } @{$xml_info_pkgs{$name}{changelogs}})) + changelog => format_changelog_changelogs(@{$xml_info_pkgs{$name}{changelogs}}) }); } $p->pack_header; # needed in order to call methods on objects outside ->traverse -- cgit v1.2.1