inline: The optimisation in 2.41 broke nested inlines. Detect those and avoid overoptimising.

master
Joey Hess 2008-05-31 15:10:23 -04:00
parent 0353882a66
commit 99e5e6dd08
3 changed files with 10 additions and 2 deletions

View File

@ -11,6 +11,7 @@ use URI;
my %knownfeeds; my %knownfeeds;
my %page_numfeeds; my %page_numfeeds;
my @inline; my @inline;
my $nested=0;
sub import { #{{{ sub import { #{{{
hook(type => "getopt", id => "inline", call => \&getopt); hook(type => "getopt", id => "inline", call => \&getopt);
@ -329,7 +330,7 @@ sub preprocess_inline (@) { #{{{
} }
} }
return $ret if $raw; return $ret if $raw || $nested;
push @inline, $ret; push @inline, $ret;
return "<div class=\"inline\" id=\"$#inline\"></div>\n\n"; return "<div class=\"inline\" id=\"$#inline\"></div>\n\n";
} #}}} } #}}}
@ -350,11 +351,14 @@ sub get_inline_content ($$) { #{{{
my $file=$pagesources{$page}; my $file=$pagesources{$page};
my $type=pagetype($file); my $type=pagetype($file);
if (defined $type) { if (defined $type) {
return htmlize($page, $type, $nested++;
my $ret=htmlize($page, $type,
linkify($page, $destpage, linkify($page, $destpage,
preprocess($page, $destpage, preprocess($page, $destpage,
filter($page, $destpage, filter($page, $destpage,
readfile(srcfile($file)))))); readfile(srcfile($file))))));
$nested--;
return $ret;
} }
else { else {
return ""; return "";

2
debian/changelog vendored
View File

@ -2,6 +2,8 @@ ikiwiki (2.49) UNRELEASED; urgency=low
* haiku: Generate valid xhtml. * haiku: Generate valid xhtml.
* ikiwiki-mass-rebuild: Don't trust $! when setting $) * ikiwiki-mass-rebuild: Don't trust $! when setting $)
* inline: The optimisation in 2.41 broke nested inlines. Detect those
and avoid overoptimising.
-- Joey Hess <joeyh@debian.org> Fri, 30 May 2008 19:08:54 -0400 -- Joey Hess <joeyh@debian.org> Fri, 30 May 2008 19:08:54 -0400

View File

@ -8,3 +8,5 @@ If an inlined page itself contains an inline directive, the nested directive wil
When rendered, _pets_ [contains](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/) the content from _pets/dogs_ and _pets/cats_, but not the pages inlined into them. However, the subpages [correctly](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/dogs/) [include](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/cats/) their own children. When rendered, _pets_ [contains](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/) the content from _pets/dogs_ and _pets/cats_, but not the pages inlined into them. However, the subpages [correctly](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/dogs/) [include](http://www.willthompson.co.uk/tmp/ikiwiki-nested-inline/output/pets/cats/) their own children.
This used to work in at least ikiwiki 1.45. I stepped through `preprocess_inline`, but couldn't see why this wasn't working. This used to work in at least ikiwiki 1.45. I stepped through `preprocess_inline`, but couldn't see why this wasn't working.
> Broke due to overoptimisation, fixed now. [[done]] --[[Joey]]