* Add a destpage parameter to the filter hook.
* Fix links to smilies generated by the smiley plugin for inlined pages. The old links were often wrong, but often still worked by accident.master
parent
fca6ab6def
commit
cf35ee04cd
|
@ -651,12 +651,14 @@ sub preprocess ($$$;$$) { #{{{
|
||||||
return $content;
|
return $content;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub filter ($$) { #{{{
|
sub filter ($$$) { #{{{
|
||||||
my $page=shift;
|
my $page=shift;
|
||||||
|
my $destpage=shift;
|
||||||
my $content=shift;
|
my $content=shift;
|
||||||
|
|
||||||
run_hooks(filter => sub {
|
run_hooks(filter => sub {
|
||||||
$content=shift->(page => $page, content => $content);
|
$content=shift->(page => $page, destpage => $destpage,
|
||||||
|
content => $content);
|
||||||
});
|
});
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
|
|
@ -401,7 +401,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
htmlize($page, $type,
|
htmlize($page, $type,
|
||||||
linkify($page, "",
|
linkify($page, "",
|
||||||
preprocess($page, $page,
|
preprocess($page, $page,
|
||||||
filter($page, $form->field('editcontent')), 0, 1))));
|
filter($page, $page, $form->field('editcontent')), 0, 1))));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$form->tmpl_param("page_preview", "");
|
$form->tmpl_param("page_preview", "");
|
||||||
|
|
|
@ -56,7 +56,7 @@ sub preprocess_if (@) { #{{{
|
||||||
$ret="";
|
$ret="";
|
||||||
}
|
}
|
||||||
return IkiWiki::preprocess($params{page}, $params{destpage},
|
return IkiWiki::preprocess($params{page}, $params{destpage},
|
||||||
IkiWiki::filter($params{page}, $ret));
|
IkiWiki::filter($params{page}, $params{destpage}, $ret));
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
package IkiWiki::PageSpec;
|
package IkiWiki::PageSpec;
|
||||||
|
|
|
@ -212,7 +212,7 @@ sub preprocess_inline (@) { #{{{
|
||||||
$ret.="\n".
|
$ret.="\n".
|
||||||
linkify($page, $params{page},
|
linkify($page, $params{page},
|
||||||
preprocess($page, $params{page},
|
preprocess($page, $params{page},
|
||||||
filter($page,
|
filter($page, $params{page},
|
||||||
readfile(srcfile($file)))));
|
readfile(srcfile($file)))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ sub get_inline_content ($$) { #{{{
|
||||||
return htmlize($page, $type,
|
return htmlize($page, $type,
|
||||||
linkify($page, $destpage,
|
linkify($page, $destpage,
|
||||||
preprocess($page, $destpage,
|
preprocess($page, $destpage,
|
||||||
filter($page,
|
filter($page, $destpage,
|
||||||
readfile(srcfile($file))))));
|
readfile(srcfile($file))))));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -24,7 +24,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
|
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
|
||||||
IkiWiki::filter($params{page}, $params{text}));
|
IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
|
||||||
return "<a name=\"more\"></a>\n\n".$params{text};
|
return "<a name=\"more\"></a>\n\n".$params{text};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ sub sidebar_content ($) { #{{{
|
||||||
return IkiWiki::htmlize($page, $sidebar_type,
|
return IkiWiki::htmlize($page, $sidebar_type,
|
||||||
IkiWiki::linkify($sidebar_page, $page,
|
IkiWiki::linkify($sidebar_page, $page,
|
||||||
IkiWiki::preprocess($sidebar_page, $page,
|
IkiWiki::preprocess($sidebar_page, $page,
|
||||||
IkiWiki::filter($sidebar_page, $content))));
|
IkiWiki::filter($sidebar_page, $page, $content))));
|
||||||
}
|
}
|
||||||
|
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
|
@ -36,7 +36,7 @@ sub filter (@) { #{{{
|
||||||
|
|
||||||
build_regexp() unless defined $smiley_regexp;
|
build_regexp() unless defined $smiley_regexp;
|
||||||
$params{content} =~ s{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}{
|
$params{content} =~ s{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}{
|
||||||
$1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, linktext => $2)
|
$1 ? $2 : htmllink($params{page}, $params{destpage}, $smileys{$2}, linktext => $2)
|
||||||
}egs if length $smiley_regexp;
|
}egs if length $smiley_regexp;
|
||||||
|
|
||||||
return $params{content};
|
return $params{content};
|
||||||
|
|
|
@ -50,7 +50,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
return IkiWiki::preprocess($params{page}, $params{destpage},
|
return IkiWiki::preprocess($params{page}, $params{destpage},
|
||||||
IkiWiki::filter($params{page},
|
IkiWiki::filter($params{page}, $params{destpage},
|
||||||
$template->output));
|
$template->output));
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ sub preprocess_toggleable (@) { #{{{
|
||||||
# Preprocess the text to expand any preprocessor directives
|
# Preprocess the text to expand any preprocessor directives
|
||||||
# embedded inside it.
|
# embedded inside it.
|
||||||
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
|
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
|
||||||
IkiWiki::filter($params{page}, $params{text}));
|
IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
|
||||||
|
|
||||||
my $id=genid($params{page}, $params{id});
|
my $id=genid($params{page}, $params{id});
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ sub scan ($) { #{{{
|
||||||
|
|
||||||
# Always needs to be done, since filters might add links
|
# Always needs to be done, since filters might add links
|
||||||
# to the content.
|
# to the content.
|
||||||
$content=filter($page, $content);
|
$content=filter($page, $page, $content);
|
||||||
|
|
||||||
my @links;
|
my @links;
|
||||||
while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
|
while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
|
||||||
|
@ -186,15 +186,15 @@ sub render ($) { #{{{
|
||||||
my $type=pagetype($file);
|
my $type=pagetype($file);
|
||||||
my $srcfile=srcfile($file);
|
my $srcfile=srcfile($file);
|
||||||
if (defined $type) {
|
if (defined $type) {
|
||||||
my $content=readfile($srcfile);
|
|
||||||
my $page=pagename($file);
|
my $page=pagename($file);
|
||||||
delete $depends{$page};
|
delete $depends{$page};
|
||||||
will_render($page, htmlpage($page), 1);
|
will_render($page, htmlpage($page), 1);
|
||||||
|
|
||||||
$content=filter($page, $content);
|
my $content=htmlize($page, $type,
|
||||||
$content=preprocess($page, $page, $content);
|
linkify($page, $page,
|
||||||
$content=linkify($page, $page, $content);
|
preprocess($page, $page,
|
||||||
$content=htmlize($page, $type, $content);
|
filter($page, $page,
|
||||||
|
readfile($srcfile)))));
|
||||||
|
|
||||||
writefile(htmlpage($page), $config{destdir},
|
writefile(htmlpage($page), $config{destdir},
|
||||||
genpage($page, $content, mtime($srcfile)));
|
genpage($page, $content, mtime($srcfile)));
|
||||||
|
@ -454,7 +454,7 @@ sub commandline_render () { #{{{
|
||||||
my $content=readfile($srcfile);
|
my $content=readfile($srcfile);
|
||||||
my $page=pagename($file);
|
my $page=pagename($file);
|
||||||
$pagesources{$page}=$file;
|
$pagesources{$page}=$file;
|
||||||
$content=filter($page, $content);
|
$content=filter($page, $page, $content);
|
||||||
$content=preprocess($page, $page, $content);
|
$content=preprocess($page, $page, $content);
|
||||||
$content=linkify($page, $page, $content);
|
$content=linkify($page, $page, $content);
|
||||||
$content=htmlize($page, $type, $content);
|
$content=htmlize($page, $type, $content);
|
||||||
|
|
|
@ -36,8 +36,11 @@ ikiwiki (2.1) UNRELEASED; urgency=low
|
||||||
- If the password is empty in preferences, don't clear the existing
|
- If the password is empty in preferences, don't clear the existing
|
||||||
password.
|
password.
|
||||||
- Actually check the confirm password field, even if it's left empty.
|
- Actually check the confirm password field, even if it's left empty.
|
||||||
|
* Add a destpage parameter to the filter hook.
|
||||||
|
* Fix links to smilies generated by the smiley plugin for inlined pages. The
|
||||||
|
old links were often wrong, but often still worked by accident.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 17 May 2007 04:02:04 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 17 May 2007 15:14:42 -0400
|
||||||
|
|
||||||
ikiwiki (2.00) unstable; urgency=low
|
ikiwiki (2.00) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
RSS output contains relative links. Ie.
|
RSS output contains relative links. Ie.
|
||||||
http://kitenet.net/~joey/blog/index.rss contains a link to
|
http://kitenet.net/~joey/blog/index.rss contains a link to
|
||||||
http://kitenet.net/~joey/blog/../blog.html
|
http://kitenet.net/~joey/blog/../blog.html
|
||||||
|
|
||||||
|
> I think I've fixed the last of these, but not 100% sure. Calling it
|
||||||
|
> [[done]] for now. --[[Joey]]
|
||||||
|
|
|
@ -76,8 +76,8 @@ adding or removing files from it.
|
||||||
hook(type => "filter", id => "foo", call => \&filter);
|
hook(type => "filter", id => "foo", call => \&filter);
|
||||||
|
|
||||||
Runs on the raw source of a page, before anything else touches it, and can
|
Runs on the raw source of a page, before anything else touches it, and can
|
||||||
make arbitrary changes. The function is passed named parameters `page` and
|
make arbitrary changes. The function is passed named parameters "page",
|
||||||
`content` and should return the filtered content.
|
"destpage", and "content". It should return the filtered content.
|
||||||
|
|
||||||
### preprocess
|
### preprocess
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue