summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-06-18 18:27:00 +0100
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-07-17 11:12:50 +0100
commit9c13e29d4fbb85a83b0ed5fd7271d7c1688fbc07 (patch)
treebeaab48324b3e1810af1c19948ca82811fa32ce2 /IkiWiki
parent2b0c8d167e8b98d11e3504393fe4b98596dfd891 (diff)
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.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Render.pm10
1 files 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.