* Add a new %destsources hash, which maps between a destination file and
the source page used to create it, ie it's the reverse of %renderedfiles. * Use %destsources in htmllink and urlto for 20-50% speedup.master
parent
7afb843a00
commit
06b955b84a
34
IkiWiki.pm
34
IkiWiki.pm
|
@ -9,8 +9,8 @@ use URI::Escape q{uri_escape_utf8};
|
|||
use open qw{:utf8 :std};
|
||||
|
||||
use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
|
||||
%renderedfiles %oldrenderedfiles %pagesources %depends %hooks
|
||||
%forcerebuild $gettext_obj};
|
||||
%renderedfiles %oldrenderedfiles %pagesources %destsources
|
||||
%depends %hooks %forcerebuild $gettext_obj};
|
||||
|
||||
use Exporter q{import};
|
||||
our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
|
||||
|
@ -328,9 +328,13 @@ sub will_render ($$;$) { #{{{
|
|||
$renderedfiles{$page}=[$dest, grep { $_ ne $dest } @{$renderedfiles{$page}}];
|
||||
}
|
||||
else {
|
||||
foreach my $old (@{$renderedfiles{$page}}) {
|
||||
delete $destsources{$old};
|
||||
}
|
||||
$renderedfiles{$page}=[$dest];
|
||||
$cleared{$page}=1;
|
||||
}
|
||||
$destsources{$dest}=$page;
|
||||
} #}}}
|
||||
|
||||
sub bestlink ($$) { #{{{
|
||||
|
@ -455,7 +459,7 @@ sub urlto ($$) { #{{{
|
|||
return beautify_url(baseurl($from));
|
||||
}
|
||||
|
||||
if (! grep { $_ eq $to } map { @{$_} } values %renderedfiles) {
|
||||
if (! $destsources{$to}) {
|
||||
$to=htmlpage($to);
|
||||
}
|
||||
|
||||
|
@ -489,18 +493,19 @@ sub htmllink ($$$;@) { #{{{
|
|||
return "<span class=\"selflink\">$linktext</span>"
|
||||
if length $bestlink && $page eq $bestlink;
|
||||
|
||||
if (! grep { $_ eq $bestlink } map { @{$_} } values %renderedfiles) {
|
||||
if (! $destsources{$bestlink}) {
|
||||
$bestlink=htmlpage($bestlink);
|
||||
}
|
||||
if (! grep { $_ eq $bestlink } map { @{$_} } values %renderedfiles) {
|
||||
return $linktext unless length $config{cgiurl};
|
||||
return "<span><a href=\"".
|
||||
cgiurl(
|
||||
do => "create",
|
||||
page => pagetitle(lc($link), 1),
|
||||
from => $lpage
|
||||
).
|
||||
"\">?</a>$linktext</span>"
|
||||
|
||||
if (! $destsources{$bestlink}) {
|
||||
return $linktext unless length $config{cgiurl};
|
||||
return "<span><a href=\"".
|
||||
cgiurl(
|
||||
do => "create",
|
||||
page => pagetitle(lc($link), 1),
|
||||
from => $lpage
|
||||
).
|
||||
"\">?</a>$linktext</span>"
|
||||
}
|
||||
}
|
||||
|
||||
$bestlink=abs2rel($bestlink, dirname(htmlpage($page)));
|
||||
|
@ -723,6 +728,7 @@ sub loadindex () { #{{{
|
|||
$oldlinks{$page}=[@{$items{link}}];
|
||||
$links{$page}=[@{$items{link}}];
|
||||
$depends{$page}=$items{depends}[0] if exists $items{depends};
|
||||
$destsources{$_}=$page foreach @{$items{dest}};
|
||||
$renderedfiles{$page}=[@{$items{dest}}];
|
||||
$oldrenderedfiles{$page}=[@{$items{dest}}];
|
||||
$pagecase{lc $page}=$page;
|
||||
|
|
|
@ -10,8 +10,11 @@ ikiwiki (1.50) UNRELEASED; urgency=low
|
|||
[ Joey Hess ]
|
||||
* Add support for PROFILE=1 to the Makefile, this turns on profiling of the
|
||||
wiki build using Devel::Profiler (Dprof can't handle ikiwiki).
|
||||
* Add a new %destsources hash, which maps between a destination file and
|
||||
the source page used to create it, ie it's the reverse of %renderedfiles.
|
||||
* Use %destsources in htmllink and urlto for 20-50% speedup.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Mon, 09 Apr 2007 20:22:44 -0400
|
||||
-- Joey Hess <joeyh@debian.org> Mon, 09 Apr 2007 21:09:32 -0400
|
||||
|
||||
ikiwiki (1.49) unstable; urgency=low
|
||||
|
||||
|
|
|
@ -266,9 +266,9 @@ use the following hashes, using a page name as the key:
|
|||
|
||||
* `links` lists the names of each page that a page links to, in an array
|
||||
reference.
|
||||
* `%renderedfiles` lists names of the files rendered by a page, in an array
|
||||
reference.
|
||||
* `%pagesources` contains the name of the source file for a page.
|
||||
* `%destsources` contains the name of the source file used to create each
|
||||
destination file.
|
||||
* `%pagesources` contains the name of the source file for each page.
|
||||
|
||||
Also, the %IkiWiki::version variable contains the version number for the
|
||||
ikiwiki program.
|
||||
|
|
|
@ -20,7 +20,7 @@ Released 29 April 2006.
|
|||
* Should have fully working [[todo/utf8]] support. (./)
|
||||
* [[Optimised_rendering|todo/optimisations]] if possible. Deal with other
|
||||
scalability issues. _(status: scales to thousands of pages, and approximatly
|
||||
3x as fast as version 1.0)_ (./)
|
||||
3.5 times as fast as version 1.0)_ (./)
|
||||
* Improved [[todo/html]] stylesheets and templates.
|
||||
* Improved scalable [[logo]]. (./)
|
||||
* Support for at other revision control systems aside from svn.
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-04-09 20:10-0400\n"
|
||||
"POT-Creation-Date: 2007-04-09 21:13-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -553,7 +553,7 @@ msgstr ""
|
|||
#. translators: preprocessor directive name,
|
||||
#. translators: the second a page name, the
|
||||
#. translators: third a number.
|
||||
#: ../IkiWiki.pm:620
|
||||
#: ../IkiWiki.pm:625
|
||||
#, perl-format
|
||||
msgid "%s preprocessing loop detected on %s at depth %i"
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in New Issue