aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-01 05:41:37 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-01 05:41:37 +0000
commit5a82103526ab32e018cd999bb6a53d9e097c83a8 (patch)
tree37a9177d56469c3f00f61dfaed560bc0e24fb2c2 /IkiWiki/Render.pm
parent5a9064dea8de666912fc72bfac75f0275a25e8d6 (diff)
downloadikiwiki-5a82103526ab32e018cd999bb6a53d9e097c83a8.tar
ikiwiki-5a82103526ab32e018cd999bb6a53d9e097c83a8.tar.gz
* Implemented expiry options for aggregate plugin.
* Use precalculated backlinks info when determining if files need an update due to a page they link to being added/removed. Mostly significant if there are lots of pages. * Remove duplicate link info when saving index. In some cases it could pile up rather badly. (Probably not the best way to deal with this problem.)
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm28
1 files changed, 12 insertions, 16 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index f59e54f29..5b951df83 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -11,6 +11,7 @@ my %backlinks;
my $backlinks_calculated=0;
sub calculate_backlinks () { #{{{
+ return if $backlinks_calculated;
%backlinks=();
foreach my $page (keys %links) {
foreach my $link (@{$links{$page}}) {
@@ -26,7 +27,7 @@ sub calculate_backlinks () { #{{{
sub backlinks ($) { #{{{
my $page=shift;
- calculate_backlinks() unless $backlinks_calculated;
+ calculate_backlinks();
my @links;
return unless $backlinks{$page};
@@ -303,6 +304,7 @@ sub refresh () { #{{{
scan($file);
}
}
+ calculate_backlinks();
# render changed and new pages
foreach my $file (@changed) {
@@ -311,22 +313,16 @@ sub refresh () { #{{{
$rendered{$file}=1;
}
- # if any files were added or removed, check to see if each page
- # needs an update due to linking to them or inlining them
+ # rebuild pages that link to added or removed pages
if (@add || @del) {
-FILE: foreach my $file (@files) {
- next if $rendered{$file};
- my $page=pagename($file);
- foreach my $f (@add, @del) {
- my $p=pagename($f);
- foreach my $link (@{$links{$page}}) {
- if (bestlink($page, $link) eq $p) {
- debug("rendering $file, which links to $p");
- render($file);
- $rendered{$file}=1;
- next FILE;
- }
- }
+ foreach my $f (@add, @del) {
+ my $p=pagename($f);
+ foreach my $page (keys %{$backlinks{$p}}) {
+ my $file=$pagesources{$page};
+ next if $rendered{$file};
+ debug("rendering $file, which links to $p");
+ render($file);
+ $rendered{$file}=1;
}
}
}