diff options
author | Cyril Brulebois <kibi@debian.org> | 2020-12-28 20:07:25 +0100 |
---|---|---|
committer | Cyril Brulebois <kibi@debian.org> | 2020-12-28 20:13:56 +0100 |
commit | 8c4721622dd9e717228f408c3aacebdccdfa69f0 (patch) | |
tree | a72da801a08f42cbbee8cbf20a5ae488ec6f16e0 | |
parent | 5c039f1aa5724e24426d9e030e3806da5f3fffef (diff) |
recent_list: hack support for caller-specified rel_path
It had been identified by djpig as something that might be needed at
some point, since the current heuristics to compute a rel_path doesn't
work when one is below a directory X and trying to locate items below a
directory Y that's neither X or under X (e.g. intro/ vs. security/).
This implementation shouldn't change anything for existing callers, as
they'll end up with an undefined last parameter, while callers passing
that extra parameter will skip the insufficient heuristics.
-rw-r--r-- | english/template/debian/recent_list.wml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/english/template/debian/recent_list.wml b/english/template/debian/recent_list.wml index 833d33da066..5497add9d3b 100644 --- a/english/template/debian/recent_list.wml +++ b/english/template/debian/recent_list.wml @@ -109,12 +109,18 @@ sub get_recent_list { $is_events = 0; $is_by_date = 0; - my ($time, $minnum, $eng_dir, $format, $match) = @_; + my ($time, $minnum, $eng_dir, $format, $match, $rel_path) = @_; # djpig: this is a hack for backward compatibility # djpig: I would prefer a new argument $rel_path # djpig: additionally to $eng_dir - my $rel_path = ($time =~ s|^(?:\./)?([[:alpha:]]+)/?||) ? $1 : ''; - $rel_path .= '/' unless $rel_path eq ''; + # + # kibi/2020-12-28: let's retain the previous heuristics when + # rel_path is not defined, while adding support for a + # caller-specified rel_path + if (not defined $rel_path) { + my $rel_path = ($time =~ s|^(?:\./)?([[:alpha:]]+)/?||) ? $1 : ''; + $rel_path .= '/' unless $rel_path eq ''; + } #warn "$rel_path\n"; my $open_by_path = 0; my ($year, $since_year, $since_date); |