diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-02-08 17:56:04 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-02-08 17:56:04 +0000 |
commit | b14a27edd226a46ddddd012ec68fa88cdb3c4045 (patch) | |
tree | a1e31778e3484481ce99063ec90940e658f610c2 /Rpmdrake/formatting.pm | |
parent | 6fb41ace5c3ee7ab7e0a36c0e2840801772911d0 (diff) | |
download | rpmdrake-b14a27edd226a46ddddd012ec68fa88cdb3c4045.tar rpmdrake-b14a27edd226a46ddddd012ec68fa88cdb3c4045.tar.gz rpmdrake-b14a27edd226a46ddddd012ec68fa88cdb3c4045.tar.bz2 rpmdrake-b14a27edd226a46ddddd012ec68fa88cdb3c4045.tar.xz rpmdrake-b14a27edd226a46ddddd012ec68fa88cdb3c4045.zip |
(format_changelog_string) highlight relevant parts of the changelog (#37208);
updating callers (build_expander, extract_header, format_changelog_changelogs,
format_pkg_simplifiedinfo)
Diffstat (limited to 'Rpmdrake/formatting.pm')
-rw-r--r-- | Rpmdrake/formatting.pm | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Rpmdrake/formatting.pm b/Rpmdrake/formatting.pm index 29f187ea..bf8aa987 100644 --- a/Rpmdrake/formatting.pm +++ b/Rpmdrake/formatting.pm @@ -98,13 +98,27 @@ sub localtime2changelog { to_utf8(POSIX::strftime("%c", localtime($_[0]))) } our $spacing = " "; sub format_changelog_string { + my ($installed_version, $string) = @_; #- preprocess changelog for faster TextView insert reaction - [ map { [ "$spacing$_\n", if_(/^\*/, { 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD }) ] } split("\n", $_[0]) ]; + my %date_attr = ( 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD ); + my %update_attr = ( 'style' => 'italic'); + my $version; + my $highlight; + [ map { + my %attrs; + if (/^\*/) { + add2hash(\%attrs, \%date_attr); + ($version) = /(\S*-\S*)\s*$/; + $highlight = $installed_version ne N("(none)") && 0 < URPM::rpmvercmp($version, $installed_version); + } + add2hash(\%attrs, \%update_attr) if $highlight; + [ "$spacing$_\n", if_(%attrs, \%attrs) ] + } split("\n", $string) ]; } sub format_changelog_changelogs { - my (@changelogs) = @_; - format_changelog_string(join("\n", map { + my ($installed_version, @changelogs) = @_; + format_changelog_string($installed_version, join("\n", map { "* " . localtime2changelog($_->{time}) . " $_->{name}\n\n$_->{text}\n"; } @changelogs)); } |