From: Simon McVittie Date: Thu, 18 Jun 2009 17:27:00 +0000 (+0100) Subject: IkiWiki::Render: split out backlink_pages() function from backlinks() X-Git-Tag: 3.15~73^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9c13e29d4fbb85a83b0ed5fd7271d7c1688fbc07;p=ikiwiki.git 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. --- 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.