summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-01 22:27:37 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-01 22:27:37 +0000
commit819a31ed24cfb95da7e37a7524ecf0655e106903 (patch)
tree460885cf688a87b1464b2dd943d0b2849665ff92 /IkiWiki
parent3de6aab0a42bbcfa5fbf69a417b3f2023f8b684e (diff)
* Rename inlinepage to depends, so that it can be used to refer to more
dependency relationships than just inlining. This will require a rebuild on upgrade to this version. * Move the rss link, put it in the blogpost form if there is one and at the top if not. This is both nicer because easier to find, and it cleans up the code which had used inlinepage as a flag for adding the link later. * Allow the depends GlobList to be built up from multiple sources (such as plugins) during a page render. * Which means that more than one blog is now supported to appear on a single page. (With some limitations.)
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Render.pm41
1 files changed, 26 insertions, 15 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index d0d28e802..f9da33e30 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -139,17 +139,17 @@ sub preprocess ($$) { #{{{
my $command=shift;
my $params=shift;
if (length $escape) {
- "[[$command $params]]";
+ return "[[$command $params]]";
}
elsif (exists $commands{$command}) {
my %params;
while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
$params{$1}=$2;
}
- $commands{$command}->($page, %params);
+ return $commands{$command}->($page, %params);
}
else {
- "[[bad directive $command]]";
+ return "[[bad directive $command]]";
}
};
@@ -200,17 +200,32 @@ sub preprocess_inline ($@) { #{{{
if (! exists $params{show} && $params{archive} eq "no") {
$params{show}=10;
}
- $inlinepages{$parentpage}=$params{pages};
+ if (! exists $depends{$parentpage}) {
+ $depends{$parentpage}=$params{pages};
+ }
+ else {
+ $depends{$parentpage}.=" ".$params{pages};
+ }
my $ret="";
if (exists $params{rootpage}) {
+ # Add a blog post form, with a rss link button.
my $formtemplate=HTML::Template->new(blind_cache => 1,
filename => "$config{templatedir}/blogpost.tmpl");
$formtemplate->param(cgiurl => $config{cgiurl});
$formtemplate->param(rootpage => $params{rootpage});
- my $form=$formtemplate->output;
- $ret.=$form;
+ if ($config{rss}) {
+ $formtemplate->param(rssurl => rsspage(basename($parentpage)));
+ }
+ $ret.=$formtemplate->output;
+ }
+ elsif ($config{rss}) {
+ # Add a rss link button.
+ my $linktemplate=HTML::Template->new(blind_cache => 1,
+ filename => "$config{templatedir}/rsslink.tmpl");
+ $linktemplate->param(rssurl => rsspage(basename($parentpage)));
+ $ret.=$linktemplate->output;
}
my $template=HTML::Template->new(blind_cache => 1,
@@ -267,10 +282,6 @@ sub genpage ($$$) { #{{{
$template->param(hyperestraierurl => cgiurl());
}
- if ($config{rss} && $inlinepages{$page}) {
- $template->param(rssurl => rsspage(basename($page)));
- }
-
$template->param(
title => $title,
wikiname => $config{wikiname},
@@ -375,7 +386,7 @@ sub render ($) { #{{{
my $page=pagename($file);
$links{$page}=[findlinks($content, $page)];
- delete $inlinepages{$page};
+ delete $depends{$page};
$content=linkify($content, $page);
$content=preprocess($page, $content);
@@ -569,18 +580,18 @@ FILE: foreach my $file (@files) {
}
# Handle backlinks; if a page has added/removed links, update the
- # pages it links to. Also handle inlining here.
+ # pages it links to. Also handles rebuilding dependat pages.
# TODO: inefficient; pages may get rendered above and again here;
# problem is the backlinks could be wrong in the first pass render
# above
if (%rendered || @del) {
foreach my $f (@files) {
my $p=pagename($f);
- if (exists $inlinepages{$p}) {
+ if (exists $depends{$p}) {
foreach my $file (keys %rendered, @del) {
my $page=pagename($file);
- if (globlist_match($page, $inlinepages{$p})) {
- debug("rendering $f, which inlines $page");
+ if (globlist_match($page, $depends{$p})) {
+ debug("rendering $f, which depends on $page");
render($f);
$rendered{$f}=1;
last;