From 9c13e29d4fbb85a83b0ed5fd7271d7c1688fbc07 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 18 Jun 2009 18:27:00 +0100 Subject: [PATCH] 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. --- IkiWiki/Render.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 2da18738d..6900d5eed 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -24,13 +24,19 @@ sub calculate_backlinks () { $backlinks_calculated=1; } -sub backlinks ($) { +sub backlink_pages ($) { my $page=shift; calculate_backlinks(); + return keys %{$backlinks{$page}}; +} + +sub backlinks ($) { + my $page=shift; + my @links; - foreach my $p (keys %{$backlinks{$page}}) { + foreach my $p (backlink_pages($page)) { my $href=urlto($p, $page); # Trim common dir prefixes from both pages. -- 2.26.2