* 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.)
master
joey 2006-05-01 22:27:37 +00:00
parent 3de6aab0a4
commit 819a31ed24
13 changed files with 73 additions and 30 deletions

View File

@ -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;

View File

@ -38,7 +38,7 @@ To quote someone, prefix the quote with ">":
> To be or not to be,
> that is the question.
To write a code block, indent each line with a tab:
To write a code block, indent each line with a tab or 8 spaces:
10 PRINT "Hello, world!"
20 GOTO 10

15
debian/changelog vendored
View File

@ -1,3 +1,18 @@
ikiwiki (1.1) UNRELEASED; urgency=low
* 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.)
-- Joey Hess <joeyh@debian.org> Mon, 1 May 2006 18:21:16 -0400
ikiwiki (1.0) unstable; urgency=low
* First official release.

2
debian/postinst vendored
View File

@ -4,7 +4,7 @@ set -e
# Change this when some incompatible change is made that requires
# rebuilding all wikis.
firstcompat=0.2
firstcompat=1.1
wikilist=/etc/ikiwiki/wikilist

View File

@ -23,8 +23,6 @@
pages generated from the underlaydir as it can never work for them.
* If a page stops inlining anthing, its rss feed file
will linger around and not be deleted.
* Currently only one blog is supported per page. Attempts to add more
will make it only update one of the blogs on the page.
* RSS output contains relative links. Ie. http://kitenet.net/~joey/blog/index.rss contains a link to http://kitenet.net/~joey/blog/../blog.html
* If a file in the srcdir is removed, exposing a file in the underlaydir,
ikiwiki will not notice the change and rebuild it until the file in the

View File

@ -1,5 +1,7 @@
This is where annoucements of new releases, features, and other news is posted. [[IkiWikiUsers]] are recommended to subscribe to this page's RSS feed.
This is where annoucements of new releases, features, and other news is
posted. [[IkiWikiUsers]] are recommended to subscribe to this page's RSS
feed.
[[inline pages="news/* !*/Discussion" rootpage="news" show="30"]]
By the way, some other pages with RSS feeds about ikiwiki include [[TODO]] and [[TODO/done]].
By the way, some other pages with RSS feeds about ikiwiki include [[TODO]] and [[TODO/done]].

View File

@ -24,6 +24,8 @@ It ships with some basic templates which can be customised:
* `estseek.conf` - Not a html template, this is actually a template for
a config file for the [[HyperEstraier]] search engine. If you like you
can read the [[HyperEstraier]] docs and configure it using this.
* `blogpost.tmpl` - Used for a form to add a post to a blog (and a rss link)
* `rsslink.tmpl` - Used to add a rss link if blogpost.tmpl is not used.
If you like, you can add these to further customise it:

View File

@ -7,3 +7,9 @@ Welcome to ikiwiki's todo list. Items are moved to [[todo/done]] when done.
# Full list of open items:
[[inline pages="todo/* !todo/done* !*/Discussion" archive="yes"]]
----
Test:
[[inline pages="news/* !*/Discussion" rootpage="news" show="30"]]

View File

@ -20,7 +20,11 @@ Considering ikiwiki plugins, one idea I have is to make the [[PreProcessorDirect
Since preprocessing happens before htmlization but after a page is loaded and linkified, it should be possible to use it to create something like a link map or lists, or a page index. Page inlining and rss generation is already done via preprocessor directives and seems a natureal as a plugin too.
Note that things like a link map or a broken link list page would need to be updated whenever a set (or all) pages change; the %inlinepages hash already allows for pages to register this, although it might need to be renamed.
Note that things like a link map or a broken link list page would need to
be updated whenever a set (or all) pages change; the %depends hash
already allows for pages to register this, although there could be some
strange behavior if mixing multiple directives some of which exclude pages
that others might want to include.
I need to look at the full range of things that other wikis use their plugin systems for, but preprocessor directives as plugins certianly seems useful, even if it's not a complete solution.

10
ikiwiki
View File

@ -9,7 +9,7 @@ use HTML::Template;
use lib '.'; # For use without installation, removed by Makefile.
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
%renderedfiles %pagesources %inlinepages};
%renderedfiles %pagesources %depends};
sub usage () { #{{{
die "usage: ikiwiki [options] source dest\n";
@ -399,8 +399,8 @@ sub loadindex () { #{{{
$oldpagemtime{$page}=$items{mtime}[0];
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
$inlinepages{$page}=join(" ", @{$items{inlinepage}})
if exists $items{inlinepage};
$depends{$page}=join(" ", @{$items{depends}})
if exists $items{depends};
$renderedfiles{$page}=$items{dest}[0];
}
$pagectime{$page}=$items{ctime}[0];
@ -421,8 +421,8 @@ sub saveindex () { #{{{
"src=$pagesources{$page} ".
"dest=$renderedfiles{$page}";
$line.=" link=$_" foreach @{$links{$page}};
if (exists $inlinepages{$page}) {
$line.=" inlinepage=$_" foreach split " ", $inlinepages{$page};
if (exists $depends{$page}) {
$line.=" depends=$_" foreach split " ", $depends{$page};
}
print OUT $line."\n";
}

View File

@ -1,5 +1,8 @@
<form action="<TMPL_VAR CGIURL>" method="get">
<div id="blogform">
<TMPL_IF NAME="RSSURL">
<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
</TMPL_IF>
<input type="hidden" name="do" value="blog" />
<input type="hidden" name="from" value="<TMPL_VAR ROOTPAGE>" />
<input type="hidden" name="subpage" value="1" />

View File

@ -67,9 +67,6 @@ Links:
<!-- from <TMPL_VAR NAME=WIKINAME> -->
Last edited <TMPL_VAR NAME=MTIME>
</span>
<TMPL_IF NAME="RSSURL">
<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
</TMPL_IF>
</div>
</body>

View File

@ -0,0 +1,5 @@
<div id="rsslink">
<TMPL_IF NAME="RSSURL">
<a class="rssbutton" type="application/rss+xml" href="<TMPL_VAR NAME=RSSURL>">RSS</a>
</TMPL_IF>
</div>