IkiWiki::Render: split out backlink_pages() function from backlinks()

This separates style from content - backlinks() performs lossy
transformations on the page names to get it in the form that the page
template wants.
master
Simon McVittie 2009-06-18 18:27:00 +01:00
parent 2b0c8d167e
commit 9c13e29d4f
1 changed files with 8 additions and 2 deletions

View File

@ -24,13 +24,19 @@ sub calculate_backlinks () {
$backlinks_calculated=1; $backlinks_calculated=1;
} }
sub backlinks ($) { sub backlink_pages ($) {
my $page=shift; my $page=shift;
calculate_backlinks(); calculate_backlinks();
return keys %{$backlinks{$page}};
}
sub backlinks ($) {
my $page=shift;
my @links; my @links;
foreach my $p (keys %{$backlinks{$page}}) { foreach my $p (backlink_pages($page)) {
my $href=urlto($p, $page); my $href=urlto($p, $page);
# Trim common dir prefixes from both pages. # Trim common dir prefixes from both pages.