aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:10 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:10 +0000
commitd69e518feba786a8ef25b19d8898eb853c51d94e (patch)
treeed44cae093d077c94ab0776f169419fdbfec888b
parent52b02218d8804e66d83db517fcaadd45d9d857a7 (diff)
downloadmgaadvisories-d69e518feba786a8ef25b19d8898eb853c51d94e.tar
mgaadvisories-d69e518feba786a8ef25b19d8898eb853c51d94e.tar.gz
mgaadvisories-d69e518feba786a8ef25b19d8898eb853c51d94e.tar.bz2
mgaadvisories-d69e518feba786a8ef25b19d8898eb853c51d94e.tar.xz
mgaadvisories-d69e518feba786a8ef25b19d8898eb853c51d94e.zip
Add %basename variable
-rwxr-xr-xmkadvisories12
-rw-r--r--tmpl/advisory.html4
-rw-r--r--tmpl/index.html2
3 files changed, 14 insertions, 4 deletions
diff --git a/mkadvisories b/mkadvisories
index 1e5cea1..8e11f82 100755
--- a/mkadvisories
+++ b/mkadvisories
@@ -18,6 +18,13 @@ foreach my $k (keys %$etc_config) {
$config->{$k} = $etc_config->{$k};
}
+my %basename = (
+ CVE => sub { $_[0] },
+ ID => sub { $_[0] },
+ rel => sub { $_[0] },
+ pkg => sub { 'pkg_' . $_[0] },
+);
+
my @report_logs;
sub report_log {
push @report_logs, @_;
@@ -94,12 +101,14 @@ sub output_pages {
config => $config,
advisory => $adv,
advdb => $advdb,
+ basename => \%basename,
};
- process_template($template, 'advisory', $vars, $adv);
+ process_template($template, 'advisory', $vars, $basename{ID}->($adv));
}
my $vars = {
config => $config,
advdb => $advdb,
+ basename => \%basename,
};
process_template($template, 'index', $vars, 'index');
}
@@ -117,6 +126,7 @@ sub send_adv_mail {
config => $config,
advisory => $adv,
advdb => $advdb,
+ basename => \%basename,
};
process_template($template, 'advisory', $vars, \$mailcontent, 'txt');
my $email = Email::Simple->create(
diff --git a/tmpl/advisory.html b/tmpl/advisory.html
index f9a7e63..177933a 100644
--- a/tmpl/advisory.html
+++ b/tmpl/advisory.html
@@ -15,7 +15,7 @@
[% FOREACH rel IN adv.src.keys.sort %]
[% sep %]
[% SET sep = ', ' %]
- <a href="[% rel %].html">[% rel %]</a>
+ <a href="[% basename.rel(rel) %].html">[% rel %]</a>
[% END %]
<br />
@@ -25,7 +25,7 @@
[% FOREACH cve IN adv.CVE %]
[% sep %]
[% SET sep = ', ' %]
- <a href="[% cve %].html">[% cve %]</a>
+ <a href="[% basename.CVE(cve) %].html">[% cve %]</a>
[% END %]
[% END %]
diff --git a/tmpl/index.html b/tmpl/index.html
index f084cc8..bb1691f 100644
--- a/tmpl/index.html
+++ b/tmpl/index.html
@@ -8,7 +8,7 @@
<h1>Mageia Advisories</h1>
<ul>
[%- FOREACH adv IN advdb.advisories.keys.sort.reverse -%]
- <li><a href="[% adv %].html">[% adv %]</a>: [% advdb.advisories.$adv.subject %]</li>
+ <li><a href="[% basename.ID(adv) %].html">[% adv %]</a>: [% advdb.advisories.$adv.subject %]</li>
[%- END -%]
</ul>
<h1>Older Advisories</h1>