#
#############################################################
# Breadcrumbs
>
>
>
# Handle links, and equivalent english/ directory tree (if the translated index is missing)
my $eng_dir = '$(WML_SRC_DIRNAME)';
$eng_dir =~ s,(.*)/webwml/\w*,$1/webwml/english,;
my $relative_path = '.';
my $breadcrumbs;
# If the current page is already the index, go one directory up
if ( '$(WML_SRC_FILENAME)' eq 'index.wml' )
{
# Use only year for security/YYYY and vote/YYYY directories
$relative_path = '..';
$eng_dir =~ s,/[^/]*$,,;
}
# Loop to get each directory index title
# no breadcrumb for 404 page
if ( '$(WML_SRC_FILENAME)' ne '404.wml' ) {
while ( $eng_dir !~ m,webwml/english$, )
{
my $title;
# Open the index page to get its title
# Some directories have no index
if ( $eng_dir !~ m,ports/powerpc/inst$, and
$eng_dir !~ m,users/\w*$, ) {
open INDEX, "$relative_path/index.wml" or
open INDEX, "$eng_dir/index.wml" or
do {
warn "couldn't open $relative_path/index.wml or $eng_dir/index.wml: $!\n";
# FIXME: This command should break the loop
die;
};
# Use only year for security/YYYY and vote/YYYY directories
if ( $eng_dir =~ m,security/(\d{4})$, or $eng_dir =~ m,vote/(\d{4})$, )
{ $title = $1 ; }
# Use short name for l10n stats #616340
elsif ( $eng_dir =~ m,international/l10n/po$, )
{ $title = 'PO' ; }
elsif ( $eng_dir =~ m,international/l10n/po-debconf$, )
{ $title = 'PO Debconf' ; }
elsif ( $eng_dir =~ m,international/l10n/po4a$, )
{ $title = 'po4a' ; }
# Handle translated title in website stats
elsif ( $eng_dir =~ m,website/stats$, )
{ $title = '' ; }
# Normal case: use $(title)
else {
foreach () {
$title = "$1" if ($_ =~ /^#use wml::.* title="(.*?)"/)
}
}
close INDEX;
# Actually construct breadcrumbs
$breadcrumbs = "$title\n / " . $breadcrumbs ;
}
# Go one directory up
$relative_path .= '/..';
$eng_dir =~ s,/[^/]*$,,;
}}
# Actually print breadcrumbs
print '
'.$breadcrumbs;
$(title)
#
# Handle DPN: use date and only year for News/weekly/YYYY directory