+--- autoindex.pm.orig 2009-10-01 17:13:51.000000000 +0800
++++ autoindex.pm 2009-10-01 17:21:09.000000000 +0800
+@@ -17,6 +17,13 @@
+ safe => 1,
+ rebuild => 0,
+ },
++ autoindex_commit => {
++ type => 'boolean',
++ default => 1,
++ description => 'commit generated autoindex pages into RCS',
++ safe => 0,
++ rebuild => 0,
++ },
+ }
+
+ sub genindex ($) {
+@@ -25,7 +32,7 @@
+ my $template=template("autoindex.tmpl");
+ $template->param(page => $page);
+ writefile($file, $config{srcdir}, $template->output);
+- if ($config{rcs}) {
++ if ($config{rcs} and $config{autoindex_commit}) {
+ IkiWiki::rcs_add($file);
+ }
+ }
+@@ -94,13 +101,13 @@
+ }
+
+ if (@needed) {
+- if ($config{rcs}) {
++ if ($config{rcs} and $config{autoindex_commit}) {
+ IkiWiki::disable_commit_hook();
+ }
+ foreach my $page (@needed) {
+ genindex($page);
+ }
+- if ($config{rcs}) {
++ if ($config{rcs} and $config{autoindex_commit}) {
+ IkiWiki::rcs_commit_staged(
+ gettext("automatic index generation"),
+ undef, undef);
+
+
+
+Warning: I guess this patch may work, but I *haven't tested it yet*. -- [[weakish]]
--
cgit v1.2.3
From f62de29638ec3d8d1d2e27601b0096cf865c48cc Mon Sep 17 00:00:00 2001
From: martin
Date: Thu, 1 Oct 2009 08:12:49 -0400
Subject: documentation seems inaccurate
---
doc/plugins/sidebar/discussion.mdwn | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 doc/plugins/sidebar/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/sidebar/discussion.mdwn b/doc/plugins/sidebar/discussion.mdwn
new file mode 100644
index 000000000..78af3525c
--- /dev/null
+++ b/doc/plugins/sidebar/discussion.mdwn
@@ -0,0 +1,3 @@
+> Warning: Any change to the sidebar will cause a rebuild of the whole wiki, since every page includes a copy that has to be updated. This can especially be a problem if the sidebar includes inline or map directives, since any changes to pages inlined or mapped onto the sidebar will change the sidebar and cause a full wiki rebuild.
+
+I tried exactly that, namely having an inline in my sidebar to include an rss feed from some other side. I think the complete wiki rebuild should be doable every few days when a new article appears in that feed. But contrary to that warning there is no complete wiki rebuild, only the sidebar page is rebuilt by the "ikiwiki --aggregate" from cron. Is that a bug or a feature?
--
cgit v1.2.3
From 4f9c5896b242ac08be181047ad426bd458a0bf49 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 2 Oct 2009 15:15:23 -0400
Subject: add bug about transitive dependencies
---
doc/bugs/transitive_dependencies.mdwn | 47 +++++++++++++++++++++++++++
doc/plugins/sidebar/discussion.mdwn | 2 ++
doc/todo/tracking_bugs_with_dependencies.mdwn | 5 +--
3 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 doc/bugs/transitive_dependencies.mdwn
(limited to 'doc/plugins')
diff --git a/doc/bugs/transitive_dependencies.mdwn b/doc/bugs/transitive_dependencies.mdwn
new file mode 100644
index 000000000..c61afe81e
--- /dev/null
+++ b/doc/bugs/transitive_dependencies.mdwn
@@ -0,0 +1,47 @@
+If a sidebar contains a map, or inline (etc), one would expect a
+change/add/remove of any of the mapped/inlined pages to cause a full wiki
+rebuild. But this does not happen.
+
+If page A inlines page B, which inlines page C, a change to C will cause B
+to be updated, but A will not "notice" that this means A needs to be
+updated.
+
+One way to look at this bug is that it's a bug in where dependencies are
+recorded when preprocessing the rendered or sidebar page. The current code
+does:
+
+ add_depends($params{page}, $somepage);
+
+Where `$params{page}` is page B. If this is changed to `$params{destpage}`,
+then the dependency is added to page A, and updates to C cause it to
+change. This does result in the page A's getting lots more dependency info
+recorded than before (essentially a copy of all the B's dependency info).
+
+It's also a fragile, since all plugins that handle dependencies have to be
+changed, and do this going forward. And it seems non-obvious that this should
+be done. Or really, whether to use `page` or `destpage` there. Currently,
+making the "wrong" choice and using `destpage` instead of `page` (which nearly
+everything uses) will just result in semi-redundant dependency info being
+recorded. If we make destpage mandatory to fix this, goofing up will lead to
+this bug coming back. Ugh.
+
+Another approach to fix it could be to say that anything that causes a
+rebuild of B is treated as a change of B. Then when C is changed, B is
+rebuilt due to dependencies, and in turn this means A is rebuild because B
+"changed".
+
+This is essentially what is done with wikilinks now, and why, if a sidebar
+links to page C, add/remove of C causes all pages to be rebuilt, as seen
+here:
+
+ removing old page meep
+ building sidebar.mdwn, which links to meep
+ building TourBusStop.mdwn, which depends on sidebar
+ building contact.mdwn, which depends on sidebar
+ ...
+
+The only downside I can see with this approach is that it involves more work.
+Does the dep resolver have to keep looping until no new pages are rebuilt?
+Seems worth a try to implement this approach.
+
+--[[Joey]]
diff --git a/doc/plugins/sidebar/discussion.mdwn b/doc/plugins/sidebar/discussion.mdwn
index 78af3525c..eb441529c 100644
--- a/doc/plugins/sidebar/discussion.mdwn
+++ b/doc/plugins/sidebar/discussion.mdwn
@@ -1,3 +1,5 @@
> Warning: Any change to the sidebar will cause a rebuild of the whole wiki, since every page includes a copy that has to be updated. This can especially be a problem if the sidebar includes inline or map directives, since any changes to pages inlined or mapped onto the sidebar will change the sidebar and cause a full wiki rebuild.
I tried exactly that, namely having an inline in my sidebar to include an rss feed from some other side. I think the complete wiki rebuild should be doable every few days when a new article appears in that feed. But contrary to that warning there is no complete wiki rebuild, only the sidebar page is rebuilt by the "ikiwiki --aggregate" from cron. Is that a bug or a feature?
+
+> It's a bug, discussed in [[bugs/transitive_dependencies]]. --[[Joey]]
diff --git a/doc/todo/tracking_bugs_with_dependencies.mdwn b/doc/todo/tracking_bugs_with_dependencies.mdwn
index bfdbf0875..3894df5f6 100644
--- a/doc/todo/tracking_bugs_with_dependencies.mdwn
+++ b/doc/todo/tracking_bugs_with_dependencies.mdwn
@@ -472,10 +472,7 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W
>>>>> possibly by adding a dependency of the second type along with the dependency of the first type.
>>>>>> An example of the current system not tracking enough data is
->>>>>> where A inlines B which inlines C. A change to C will cause B to
->>>>>> rebuild, but A will not "notice" that B has implicitly changed.
->>>>>> That example suggests it might be fixable without explicitly storing
->>>>>> data, by causing a rebuild of B to be treated as a change to B.
+>>>>>> described in [[bugs/transitive_dependencies]].
>>>>>> --[[Joey]]
>>>>> The second type of dependency is a little more tricky. For each page, we'd need a list of pagespecs that
--
cgit v1.2.3
From 6e133959bc69877459fec2ea32788d0656b92168 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 2 Oct 2009 18:47:15 -0400
Subject: fix wording here too
---
doc/plugins/pagetemplate.mdwn | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/pagetemplate.mdwn b/doc/plugins/pagetemplate.mdwn
index afd5eb500..53f069d0d 100644
--- a/doc/plugins/pagetemplate.mdwn
+++ b/doc/plugins/pagetemplate.mdwn
@@ -2,8 +2,8 @@
[[!tag type/chrome]]
This plugin provides the [[ikiwiki/directive/pagetemplate]]
-[[ikiwiki/directive]], which allows a page to be created using a different
-[[template|wikitemplates]].
+[[ikiwiki/directive]], which allows a page to be displayed
+using a different [[template|wikitemplates]] than the default.
This plugin can only use templates that are already installed in
`/usr/share/ikiwiki/templates` (or wherever ikiwiki is configured to look for
--
cgit v1.2.3
From fd9d9680242c0d1c835fc56f969f8e2a2618a5de Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sat, 3 Oct 2009 15:37:57 -0400
Subject: document add_depends dependency type interface
---
doc/plugins/write.mdwn | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 668f8d8b6..c244c1f2f 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -609,10 +609,17 @@ page created from it. (Ie, it appends ".html".)
Use this when constructing the filename of a html file. Use `urlto` when
generating a link to a page.
-#### `add_depends($$)`
+#### `add_depends($$;@)`
Makes the specified page depend on the specified [[ikiwiki/PageSpec]].
+Additional named parameters can be passed, to indicate what type of
+dependency this is.
+
+Currently, only a "content" parameter is specified. If set to 0, the
+dependency does not involve the content of pages matching the PageSpec, but
+only their existence.
+
#### `pagespec_match($$;@)`
Passed a page name, and [[ikiwiki/PageSpec]], returns true if the
--
cgit v1.2.3
From a8af271e5aed1c4aef3f66cee0847d609aedc705 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 4 Oct 2009 16:28:14 -0400
Subject: document effect of contentless dependencies on sidebar efficiency
---
doc/plugins/sidebar.mdwn | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/sidebar.mdwn b/doc/plugins/sidebar.mdwn
index 36982eff3..4e356d65a 100644
--- a/doc/plugins/sidebar.mdwn
+++ b/doc/plugins/sidebar.mdwn
@@ -16,6 +16,10 @@ will turn off the sidebar altogether.
Warning: Any change to the sidebar will cause a rebuild of the whole wiki,
since every page includes a copy that has to be updated. This can
-especially be a problem if the sidebar includes [[inline]] or [[map]]
-directives, since any changes to pages inlined or mapped onto the sidebar
+especially be a problem if the sidebar includes an [[ikiwiki/directive/inline]]
+directive, since any changes to pages inlined into the sidebar
will change the sidebar and cause a full wiki rebuild.
+
+Instead, if you include a [[ikiwiki/directive/map]] directive on the sidebar,
+and it does not use the `show` parameter, only adding or removing pages
+included in the map will cause a full rebuild. Modifying pages will not.
--
cgit v1.2.3
From be032a7b87d1080f1a54327346cb5b40432a056c Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 4 Oct 2009 20:30:21 -0400
Subject: rework dependency types code
Simplify, change default content depends number to 1,
change interface to make more sense.
---
IkiWiki.pm | 35 +++++++++++++++--------------------
IkiWiki/Plugin/calendar.pm | 18 +++++++++---------
IkiWiki/Plugin/edittemplate.pm | 2 +-
IkiWiki/Plugin/listdirectives.pm | 2 +-
IkiWiki/Plugin/meta.pm | 2 +-
IkiWiki/Plugin/pagecount.pm | 4 ++--
IkiWiki/Plugin/postsparkline.pm | 2 +-
IkiWiki/Plugin/progress.pm | 4 ++--
IkiWiki/Render.pm | 28 +++++++++++++---------------
doc/plugins/write.mdwn | 15 +++++++++------
ikiwiki-transition | 2 +-
11 files changed, 55 insertions(+), 59 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 5e5dc739d..c1d07531e 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -29,8 +29,8 @@ our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
our $installdir='/usr'; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
# Page dependency types.
-our $DEPEND_EXISTS=1;
-our $DEPEND_CONTENT=2;
+our $DEPEND_CONTENT=1;
+our $DEPEND_PRESENCE=2;
# Optimisation.
use Memoize;
@@ -1540,13 +1540,13 @@ sub loadindex () {
if (exists $d->{dependslist}) {
# old format
$depends{$page}={
- map { $_ => $DEPEND_CONTENT | $DEPEND_EXISTS }
+ map { $_ => $DEPEND_CONTENT }
@{$d->{dependslist}}
};
}
elsif (exists $d->{depends} && ! ref $d->{depends}) {
# old format
- $depends{$page}={$d->{depends} => $DEPEND_CONTENT | $DEPEND_EXISTS};
+ $depends{$page}={$d->{depends} => $DEPEND_CONTENT };
}
elsif (exists $d->{depends}) {
$depends{$page}=$d->{depends};
@@ -1771,16 +1771,23 @@ sub add_depends ($$;@) {
my $page=shift;
my $pagespec=shift;
+ # Is the pagespec a simple page name?
my $simple=$pagespec =~ /$config{wiki_file_regexp}/ &&
$pagespec !~ /[\s*?()!]/;
- my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS;
+ my $deptype=$DEPEND_CONTENT;
if (@_) {
my %params=@_;
- if (defined $params{content} && $params{content} == 0 &&
- ($simple || pagespec_contentless($pagespec))) {
- $deptype=$deptype & ~$DEPEND_CONTENT;
+
+ # Is the pagespec limited to terms that will continue
+ # to match pages as long as those pages exist?
+ my $limited=1;
+ while ($limited && $pagespec=~m/(\w+)\([^\)]*\)/g) {
+ $limited = $1 =~ /^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after)$/;
}
+
+ $deptype=$deptype & ~$DEPEND_CONTENT & $DEPEND_PRESENCE
+ if $params{presence} && $limited;
}
if ($simple) {
@@ -1976,18 +1983,6 @@ sub pagespec_valid ($) {
return ! $@;
}
-sub pagespec_contentless ($) {
- my $spec=shift;
-
- while ($spec=~m{
- (\w+)\([^\)]*\) # only match pagespec functions
- }igx) {
- return 0 unless $1=~/^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after)$/;
- }
-
- return 1;
-}
-
sub glob2re ($) {
my $re=quotemeta(shift);
$re=~s/\\\*/.*/g;
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index a5cc20882..a1117992a 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -105,21 +105,21 @@ sub format_month (@) {
linktext => " $monthname ");
}
add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month),
- content => 0);
+ presence => 1);
if (exists $cache{$pagespec}{"$pyear/$pmonth"}) {
$purl = htmllink($params{page}, $params{destpage},
"$archivebase/$pyear/" . sprintf("%02d", $pmonth),
linktext => " $pmonthname ");
}
add_depends($params{page}, "$archivebase/$pyear/".sprintf("%02d", $pmonth),
- content => 0);
+ presence => 1);
if (exists $cache{$pagespec}{"$nyear/$nmonth"}) {
$nurl = htmllink($params{page}, $params{destpage},
"$archivebase/$nyear/" . sprintf("%02d", $nmonth),
linktext => " $nmonthname ");
}
add_depends($params{page}, "$archivebase/$nyear/".sprintf("%02d", $nmonth),
- content => 0);
+ presence => 1);
# Start producing the month calendar
$calendar=< 0);
+ add_depends($params{page}, $params{pages}, presence => 1);
# Explicitly add all currently linked pages as dependencies, so
# that if they are removed, the calendar will be sure to be updated.
foreach my $p (@list) {
- add_depends($params{page}, $p, content => 0);
+ add_depends($params{page}, $p, presence => 1);
}
return $calendar;
@@ -249,19 +249,19 @@ sub format_year (@) {
"$archivebase/$year",
linktext => "$year");
}
- add_depends($params{page}, "$archivebase/$year", content => 0);
+ add_depends($params{page}, "$archivebase/$year", presence => 1);
if (exists $cache{$pagespec}{"$pyear"}) {
$purl = htmllink($params{page}, $params{destpage},
"$archivebase/$pyear",
linktext => "\←");
}
- add_depends($params{page}, "$archivebase/$pyear", content => 0);
+ add_depends($params{page}, "$archivebase/$pyear", presence => 1);
if (exists $cache{$pagespec}{"$nyear"}) {
$nurl = htmllink($params{page}, $params{destpage},
"$archivebase/$nyear",
linktext => "\→");
}
- add_depends($params{page}, "$archivebase/$nyear", content => 0);
+ add_depends($params{page}, "$archivebase/$nyear", presence => 1);
# Start producing the year calendar
$calendar=<$monthabbr\n};
}
- add_depends($params{page}, "$archivebase/$year/$mtag", content => 0);
+ add_depends($params{page}, "$archivebase/$year/$mtag", presence => 1);
$calendar.=qq{\t\n} if ($month % $params{months_per_row} == 0);
}
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm
index 89d450725..2dd1dbe68 100644
--- a/IkiWiki/Plugin/edittemplate.pm
+++ b/IkiWiki/Plugin/edittemplate.pm
@@ -58,7 +58,7 @@ sub preprocess (@) {
$pagestate{$params{page}}{edittemplate}{$params{match}}=$link;
return "" if ($params{silent} && IkiWiki::yesno($params{silent}));
- add_depends($params{page}, $link, content => 0);
+ add_depends($params{page}, $link, presence => 1);
return sprintf(gettext("edittemplate %s registered for %s"),
htmllink($params{page}, $params{destpage}, $link),
$params{match});
diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm
index 96150f986..4023ed7d7 100644
--- a/IkiWiki/Plugin/listdirectives.pm
+++ b/IkiWiki/Plugin/listdirectives.pm
@@ -84,7 +84,7 @@ sub preprocess (@) {
foreach my $plugin (@pluginlist) {
$result .= '
';
}
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index eef3013a0..9b041a748 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -195,7 +195,7 @@ sub preprocess (@) {
if (! length $link) {
error gettext("redir page not found")
}
- add_depends($page, $link, content => 0);
+ add_depends($page, $link, presence => 1);
$value=urlto($link, $page);
$value.='#'.$redir_anchor if defined $redir_anchor;
diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm
index 17eda0618..80561350b 100644
--- a/IkiWiki/Plugin/pagecount.pm
+++ b/IkiWiki/Plugin/pagecount.pm
@@ -23,8 +23,8 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
# Needs to update count whenever a page is added or removed, so
- # register a contentless dependency.
- add_depends($params{page}, $params{pages}, content => 0);
+ # register a presence dependency.
+ add_depends($params{page}, $params{pages}, presence => 1);
my @pages;
if ($params{pages} eq "*") {
diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm
index 694d39575..3205958d4 100644
--- a/IkiWiki/Plugin/postsparkline.pm
+++ b/IkiWiki/Plugin/postsparkline.pm
@@ -48,7 +48,7 @@ sub preprocess (@) {
error gettext("unknown formula");
}
- add_depends($params{page}, $params{pages}, content => 0);
+ add_depends($params{page}, $params{pages}, presence => 1);
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
pagespec_match_list(
diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm
index 3b664f4cb..26c537a84 100644
--- a/IkiWiki/Plugin/progress.pm
+++ b/IkiWiki/Plugin/progress.pm
@@ -36,8 +36,8 @@ sub preprocess (@) {
$fill.="%";
}
elsif (defined $params{totalpages} and defined $params{donepages}) {
- add_depends($params{page}, $params{totalpages}, content => 0);
- add_depends($params{page}, $params{donepages}, content => 0);
+ add_depends($params{page}, $params{totalpages}, presence => 1);
+ add_depends($params{page}, $params{donepages}, presence => 1);
my @pages=keys %pagesources;
my $totalcount=0;
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 3fc750925..cf0c3fe08 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -473,13 +473,11 @@ sub refresh () {
if (exists $depends_simple{$p}) {
foreach my $d (keys %{$depends_simple{$p}}) {
- if ($depends_simple{$p}{$d} == $IkiWiki::DEPEND_EXISTS) {
- if (exists $lc_exists_changed{$d}) {
- $reason = $d;
- last;
- }
- }
- elsif (exists $lc_changed{$d}) {
+ if (($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT &&
+ exists $lc_changed{$d})
+ ||
+ ($depends_simple{$p}{$d} & $IkiWiki::DEPEND_PRESENCE &&
+ exists $lc_exists_changed{$d})) {
$reason = $d;
last;
}
@@ -492,22 +490,22 @@ sub refresh () {
next if $@ || ! defined $sub;
my @candidates;
- if ($depends{$p}{$d} == $IkiWiki::DEPEND_EXISTS) {
- @candidates=@exists_changed;
- }
- else {
+ if ($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT) {
@candidates=@changed;
}
+ elsif ($depends{$p}{$d} & $IkiWiki::DEPEND_PRESENCE) {
+ @candidates=@exists_changed;
+ }
# only consider internal files
# if the page explicitly depends
# on such files
if ($d =~ /internal\(/) {
- if ($depends{$p}{$d} == $IkiWiki::DEPEND_EXISTS) {
- push @candidates, @internal;
- }
- else {
+ if ($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT) {
push @candidates, @internal, @internal_change;
}
+ elsif ($depends{$p}{$d} & $IkiWiki::DEPEND_PRESENCE) {
+ push @candidates, @internal;
+ }
}
foreach my $file (@candidates) {
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index c244c1f2f..73db6f12a 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -613,12 +613,15 @@ generating a link to a page.
Makes the specified page depend on the specified [[ikiwiki/PageSpec]].
-Additional named parameters can be passed, to indicate what type of
-dependency this is.
-
-Currently, only a "content" parameter is specified. If set to 0, the
-dependency does not involve the content of pages matching the PageSpec, but
-only their existence.
+By default, dependencies are full content dependencies, meaning that the
+page will be updated whenever anything matching the PageSpec is modified.
+This default can be overridden by additional named parameters, which can be
+used to indicate weaker types of dependencies:
+
+* `presence` if set to true, only the presence of a matching page triggers
+ the dependency.
+* `links` if set to true, any change in the text of links on a matching page
+ triggers the dependency
#### `pagespec_match($$;@)`
diff --git a/ikiwiki-transition b/ikiwiki-transition
index c50a748e8..1bebb1176 100755
--- a/ikiwiki-transition
+++ b/ikiwiki-transition
@@ -299,7 +299,7 @@ sub oldloadindex {
$pagemtime{$page}=$items{mtime}[0];
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
- $depends{$page}={ $items{depends}[0] => $IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_EXISTS } if exists $items{depends};
+ $depends{$page}={ $items{depends}[0] => $IkiWiki::DEPEND_CONTENT } if exists $items{depends};
$destsources{$_}=$page foreach @{$items{dest}};
$renderedfiles{$page}=[@{$items{dest}}];
$pagecase{lc $page}=$page;
--
cgit v1.2.3
From c6bf4228d5c988e715ff08a9374b72ce054daa2c Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 5 Oct 2009 15:01:05 -0400
Subject: make links dependencies fire if broken links change
---
IkiWiki/Render.pm | 41 ++++++++++++++++++++++++++++-------------
doc/plugins/write.mdwn | 6 ++++--
2 files changed, 32 insertions(+), 15 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 4e8aae3bc..599bb26e2 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -63,24 +63,39 @@ sub find_changed_links (@_) {
my %linkchangers;
foreach my $file (@_) {
my $page=pagename($file);
-
+
if (exists $links{$page}) {
- foreach my $link (map { bestlink($page, $_) } @{$links{$page}}) {
- if (length $link &&
- (! exists $oldlinks{$page} ||
- ! grep { bestlink($page, $_) eq $link } @{$oldlinks{$page}})) {
- $linkchanged{$link}=1;
- $linkchangers{lc($page)}=1;
+ foreach my $l (@{$links{$page}}) {
+ my $link=bestlink($page, $l);
+ if (length $link) {
+ if (! exists $oldlinks{$page} ||
+ ! grep { bestlink($page, $_) eq $link } @{$oldlinks{$page}}) {
+ $linkchanged{$link}=1;
+ $linkchangers{lc($page)}=1;
+ }
+ }
+ else {
+ if (! grep { lc $_ eq lc $l } @{$oldlinks{$page}}) {
+ $linkchangers{lc($page)}=1
+ }
}
+
}
}
if (exists $oldlinks{$page}) {
- foreach my $link (map { bestlink($page, $_) } @{$oldlinks{$page}}) {
- if (length $link &&
- (! exists $links{$page} ||
- ! grep { bestlink($page, $_) eq $link } @{$links{$page}})) {
- $linkchanged{$link}=1;
- $linkchangers{lc($page)}=1;
+ foreach my $l (@{$oldlinks{$page}}) {
+ my $link=bestlink($page, $l);
+ if (length $link) {
+ if (! exists $links{$page} ||
+ ! grep { bestlink($page, $_) eq $link } @{$links{$page}}) {
+ $linkchanged{$link}=1;
+ $linkchangers{lc($page)}=1;
+ }
+ }
+ else {
+ if (! grep { lc $_ eq lc $l } @{$links{$page}}) {
+ $linkchangers{lc($page)}=1
+ }
}
}
}
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 73db6f12a..133030f08 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -620,8 +620,10 @@ used to indicate weaker types of dependencies:
* `presence` if set to true, only the presence of a matching page triggers
the dependency.
-* `links` if set to true, any change in the text of links on a matching page
- triggers the dependency
+* `links` if set to true, any change to links on a matching page
+ triggers the dependency. This includes when a link is added, removed,
+ or changes what it points to due to other changes. It does not include
+ the addition or removal of a duplicate link.
#### `pagespec_match($$;@)`
--
cgit v1.2.3
From fc864515b857694da6752879edeb2f82fd12e3a4 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 5 Oct 2009 15:16:14 -0400
Subject: omit forum and javascript from list
---
doc/plugins/orphans.mdwn | 1 +
1 file changed, 1 insertion(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/orphans.mdwn b/doc/plugins/orphans.mdwn
index ea7c4df13..8c0d0b933 100644
--- a/doc/plugins/orphans.mdwn
+++ b/doc/plugins/orphans.mdwn
@@ -10,5 +10,6 @@ Here's a list of orphaned pages on this wiki:
[[!orphans pages="* and !news/* and !todo/* and !bugs/* and !users/* and
!recentchanges and !examples/* and !tips/* and !sandbox/* and !templates/* and
+!forum/* and !*.js
!wikiicons/* and !plugins/*"]]
"""]]
--
cgit v1.2.3
From dc6fab3824c9848cdaf8b252253d690f96573d25 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 5 Oct 2009 15:17:36 -0400
Subject: syntax
---
doc/plugins/orphans.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/orphans.mdwn b/doc/plugins/orphans.mdwn
index 8c0d0b933..e403c2d18 100644
--- a/doc/plugins/orphans.mdwn
+++ b/doc/plugins/orphans.mdwn
@@ -10,6 +10,6 @@ Here's a list of orphaned pages on this wiki:
[[!orphans pages="* and !news/* and !todo/* and !bugs/* and !users/* and
!recentchanges and !examples/* and !tips/* and !sandbox/* and !templates/* and
-!forum/* and !*.js
+!forum/* and !*.js and
!wikiicons/* and !plugins/*"]]
"""]]
--
cgit v1.2.3
From f7d04d106721a6bff6dfd4a0a7aa162cd2ce5536 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 5 Oct 2009 15:26:15 -0400
Subject: switch plugins page to use a map instead of an inline
A map just seems a better fit for reference, since it deliniates the
contrib plugins better, and orders better.
It also has the advantage of being less expensive, since the plugins page
does not need to update when eg, the pagecount page changes.
Only downside is, no rss feed of new plugins. Which I know a few people
were subscribed to.
---
doc/plugins.mdwn | 6 ++----
doc/plugins/contrib.mdwn | 4 +---
2 files changed, 3 insertions(+), 7 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins.mdwn b/doc/plugins.mdwn
index 527568208..bd7ee538b 100644
--- a/doc/plugins.mdwn
+++ b/doc/plugins.mdwn
@@ -13,7 +13,5 @@ will fit most uses of ikiwiki.
## Plugin directory
-[[!inline pages="plugins/* and !plugins/type/* and !plugins/write and
-!plugins/write/* and !plugins/contrib and !plugins/install and !*/Discussion"
-feedpages="created_after(plugins/graphviz)" archive="yes" sort=title
-rootpage="plugins/contrib" postformtext="Add a new plugin named:" show=0]]
+[[!map pages="plugins/* and !plugins/type/* and !plugins/write and
+!plugins/write/* and !plugins/contrib and !plugins/install and !*/Discussion"]]
diff --git a/doc/plugins/contrib.mdwn b/doc/plugins/contrib.mdwn
index a03e6a95d..ac6c1b751 100644
--- a/doc/plugins/contrib.mdwn
+++ b/doc/plugins/contrib.mdwn
@@ -1,6 +1,4 @@
These plugins are provided by third parties and are not currently
included in ikiwiki. See [[install]] for installation help.
-[[!inline pages="plugins/contrib/* and !*/Discussion"
-feedpages="created_after(plugins/contrib/navbar)" archive="yes"
-rootpage="plugins/contrib" postformtext="Add a new plugin named:" show=0]]
+[[!map pages="plugins/contrib/* and !*/Discussion"]]
--
cgit v1.2.3
From 3a188c047b4fed29865e7516f3b208901b22161d Mon Sep 17 00:00:00 2001
From: "http://smcv.pseudorandom.co.uk/"
Date: Mon, 5 Oct 2009 16:08:19 -0400
Subject: thoughts about renaming the actual images to .albumimage
---
doc/plugins/contrib/album/discussion.mdwn | 127 ++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/album/discussion.mdwn b/doc/plugins/contrib/album/discussion.mdwn
index 5fb91c5a4..a613bb2d2 100644
--- a/doc/plugins/contrib/album/discussion.mdwn
+++ b/doc/plugins/contrib/album/discussion.mdwn
@@ -61,21 +61,59 @@ code or tried it yet, but here goes. --[[Joey]]
seems like it will become a pain. Everyone will need to come up
with their own automation for it, and then there's the question
of how to automate it when uploading attachments.
+
+> There's already a script (ikiwiki-album) to populate a git
+> checkout with skeleton "viewer" pages; I was planning to make a
+> specialized CGI interface for albums after getting feedback from
+> you (since the requirements for that CGI interface change depending
+> on the implementation). I agree that this is ugly, though. -s
+
* With each viewer page having next/prev links, I can see how you
were having the scalability issues with ikiwiki's data structures
earlier!
+
+> Yeah, I think they're a basic requirement from a UI point of view
+> though (although they don't necessarily have to be full wikilinks).
+> -s
+
* And doesn't each viewer page really depend on every other page in the
same albumsection? If a new page is added, the next/prev links
may need to be updated, for example. If so, there will be much
unnecessary rebuilding.
+
+> albumsections are just a way to insert headings into the flow of
+> photos, so they don't actually affect dependencies.
+>
+> One non-obvious constraint of ikiwiki's current design is that
+> everything "off-page" necessary to build any page has to happen
+> at scan time, which has caused a few strange design decisions,
+> like the fact that each viewer controls what album it's in.
+>
+> It's difficult for the contents of the album to just be a
+> pagespec, like for inline, because pagespecs can depend on
+> metadata, which is gathered in arbitrary order at scan time;
+> so the earliest you can safely apply a pagespec to the wiki
+> contents to get a concrete list of pages is at rebuild time.
+>
+> (This stalled my attempt at a trail plugin, too.) -s
+
* One thing I do like about having individual pages per image is
that they can each have their own comments, etc.
+
+> Yes; also, they can be wikilinked. I consider those to be
+> UI requirements. -s
+
* Seems possibly backwards that the albumimage controls what album
an image appears in. Two use cases -- 1: I may want to make a locked
album, but then anyone who can write to any other page on the wiki can
add an image to it. 2: I may want an image to appear in more than one
album. Think tags. So it seems it would be better to have the album
directive control what pages it includes (a la inline).
+
+> See note above about pagespecs not being very safe early on.
+> You did merge my inline-with-pagenames feature, which is safe to use
+> at scan time, though.
+
* Putting a few of the above thoughts together, my ideal album system
seems to be one where I can just drop the images into a directory and
have them appear in the album index, as well as each generate their own wiki
@@ -84,3 +122,92 @@ code or tried it yet, but here goes. --[[Joey]]
themselves.) This is almost pointing toward making the images first-class
wiki page sources. Hey, it worked for po! :) But the metadata and editing
problems probably don't really allow that.
+
+> Putting a JPEG in the web form is not an option from my point of
+> view :-) but perhaps there could just be a "web-editable" flag supplied
+> by plugins, and things could be changed to respect it.
+>
+> In a way, what you really want for metadata is to have it in the album
+> page, so you can batch-edit the whole lot by editing one file (this
+> does mean that editing the album necessarily causes each of its viewers
+> to be rebuilt, but in practice that happens anyway). -s
+
+----
+
+Trying to use the "special extension" design:
+
+Suppose that each viewer is a JPEG-or-GIF-or-something, with extension
+".albumimage". We have a gallery "memes" with three images, badger,
+mushroom and snake.
+
+Files in git repo:
+
+* index.mdwn
+* memes.mdwn
+* memes/badger.albumimage (a renamed JPEG)
+* memes/badger/comment_1._comment
+* memes/badger/comment_2._comment
+* memes/mushroom.albumimage (a renamed GIF)
+* memes/mushroom.meta (sidecar file with metadata)
+* memes/snake.albumimage (a renamed video)
+
+Files in web content:
+
+* index.html
+* memes/index.html
+* memes/96x96-badger.jpg (from img)
+* memes/96x96-mushroom.jpg (from img)
+* memes/96x96-snake.jpg (from img, hacked up to use totem-video-thumbnailer :-) )
+* memes/badger/index.html (including comments)
+* memes/badger.jpg
+* memes/mushroom/index.html
+* memes/mushroom.gif
+* memes/snake/index.html
+* memes/snake.mov
+
+ispage("memes/badger") (etc.) must be true, to make the above rendering
+happen, so albumimage needs to be a "page" extension.
+
+To not confuse other plugins, album should probably have a filter() hook
+that turns .albumimage files into HTML? That'd probably be a reasonable
+way to get them rendered anyway.
+
+do=edit&page=memes/badger needs to not put the JPG in a text box: somehow
+divert or override the normal edit CGI by telling it that .albumimage
+files are not editable in the usual way?
+
+Every image needs to depend on, and link to, the next and previous images,
+which is a bit tricky. In previous thinking about this I'd been applying
+the overly strict constraint that the ordered sequence of pages in each
+album must be known at scan time. However, that's not *necessarily* needed:
+the album and each photo could collect an unordered superset of dependencies
+at scan time, and at rebuild time that could be refined to be the exact set,
+in order. Perhaps restricting to "the images in an album A must match A/*"
+would be useful; then the unordered superset could just be "A/*". Your
+"albums via tags" idea would be nice too though, particularly for feature
+parity with e.g. Facebook: "photos of Joey" -> "tags/joey and albumimage()"
+maybe?
+
+If images are allowed to be considered to be part of more than one album,
+then a pretty and usable UI becomes harder - "next/previous" expands into
+"next photo in holidays/2009/germany / next photo in tagged/smcv / ..."
+and it could get quite hard to navigate. Perhaps next/previous links could
+be displayed only for the closest ancestor (in URL space) that is an
+album, or something?
+
+Requiring renaming is awkward for non-technical Windows/Mac users, with both
+platforms' defaults being to hide extensions; however, this could be
+circumvented by adding some sort of hook in attachment to turn things into
+a .albumimage at upload time, and declaring that using git/svn/... without
+extensions visible is a "don't do that then" situation :-)
+
+Ideally attachment could also be configured to upload into a specified
+underlay, so that photos don't have to be in your source-code control
+(you might want that, but I don't!).
+
+Things that would be nice, and are probably possible:
+
+* make the "Edit page" link on viewers divert to album-specific CGI instead
+ of just failing or not appearing
+* some way to deep-link to memes/badger.jpg with a wikilink, without knowing a
+ priori that it's secretly a JPEG
--
cgit v1.2.3
From 786dcf15c4117f9ae6b000318ac9809399df4d69 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 5 Oct 2009 16:47:12 -0400
Subject: responses, questions, ideas
---
doc/plugins/contrib/album/discussion.mdwn | 45 ++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/album/discussion.mdwn b/doc/plugins/contrib/album/discussion.mdwn
index a613bb2d2..5c8e74fa6 100644
--- a/doc/plugins/contrib/album/discussion.mdwn
+++ b/doc/plugins/contrib/album/discussion.mdwn
@@ -76,6 +76,12 @@ code or tried it yet, but here goes. --[[Joey]]
> though (although they don't necessarily have to be full wikilinks).
> -s
+>> I think that with the new dependency types system, the dependencies for
+>> these can be presence dependencies, which will probably help with
+>> avoiding rebuilds of a page if the next/prev page is changed.
+>> (Unless you use img to make the thumbnails for those links, then it
+>> would rebuild the thumbnails anyway. Have not looked at the code.) --[[Joey]]
+
* And doesn't each viewer page really depend on every other page in the
same albumsection? If a new page is added, the next/prev links
may need to be updated, for example. If so, there will be much
@@ -97,6 +103,11 @@ code or tried it yet, but here goes. --[[Joey]]
>
> (This stalled my attempt at a trail plugin, too.) -s
+>> Not sure I understand why these need to look at pagespecs at scan time?
+>> Also, note that it is fairly doable to detect if a pagespec uses such
+>> metadata. Er, I mean, I have a cheezy hack in `add_depends` now that does
+>> it to deal with a similar case. --[[Joey]]
+
* One thing I do like about having individual pages per image is
that they can each have their own comments, etc.
@@ -131,6 +142,15 @@ code or tried it yet, but here goes. --[[Joey]]
> page, so you can batch-edit the whole lot by editing one file (this
> does mean that editing the album necessarily causes each of its viewers
> to be rebuilt, but in practice that happens anyway). -s
+>
+>> Yes, that would make some sense.. It also allows putting one image in
+>> two albums, with different caption etc. (Maybe for different audiences.)
+>>
+>> It would probably be possible to add a new dependency type, and thus
+>> make ikiwiki smart about noticing whether the metadata has actually
+>> changed, and only update those viewers where it has. But the dependency
+>> type stuff is still very new, and not plugin friendly .. so only just
+>> possible, --[[Joey]]
----
@@ -140,6 +160,10 @@ Suppose that each viewer is a JPEG-or-GIF-or-something, with extension
".albumimage". We have a gallery "memes" with three images, badger,
mushroom and snake.
+> An alternative might be to use ".album.jpg", and ".album.gif"
+> etc as the htmlize extensions. May need some fixes to ikiwiki to support
+> that. --[[Joey]]
+
Files in git repo:
* index.mdwn
@@ -172,6 +196,10 @@ To not confuse other plugins, album should probably have a filter() hook
that turns .albumimage files into HTML? That'd probably be a reasonable
way to get them rendered anyway.
+> I guess that is needed to avoid preprocess, scan, etc trying to process
+> the image, as well as eg, smiley trying to munge it in sanitize.
+> --[[Joey]]
+
do=edit&page=memes/badger needs to not put the JPG in a text box: somehow
divert or override the normal edit CGI by telling it that .albumimage
files are not editable in the usual way?
@@ -182,7 +210,14 @@ the overly strict constraint that the ordered sequence of pages in each
album must be known at scan time. However, that's not *necessarily* needed:
the album and each photo could collect an unordered superset of dependencies
at scan time, and at rebuild time that could be refined to be the exact set,
-in order. Perhaps restricting to "the images in an album A must match A/*"
+in order.
+
+> Why do you need to collect this info at scan time? You can determine it
+> at build time via `pagespec_match_list`, surely .. maybe with some
+> memoization to avoid each image in an album building the same list.
+> I sense that I may be missing a subtelty though. --[[Joey]]
+
+Perhaps restricting to "the images in an album A must match A/*"
would be useful; then the unordered superset could just be "A/*". Your
"albums via tags" idea would be nice too though, particularly for feature
parity with e.g. Facebook: "photos of Joey" -> "tags/joey and albumimage()"
@@ -195,12 +230,20 @@ and it could get quite hard to navigate. Perhaps next/previous links could
be displayed only for the closest ancestor (in URL space) that is an
album, or something?
+> Ugh, yeah, that is a problem. Perhaps wanting to support that was just
+> too ambitious. --[[Joey]]
+
Requiring renaming is awkward for non-technical Windows/Mac users, with both
platforms' defaults being to hide extensions; however, this could be
circumvented by adding some sort of hook in attachment to turn things into
a .albumimage at upload time, and declaring that using git/svn/... without
extensions visible is a "don't do that then" situation :-)
+> Or extend `pagetype` so it can do the necessary matching without
+> renaming. Maybe by allowing a subdirectory to be specified along
+> with an extension. (Or allow specifying a full pagespec,
+> but I hesitate to seriously suggest that.) --[[Joey]]
+
Ideally attachment could also be configured to upload into a specified
underlay, so that photos don't have to be in your source-code control
(you might want that, but I don't!).
--
cgit v1.2.3
From 4528b95d2562831208d490ef378a089631000767 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Wed, 7 Oct 2009 18:06:49 -0400
Subject: mention that pagespec_match returns an overloaded value
---
doc/plugins/write.mdwn | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 668f8d8b6..8e8c3311e 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -609,15 +609,31 @@ page created from it. (Ie, it appends ".html".)
Use this when constructing the filename of a html file. Use `urlto` when
generating a link to a page.
-#### `add_depends($$)`
+#### `add_depends($$;@)`
Makes the specified page depend on the specified [[ikiwiki/PageSpec]].
+By default, dependencies are full content dependencies, meaning that the
+page will be updated whenever anything matching the PageSpec is modified.
+This default can be overridden by additional named parameters, which can be
+used to indicate weaker types of dependencies:
+
+* `presence` if set to true, only the presence of a matching page triggers
+ the dependency.
+* `links` if set to true, any change to links on a matching page
+ triggers the dependency. This includes when a link is added, removed,
+ or changes what it points to due to other changes. It does not include
+ the addition or removal of a duplicate link.
+
#### `pagespec_match($$;@)`
-Passed a page name, and [[ikiwiki/PageSpec]], returns true if the
+Passed a page name, and [[ikiwiki/PageSpec]], returns a true value if the
[[ikiwiki/PageSpec]] matches the page.
+Note that the return value is overloaded. If stringified, it will be a
+message indicating why the PageSpec succeeded, or failed, to match the
+page.
+
Additional named parameters can be passed, to further limit the match.
The most often used is "location", which specifies the location the
PageSpec should match against. If not passed, relative PageSpecs will match
--
cgit v1.2.3
From 4002d7c1a4657e769b036c6e76106991ec5c3897 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Wed, 7 Oct 2009 20:31:13 -0400
Subject: add influence info to match_*
Also update docs, test suite.
---
IkiWiki.pm | 24 ++++++++++++------------
IkiWiki/Plugin/meta.pm | 8 ++++----
debian/changelog | 2 ++
doc/plugins/write.mdwn | 7 +++++++
t/pagespec_match.t | 15 +++++++++++++--
5 files changed, 38 insertions(+), 18 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 73d2a9763..9c386e154 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -2039,7 +2039,7 @@ use overload (
sub new {
my $class = shift;
my $value = shift;
- return bless [$value, {@_}], $class;
+ return bless [$value, {map { $_ => 1 } @_}], $class;
}
sub influences {
@@ -2099,23 +2099,23 @@ sub match_link ($$;@) {
my $from=exists $params{location} ? $params{location} : '';
my $links = $IkiWiki::links{$page};
- return IkiWiki::FailReason->new("$page has no links") unless $links && @{$links};
+ return IkiWiki::FailReason->new("$page has no links", $link) unless $links && @{$links};
my $bestlink = IkiWiki::bestlink($from, $link);
foreach my $p (@{$links}) {
if (length $bestlink) {
- return IkiWiki::SuccessReason->new("$page links to $link")
+ return IkiWiki::SuccessReason->new("$page links to $link", $page)
if $bestlink eq IkiWiki::bestlink($page, $p);
}
else {
- return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
+ return IkiWiki::SuccessReason->new("$page links to page $p matching $link", $page)
if match_glob($p, $link, %params);
my ($p_rel)=$p=~/^\/?(.*)/;
$link=~s/^\///;
- return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link")
+ return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link", $page)
if match_glob($p_rel, $link, %params);
}
}
- return IkiWiki::FailReason->new("$page does not link to $link");
+ return IkiWiki::FailReason->new("$page does not link to $link", $page);
}
sub match_backlink ($$;@) {
@@ -2131,14 +2131,14 @@ sub match_created_before ($$;@) {
if (exists $IkiWiki::pagectime{$testpage}) {
if ($IkiWiki::pagectime{$page} < $IkiWiki::pagectime{$testpage}) {
- return IkiWiki::SuccessReason->new("$page created before $testpage");
+ return IkiWiki::SuccessReason->new("$page created before $testpage", $testpage);
}
else {
- return IkiWiki::FailReason->new("$page not created before $testpage");
+ return IkiWiki::FailReason->new("$page not created before $testpage", $testpage);
}
}
else {
- return IkiWiki::ErrorReason->new("$testpage does not exist");
+ return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage);
}
}
@@ -2151,14 +2151,14 @@ sub match_created_after ($$;@) {
if (exists $IkiWiki::pagectime{$testpage}) {
if ($IkiWiki::pagectime{$page} > $IkiWiki::pagectime{$testpage}) {
- return IkiWiki::SuccessReason->new("$page created after $testpage");
+ return IkiWiki::SuccessReason->new("$page created after $testpage", $testpage);
}
else {
- return IkiWiki::FailReason->new("$page not created after $testpage");
+ return IkiWiki::FailReason->new("$page not created after $testpage", $testpage);
}
}
else {
- return IkiWiki::ErrorReason->new("$testpage does not exist");
+ return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage);
}
}
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 9b041a748..a8ee5bc85 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -291,21 +291,21 @@ sub match {
if (defined $val) {
if ($val=~/^$re$/i) {
- return IkiWiki::SuccessReason->new("$re matches $field of $page");
+ return IkiWiki::SuccessReason->new("$re matches $field of $page", $page);
}
else {
- return IkiWiki::FailReason->new("$re does not match $field of $page");
+ return IkiWiki::FailReason->new("$re does not match $field of $page", $page);
}
}
else {
- return IkiWiki::FailReason->new("$page does not have a $field");
+ return IkiWiki::FailReason->new("$page does not have a $field", $page);
}
}
package IkiWiki::PageSpec;
sub match_title ($$;@) {
- IkiWiki::Plugin::meta::match("title", @_);
+ IkiWiki::Plugin::meta::match("title", @_);
}
sub match_author ($$;@) {
diff --git a/debian/changelog b/debian/changelog
index dc6ee0a81..565a0cffa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,8 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
* Transitive dependencies are now correctly supported.
* Rebuild wikis on upgrade to this version to get improved dependency
info.
+ * Plugins providing PageSpec `match_*` functions should pass additional
+ influence information when creating result objects.
-- Joey Hess Sun, 27 Sep 2009 17:40:03 -0400
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 8e8c3311e..6b47033e5 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -982,6 +982,13 @@ an IkiWiki::FailReason object if the match fails. If the match cannot be
attempted at all, for any page, it can instead return an
IkiWiki::ErrorReason object explaining why.
+When constructing these objects, you should also include a list of any
+pages whose contents or other metadata influenced the result of the match.
+For example, "backlink(foo)" is influenced by the contents of page foo;
+"link(foo)" and "title(bar)" are influenced by the contents of any
+page they match; "created_before(foo)" is influenced by the metadata of
+foo; while "glob(*)" is not influenced by the contents of any page.
+
### Setup plugins
The ikiwiki setup file is loaded using a pluggable mechanism. If you look
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index a1fcba7c8..f73bfdfe1 100755
--- a/t/pagespec_match.t
+++ b/t/pagespec_match.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 56;
+use Test::More tests => 61;
BEGIN { use_ok("IkiWiki"); }
@@ -89,6 +89,17 @@ my $ret=pagespec_match("foo", "(invalid");
ok(! $ret, "syntax error");
ok($ret =~ /syntax error/, "error message");
-my $ret=pagespec_match("foo", "bar or foo");
+$ret=pagespec_match("foo", "bar or foo");
ok($ret, "simple match");
is($ret, "foo matches foo", "stringified return");
+
+$ret=pagespec_match("foo", "link(bar)");
+is(join(",", $ret->influences), 'foo', "link is influenced by the page with the link");
+$ret=pagespec_match("bar", "backlink(foo)");
+is(join(",", $ret->influences), 'foo', "backlink is influenced by the page with the link");
+$ret=pagespec_match("bar", "backlink(foo)");
+is(join(",", $ret->influences), 'foo', "backlink is influenced by the page with the link");
+$ret=pagespec_match("bar", "created_before(foo)");
+is(join(",", $ret->influences), 'foo', "created_before is influenced by the comparison page");
+$ret=pagespec_match("bar", "created_after(foo)");
+is(join(",", $ret->influences), 'foo', "created_after is influenced by the comparison page");
--
cgit v1.2.3
From 5f9860e65c65aa769f11e550e63cc164b1519710 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Wed, 7 Oct 2009 21:48:03 -0400
Subject: add type info to influence information
---
IkiWiki.pm | 49 ++++++++++++++++++++++++++++++-------------------
IkiWiki/Plugin/meta.pm | 6 +++---
doc/plugins/write.mdwn | 6 +++---
docwiki.setup | 2 +-
t/add_depends.t | 14 +++++++-------
t/pagespec_match.t | 32 ++++++++++++++++----------------
6 files changed, 60 insertions(+), 49 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 7adc63139..39a43ddbe 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1795,8 +1795,10 @@ sub add_depends ($$;@) {
return if $@;
foreach my $p (keys %pagesources) {
my $r=$sub->($p, location => $page );
- map { $depends_simple{$page}{lc $_} |= $DEPEND_CONTENT } $r->influences
- if $r;
+ my %i=$r->influences;
+ foreach my $i (keys %i) {
+ $depends_simple{$page}{lc $i} |= $i{$i};
+ }
}
$depends{$page}{$pagespec} |= $deptype;
@@ -1998,8 +2000,8 @@ use overload (
'""' => sub { $_[0][0] },
'0+' => sub { 0 },
'!' => sub { bless $_[0], 'IkiWiki::SuccessReason'},
- '&' => sub { $_[0][1]={%{$_[0][1]}, %{$_[1][1]}}; $_[0] },
- '|' => sub { $_[1][1]={%{$_[0][1]}, %{$_[1][1]}}; $_[1] },
+ '&' => sub { $_[0]->merge_influences($_[1]); $_[0] },
+ '|' => sub { $_[1]->merge_influences($_[0]); $_[1] },
fallback => 1,
);
@@ -2011,19 +2013,27 @@ use overload (
'""' => sub { $_[0][0] },
'0+' => sub { 1 },
'!' => sub { bless $_[0], 'IkiWiki::FailReason'},
- '&' => sub { $_[1][1]={%{$_[0][1]}, %{$_[1][1]}}; $_[1] },
- '|' => sub { $_[0][1]={%{$_[0][1]}, %{$_[1][1]}}; $_[0] },
+ '&' => sub { $_[1]->merge_influences($_[0]); $_[1] },
+ '|' => sub { $_[0]->merge_influences($_[1]); $_[0] },
fallback => 1,
);
sub new {
my $class = shift;
my $value = shift;
- return bless [$value, {map { $_ => 1 } @_}], $class;
+ return bless [$value, {@_}], $class;
}
sub influences {
- return keys %{$_[0][1]};
+ return %{$_[0][1]};
+}
+
+sub merge_influences {
+ my $this=shift;
+ my $other=shift;
+ foreach my $influence (keys %{$other->[1]}) {
+ $this->[1]{$influence} |= $other->[1]{$influence};
+ }
}
package IkiWiki::ErrorReason;
@@ -2079,23 +2089,24 @@ sub match_link ($$;@) {
my $from=exists $params{location} ? $params{location} : '';
my $links = $IkiWiki::links{$page};
- return IkiWiki::FailReason->new("$page has no links", $page) unless $links && @{$links};
+ return IkiWiki::FailReason->new("$page has no links", $page => $IkiWiki::DEPEND_LINKS)
+ unless $links && @{$links};
my $bestlink = IkiWiki::bestlink($from, $link);
foreach my $p (@{$links}) {
if (length $bestlink) {
- return IkiWiki::SuccessReason->new("$page links to $link", $page)
+ return IkiWiki::SuccessReason->new("$page links to $link", $page => $IkiWiki::DEPEND_LINKS)
if $bestlink eq IkiWiki::bestlink($page, $p);
}
else {
- return IkiWiki::SuccessReason->new("$page links to page $p matching $link", $page)
+ return IkiWiki::SuccessReason->new("$page links to page $p matching $link", $page => $IkiWiki::DEPEND_LINKS)
if match_glob($p, $link, %params);
my ($p_rel)=$p=~/^\/?(.*)/;
$link=~s/^\///;
- return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link", $page)
+ return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link", $page => $IkiWiki::DEPEND_LINKS)
if match_glob($p_rel, $link, %params);
}
}
- return IkiWiki::FailReason->new("$page does not link to $link", $page);
+ return IkiWiki::FailReason->new("$page does not link to $link", $page => $IkiWiki::DEPEND_LINKS);
}
sub match_backlink ($$;@) {
@@ -2111,14 +2122,14 @@ sub match_created_before ($$;@) {
if (exists $IkiWiki::pagectime{$testpage}) {
if ($IkiWiki::pagectime{$page} < $IkiWiki::pagectime{$testpage}) {
- return IkiWiki::SuccessReason->new("$page created before $testpage", $testpage);
+ return IkiWiki::SuccessReason->new("$page created before $testpage", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
else {
- return IkiWiki::FailReason->new("$page not created before $testpage", $testpage);
+ return IkiWiki::FailReason->new("$page not created before $testpage", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
}
else {
- return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage);
+ return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
}
@@ -2131,14 +2142,14 @@ sub match_created_after ($$;@) {
if (exists $IkiWiki::pagectime{$testpage}) {
if ($IkiWiki::pagectime{$page} > $IkiWiki::pagectime{$testpage}) {
- return IkiWiki::SuccessReason->new("$page created after $testpage", $testpage);
+ return IkiWiki::SuccessReason->new("$page created after $testpage", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
else {
- return IkiWiki::FailReason->new("$page not created after $testpage", $testpage);
+ return IkiWiki::FailReason->new("$page not created after $testpage", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
}
else {
- return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage);
+ return IkiWiki::ErrorReason->new("$testpage does not exist", $testpage => $IkiWiki::DEPEND_PRESENCE);
}
}
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index a8ee5bc85..c160e7eba 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -291,14 +291,14 @@ sub match {
if (defined $val) {
if ($val=~/^$re$/i) {
- return IkiWiki::SuccessReason->new("$re matches $field of $page", $page);
+ return IkiWiki::SuccessReason->new("$re matches $field of $page", $page => $IkiWiki::DEPEND_CONTENT);
}
else {
- return IkiWiki::FailReason->new("$re does not match $field of $page", $page);
+ return IkiWiki::FailReason->new("$re does not match $field of $page", $page => $IkiWiki::DEPEND_CONTENT);
}
}
else {
- return IkiWiki::FailReason->new("$page does not have a $field", $page);
+ return IkiWiki::FailReason->new("$page does not have a $field", $page => $IkiWiki::DEPEND_CONTENT);
}
}
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 6b47033e5..232430079 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -982,9 +982,9 @@ an IkiWiki::FailReason object if the match fails. If the match cannot be
attempted at all, for any page, it can instead return an
IkiWiki::ErrorReason object explaining why.
-When constructing these objects, you should also include a list of any
-pages whose contents or other metadata influenced the result of the match.
-For example, "backlink(foo)" is influenced by the contents of page foo;
+When constructing these objects, you should also include information about
+of any pages whose contents or other metadata influenced the result of the
+match. For example, "backlink(foo)" is influenced by the contents of page foo;
"link(foo)" and "title(bar)" are influenced by the contents of any
page they match; "created_before(foo)" is influenced by the metadata of
foo; while "glob(*)" is not influenced by the contents of any page.
diff --git a/docwiki.setup b/docwiki.setup
index 52421e501..41c07f024 100644
--- a/docwiki.setup
+++ b/docwiki.setup
@@ -16,5 +16,5 @@ use IkiWiki::Setup::Standard {
userdir => "users",
usedirs => 0,
prefix_directives => 1,
- add_plugins => [qw{goodstuff version haiku polygen fortune}],
+ add_plugins => [qw{linkmap goodstuff version haiku polygen fortune}],
}
diff --git a/t/add_depends.t b/t/add_depends.t
index d49aa74ce..9f426187b 100755
--- a/t/add_depends.t
+++ b/t/add_depends.t
@@ -57,17 +57,17 @@ ok($IkiWiki::depends{foo0}{"*"} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_L
ok(! ($IkiWiki::depends{foo0}{"*"} & $IkiWiki::DEPEND_PRESENCE));
# Adding a pagespec that requires page metadata should add the influence
-# as an explicit content dependency.
+# as an explicit dependency. In the case of a link, a links dependency.
$links{foo0}=$links{foo9}=[qw{bar baz}];
foreach my $spec ("* and ! link(bar)", "* or link(bar)") {
ok(add_depends("foo3", $spec, presence => 1));
ok($IkiWiki::depends{foo3}{$spec} & $IkiWiki::DEPEND_PRESENCE);
ok(! ($IkiWiki::depends{foo3}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_LINKS)));
- ok($IkiWiki::depends_simple{foo3}{foo3} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo3}{foo3} == $IkiWiki::DEPEND_LINKS);
ok(add_depends("foo4", $spec, links => 1));
ok($IkiWiki::depends{foo4}{$spec} & $IkiWiki::DEPEND_LINKS);
ok(! ($IkiWiki::depends{foo4}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_PRESENCE)));
- ok($IkiWiki::depends_simple{foo4}{foo4} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo4}{foo4} == $IkiWiki::DEPEND_LINKS);
}
# a pagespec with backlinks() will add as an influence the page with the links
@@ -76,20 +76,20 @@ foreach my $spec ("bugs or (backlink(foo0) and !*.png)", "backlink(foo)") {
ok(add_depends("foo5", $spec, presence => 1));
ok($IkiWiki::depends{foo5}{$spec} & $IkiWiki::DEPEND_PRESENCE);
ok(! ($IkiWiki::depends{foo5}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_LINKS)));
- ok($IkiWiki::depends_simple{foo5}{foo0} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo5}{foo0} == $IkiWiki::DEPEND_LINKS);
ok(add_depends("foo6", $spec, links => 1));
ok($IkiWiki::depends{foo6}{$spec} & $IkiWiki::DEPEND_LINKS);
ok(! ($IkiWiki::depends{foo6}{$spec} & ($IkiWiki::DEPEND_PRESENCE | $IkiWiki::DEPEND_CONTENT)));
- ok($IkiWiki::depends_simple{foo5}{foo0} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo5}{foo0} == $IkiWiki::DEPEND_LINKS);
ok(add_depends("foo7", $spec, presence => 1, links => 1));
ok($IkiWiki::depends{foo7}{$spec} & $IkiWiki::DEPEND_PRESENCE);
ok($IkiWiki::depends{foo7}{$spec} & $IkiWiki::DEPEND_LINKS);
ok(! ($IkiWiki::depends{foo7}{$spec} & $IkiWiki::DEPEND_CONTENT));
- ok($IkiWiki::depends_simple{foo7}{foo0} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo7}{foo0} == $IkiWiki::DEPEND_LINKS);
ok(add_depends("foo8", $spec));
ok($IkiWiki::depends{foo8}{$spec} & $IkiWiki::DEPEND_CONTENT);
ok(! ($IkiWiki::depends{foo8}{$spec} & ($IkiWiki::DEPEND_PRESENCE | $IkiWiki::DEPEND_LINKS)));
- ok($IkiWiki::depends_simple{foo8}{foo0} == $IkiWiki::DEPEND_CONTENT);
+ ok($IkiWiki::depends_simple{foo8}{foo0} == $IkiWiki::DEPEND_LINKS);
}
# content is the default if unknown types are entered
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index 1a0db1cef..36fa04370 100755
--- a/t/pagespec_match.t
+++ b/t/pagespec_match.t
@@ -93,19 +93,19 @@ $ret=pagespec_match("foo", "bar or foo");
ok($ret, "simple match");
is($ret, "foo matches foo", "stringified return");
-$ret=pagespec_match("foo", "link(bar)");
-is(join(",", $ret->influences), 'foo', "link is influenced by the page with the link");
-$ret=pagespec_match("bar", "backlink(foo)");
-is(join(",", $ret->influences), 'foo', "backlink is influenced by the page with the link");
-$ret=pagespec_match("bar", "backlink(foo)");
-is(join(",", $ret->influences), 'foo', "backlink is influenced by the page with the link");
-$ret=pagespec_match("bar", "created_before(foo)");
-is(join(",", $ret->influences), 'foo', "created_before is influenced by the comparison page");
-$ret=pagespec_match("bar", "created_after(foo)");
-is(join(",", $ret->influences), 'foo', "created_after is influenced by the comparison page");
-$ret=pagespec_match("bar", "link(quux) and created_after(foo)");
-is(join(",", sort $ret->influences), 'foo,quux', "influences add up over AND");
-$ret=pagespec_match("bar", "link(quux) and created_after(foo)");
-is(join(",", sort $ret->influences), 'foo,quux', "influences add up over OR");
-$ret=pagespec_match("bar", "!link(quux) and !created_after(foo)");
-is(join(",", sort $ret->influences), 'foo,quux', "influences unaffected by negation");
+my %i=pagespec_match("foo", "link(bar)")->influences;
+is(join(",", keys %i), 'foo', "link is influenced by the page with the link");
+%i=pagespec_match("bar", "backlink(foo)")->influences;
+is(join(",", keys %i), 'foo', "backlink is influenced by the page with the link");
+%i=pagespec_match("bar", "backlink(foo)")->influences;
+is(join(",", keys %i), 'foo', "backlink is influenced by the page with the link");
+%i=pagespec_match("bar", "created_before(foo)")->influences;
+is(join(",", keys %i), 'foo', "created_before is influenced by the comparison page");
+%i=pagespec_match("bar", "created_after(foo)")->influences;
+is(join(",", keys %i), 'foo', "created_after is influenced by the comparison page");
+%i=pagespec_match("bar", "link(quux) and created_after(foo)")->influences;
+is(join(",", sort keys %i), 'bar,foo', "influences add up over AND");
+%i=pagespec_match("bar", "link(quux) and created_after(foo)")->influences;
+is(join(",", sort keys %i), 'bar,foo', "influences add up over OR");
+%i=pagespec_match("bar", "!link(quux) and !created_after(foo)")->influences;
+is(join(",", sort keys %i), 'bar,foo', "influences unaffected by negation");
--
cgit v1.2.3
From 5e236f5d25b68f5fb4a421b24470419c6042cb1c Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Thu, 8 Oct 2009 16:49:53 -0400
Subject: add use_pagespec and deptype functions
---
IkiWiki.pm | 135 +++++++++++++++++++++++++++++++++++++++++--------
debian/changelog | 4 +-
doc/plugins/write.mdwn | 61 +++++++++++++++++-----
t/use_pagespec.t | 30 +++++++++++
4 files changed, 194 insertions(+), 36 deletions(-)
create mode 100755 t/use_pagespec.t
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 2064c881a..c787612e1 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -17,11 +17,12 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%forcerebuild %loaded_plugins};
use Exporter q{import};
-our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
- pagespec_match_list bestlink htmllink readfile writefile
- pagetype srcfile pagename displaytime will_render gettext urlto
- targetpage add_underlay pagetitle titlepage linkpage
- newpagefile inject add_link
+our @EXPORT = qw(hook debug error template htmlpage deptype use_pagespec
+ add_depends pagespec_match pagespec_match_list bestlink
+ htmllink readfile writefile pagetype srcfile pagename
+ displaytime will_render gettext urlto targetpage
+ add_underlay pagetitle titlepage linkpage newpagefile
+ inject add_link
%config %links %pagestate %wikistate %renderedfiles
%pagesources %destsources);
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
@@ -1768,18 +1769,10 @@ sub rcs_receive () {
$hooks{rcs}{rcs_receive}{call}->();
}
-sub add_depends ($$;@) {
+sub add_depends ($$;$) {
my $page=shift;
my $pagespec=shift;
-
- my $deptype=0;
- if (@_) {
- my %params=@_;
-
- $deptype=$deptype | $DEPEND_PRESENCE if $params{presence};
- $deptype=$deptype | $DEPEND_LINKS if $params{links};
- }
- $deptype=$DEPEND_CONTENT unless $deptype;
+ my $deptype=shift || $DEPEND_CONTENT;
# Is the pagespec a simple page name?
if ($pagespec =~ /$config{wiki_file_regexp}/ &&
@@ -1791,18 +1784,118 @@ sub add_depends ($$;@) {
# Analyse the pagespec, and match it against all pages
# to get a list of influences, and add explicit dependencies
# for those.
+ #my $sub=pagespec_translate($pagespec);
+ #return if $@;
+ #foreach my $p (keys %pagesources) {
+ # my $r=$sub->($p, location => $page );
+ # my %i=$r->influences;
+ # foreach my $i (keys %i) {
+ # $depends_simple{$page}{lc $i} |= $i{$i};
+ # }
+ #}
+ print STDERR "warning: use of add_depends; influences not tracked\n";
+
+ $depends{$page}{$pagespec} |= $deptype;
+ return 1;
+}
+
+sub use_pagespec ($$;@) {
+ my $page=shift;
+ my $pagespec=shift;
+ my %params=@_;
+
my $sub=pagespec_translate($pagespec);
- return if $@;
- foreach my $p (keys %pagesources) {
- my $r=$sub->($p, location => $page );
- my %i=$r->influences;
+ error "syntax error in pagespec \"$pagespec\""
+ if $@ || ! defined $sub;
+
+ my @candidates;
+ if (exists $params{limit}) {
+ @candidates=grep { $params{limit}->($_) } keys %pagesources;
+ }
+ else {
+ @candidates=keys %pagesources;
+ }
+
+ if (defined $params{sort}) {
+ my $f;
+ if ($params{sort} eq 'title') {
+ $f=sub { pagetitle(basename($a)) cmp pagetitle(basename($b)) };
+ }
+ elsif ($params{sort} eq 'title_natural') {
+ eval q{use Sort::Naturally};
+ if ($@) {
+ error(gettext("Sort::Naturally needed for title_natural sort"));
+ }
+ $f=sub { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) };
+ }
+ elsif ($params{sort} eq 'mtime') {
+ $f=sub { $pagemtime{$b} <=> $pagemtime{$a} };
+ }
+ elsif ($params{sort} eq 'age') {
+ $f=sub { $pagectime{$b} <=> $pagectime{$a} };
+ }
+ else {
+ error sprintf(gettext("unknown sort type %s"), $params{sort});
+ }
+ @candidates = sort { &$f } @candidates;
+ }
+
+ @candidates=reverse(@candidates) if $params{reverse};
+
+ my @matches;
+ my $firstfail;
+ my $count=0;
+ foreach my $p (@candidates) {
+ my $r=$sub->($p, location => $page);
+ if ($r) {
+ push @matches, [$p, $r];
+ last if defined $params{num} && ++$count == $params{num};
+ }
+ elsif (! defined $firstfail) {
+ $firstfail=$r;
+ }
+ }
+
+ $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
+
+ my @ret;
+ if (@matches) {
+ # Add all influences from successful matches.
+ foreach my $m (@matches) {
+ push @ret, $m->[0];
+ my %i=$m->[1]->influences;
+ foreach my $i (keys %i) {
+ $depends_simple{$page}{lc $i} |= $i{$i};
+ }
+ }
+ }
+ elsif (defined $firstfail) {
+ # Add influences from one failure. (Which one should not
+ # matter; all should have the same influences.)
+ my %i=$firstfail->influences;
foreach my $i (keys %i) {
$depends_simple{$page}{lc $i} |= $i{$i};
}
+ error(sprintf(gettext("cannot match pages: %s"), $firstfail));
}
- $depends{$page}{$pagespec} |= $deptype;
- return 1;
+ return @ret;
+}
+
+sub deptype (@) {
+ my $deptype=0;
+ foreach my $type (@_) {
+ if ($type eq 'presence') {
+ $deptype |= $DEPEND_PRESENCE;
+ }
+ elsif ($type eq 'links') {
+ $deptype |= $DEPEND_LINKS;
+ }
+ elsif ($type eq 'content') {
+ $deptype |= $DEPEND_CONTENT;
+ }
+ }
+ return $deptype;
}
sub file_pruned ($$) {
diff --git a/debian/changelog b/debian/changelog
index 565a0cffa..12ddebac9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,7 +13,6 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
* Added support framework for multiple types of dependencies.
* Allow declaring that a dependency is only affected by page presence
or changes to its links.
- (By passing presence => 1 or links => 1 to add_depends.)
* pagecount, calendar, postsparkline, progress: Use a presence dependency,
which makes these directives much less expensive to use, since page
edits will no longer trigger an unnecessary update.
@@ -34,6 +33,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
info.
* Plugins providing PageSpec `match_*` functions should pass additional
influence information when creating result objects.
+ * Added `use_pagespec` function, that plugins can use to find a list
+ of matching pages and add dependencies and influences, all at once,
+ and efficiently.
-- Joey Hess Sun, 27 Sep 2009 17:40:03 -0400
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 232430079..3d5650758 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -609,21 +609,52 @@ page created from it. (Ie, it appends ".html".)
Use this when constructing the filename of a html file. Use `urlto` when
generating a link to a page.
-#### `add_depends($$;@)`
+### `deptype(@)`
+
+Use this function to generate ikiwiki's internal representation of a
+dependency type from one or more of these keywords:
+
+* `content` is the default. Any change to the content
+ of a page triggers the dependency.
+* `presence` is only triggered by a change to the presence
+ of a page.
+* `links` is only triggered by a change to the links of a page.
+ This includes when a link is added, removed, or changes what
+ it points to due to other changes. It does not include the
+ addition or removal of a duplicate link.
+
+If multiple types are specified, they are combined.
+
+#### `use_pagespec($$;@)`
+
+Passed a page name, and [[ikiwiki/PageSpec]], returns a list of pages
+in the wiki that match the [[ikiwiki/PageSpec]].
+
+The page will automatically be made to depend on the specified
+[[ikiwiki/PageSpec]], so `add_depends` does not need to be called. This
+is significantly more efficient than calling `add_depends`
+followed by `pagespec_match_list`. You should use this anytime a plugin
+needs to match a set of pages and generate something based on that list.
+
+Additional named parameters can be specified:
+
+* `deptype` optionally specifies the type of dependency to add. Use the
+ `deptype` function to generate a dependency type.
+* `limit` is a reference to a function, that is called and passed a page,
+ and must return true for the page to be included.
+* `sort` specifies a sort order for the list. See
+ [[ikiwiki/PageSpec/sorting]] for the avilable sort methods.
+* `reverse` if true, sorts in reverse.
+* `num` if nonzero, specifies the maximum number of matching pages that
+ will be returned.
+
+#### `add_depends($$;$)`
Makes the specified page depend on the specified [[ikiwiki/PageSpec]].
By default, dependencies are full content dependencies, meaning that the
page will be updated whenever anything matching the PageSpec is modified.
-This default can be overridden by additional named parameters, which can be
-used to indicate weaker types of dependencies:
-
-* `presence` if set to true, only the presence of a matching page triggers
- the dependency.
-* `links` if set to true, any change to links on a matching page
- triggers the dependency. This includes when a link is added, removed,
- or changes what it points to due to other changes. It does not include
- the addition or removal of a duplicate link.
+This can be overridden by passing a `deptype` value as the third parameter.
#### `pagespec_match($$;@)`
@@ -984,10 +1015,12 @@ IkiWiki::ErrorReason object explaining why.
When constructing these objects, you should also include information about
of any pages whose contents or other metadata influenced the result of the
-match. For example, "backlink(foo)" is influenced by the contents of page foo;
-"link(foo)" and "title(bar)" are influenced by the contents of any
-page they match; "created_before(foo)" is influenced by the metadata of
-foo; while "glob(*)" is not influenced by the contents of any page.
+match. Do this by passing a list of pages, followed by `deptype` values.
+
+For example, "backlink(foo)" is influenced by the contents of page foo;
+"link(foo)" and "title(bar)" are influenced by the contents of any page
+they match; "created_before(foo)" is influenced by the metadata of foo;
+while "glob(*)" is not influenced by the contents of any page.
### Setup plugins
diff --git a/t/use_pagespec.t b/t/use_pagespec.t
new file mode 100755
index 000000000..7b904075e
--- /dev/null
+++ b/t/use_pagespec.t
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More tests => 64;
+
+BEGIN { use_ok("IkiWiki"); }
+
+%pagesources=(
+ foo => "foo.mdwn",
+ bar => "bar.mdwn",
+ "post/1" => "post/1.mdwn",
+ "post/2" => "post/2.mdwn",
+ "post/3" => "post/3.mdwn",
+);
+
+is_deeply([use_pagespec("foo", "bar")], ["bar"]);
+is_deeply([sort(use_pagespec("foo", "post/*"))], ["post/1", "post/2", "post/3"]);
+is_deeply([use_pagespec("foo", "post/*", sort => "title", reverse => 1)],
+ ["post/3", "post/2", "post/1"]);
+is_deeply([use_pagespec("foo", "post/*", sort => "title", num => 2)],
+ ["post/1", "post/2"]);
+is_deeply([use_pagespec("foo", "post/*", sort => "title", num => 50)],
+ ["post/1", "post/2", "post/3"]);
+is_deeply([use_pagespec("foo", "post/*", sort => "title",
+ limit => sub { $_[0] !~ /3/}) ],
+ ["post/1", "post/2"]);
+eval { use_pagespec("foo", "beep") };
+ok($@, "fails with error when unable to match anything");
+eval { use_pagespec("foo", "this is not a legal pagespec!") };
+ok($@, "fails with error when pagespec bad");
--
cgit v1.2.3
From 32cd5f0b798c41b2320a4165c5b6ecc18a4e6e3e Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Thu, 8 Oct 2009 18:26:36 -0400
Subject: inline: switch to use_pagespec
Taking advantage of every single one of its features, of course.
Even had to add one more..
---
IkiWiki/Plugin/inline.pm | 49 +++++++++++++++++++++---------------------------
doc/plugins/write.mdwn | 2 ++
2 files changed, 23 insertions(+), 28 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index be1781520..748e02df4 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -196,45 +196,37 @@ sub preprocess_inline (@) {
@list = map { bestlink($params{page}, $_) }
split ' ', $params{pagenames};
+ if (yesno($params{reverse})) {
+ @list=reverse(@list);
+ }
+
foreach my $p (@list) {
add_depends($params{page}, $p, deptype($quick ? "presence" : "content"));
}
}
else {
- add_depends($params{page}, $params{pages},
- deptype($quick ? "presence" : "content"));
-
- @list = pagespec_match_list(
- [ grep { $_ ne $params{page} } keys %pagesources ],
- $params{pages}, location => $params{page});
-
- if (exists $params{sort} && $params{sort} eq 'title') {
- @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
+ my $num=0;
+ if ($params{show}) {
+ $num=$params{show};
}
- elsif (exists $params{sort} && $params{sort} eq 'title_natural') {
- eval q{use Sort::Naturally};
- if ($@) {
- error(gettext("Sort::Naturally needed for title_natural sort"));
- }
- @list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
+ if ($params{feedshow} && $num < $params{feedshow}) {
+ $num=$params{feedshow};
}
- elsif (exists $params{sort} && $params{sort} eq 'mtime') {
- @list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
+ if ($params{skip}) {
+ $num+=$params{skip};
}
- elsif (! exists $params{sort} || $params{sort} eq 'age') {
- @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
- }
- else {
- error sprintf(gettext("unknown sort type %s"), $params{sort});
- }
- }
- if (yesno($params{reverse})) {
- @list=reverse(@list);
+ @list = use_pagespec($params{page}, $params{pages},
+ deptype => deptype($quick ? "presence" : "content"),
+ limit => sub { $_[0] ne $params{page} },
+ sort => exists $params{sort} ? $params{sort} : "age",
+ reverse => yesno($params{reverse}),
+ num => $num,
+ );
}
if (exists $params{skip}) {
- @list=@list[$params{skip} .. scalar @list - 1];
+ @list=@list[$params{skip} .. $#list];
}
my @feedlist;
@@ -253,7 +245,8 @@ sub preprocess_inline (@) {
}
if ($feeds && exists $params{feedpages}) {
- @feedlist=pagespec_match_list(\@feedlist, $params{feedpages}, location => $params{page});
+ @feedlist = use_pagespec($params{page}, $params{feedpages},
+ list => \@feedlist);
}
my ($feedbase, $feednum);
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 3d5650758..62bebbeed 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -647,6 +647,8 @@ Additional named parameters can be specified:
* `reverse` if true, sorts in reverse.
* `num` if nonzero, specifies the maximum number of matching pages that
will be returned.
+* `list` makes it only match amoung the specified list of pages.
+ Default is to match amoung all pages in the wiki.
#### `add_depends($$;$)`
--
cgit v1.2.3
From 5e7b2dea84a35163b599b88efc02cd7ef3e0ad46 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Thu, 8 Oct 2009 23:51:06 -0400
Subject: rename use_pagespec to pagespec_match_list
To avoid breaking plugins, also support the old pagespec_match_list
calling convention, with a deprecation warning.
---
IkiWiki.pm | 183 ++++++++++++++++++----------------------
IkiWiki/Plugin/calendar.pm | 2 +-
IkiWiki/Plugin/inline.pm | 8 +-
IkiWiki/Plugin/map.pm | 3 +-
IkiWiki/Plugin/orphans.pm | 2 +-
IkiWiki/Plugin/pagecount.pm | 2 +-
IkiWiki/Plugin/pagestats.pm | 9 +-
IkiWiki/Plugin/postsparkline.pm | 2 +-
debian/changelog | 6 +-
doc/plugins/write.mdwn | 24 ++----
t/pagespec_match_list.t | 31 +++++++
t/use_pagespec.t | 31 -------
12 files changed, 140 insertions(+), 163 deletions(-)
create mode 100755 t/pagespec_match_list.t
delete mode 100755 t/use_pagespec.t
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index daa71059b..fd7e23524 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -17,7 +17,7 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%forcerebuild %loaded_plugins};
use Exporter q{import};
-our @EXPORT = qw(hook debug error template htmlpage deptype use_pagespec
+our @EXPORT = qw(hook debug error template htmlpage deptype
add_depends pagespec_match pagespec_match_list bestlink
htmllink readfile writefile pagetype srcfile pagename
displaytime will_render gettext urlto targetpage
@@ -1798,91 +1798,6 @@ sub add_depends ($$;$) {
return 1;
}
-sub use_pagespec ($$;@) {
- my $page=shift;
- my $pagespec=shift;
- my %params=@_;
-
- my $sub=pagespec_translate($pagespec);
- error "syntax error in pagespec \"$pagespec\""
- if $@ || ! defined $sub;
-
- my @candidates;
- if (exists $params{limit}) {
- @candidates=grep { $params{limit}->($_) } keys %pagesources;
- }
- else {
- @candidates=keys %pagesources;
- }
-
- if (defined $params{sort}) {
- my $f;
- if ($params{sort} eq 'title') {
- $f=sub { pagetitle(basename($a)) cmp pagetitle(basename($b)) };
- }
- elsif ($params{sort} eq 'title_natural') {
- eval q{use Sort::Naturally};
- if ($@) {
- error(gettext("Sort::Naturally needed for title_natural sort"));
- }
- $f=sub { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) };
- }
- elsif ($params{sort} eq 'mtime') {
- $f=sub { $pagemtime{$b} <=> $pagemtime{$a} };
- }
- elsif ($params{sort} eq 'age') {
- $f=sub { $pagectime{$b} <=> $pagectime{$a} };
- }
- else {
- error sprintf(gettext("unknown sort type %s"), $params{sort});
- }
- @candidates = sort { &$f } @candidates;
- }
-
- @candidates=reverse(@candidates) if $params{reverse};
-
- my @matches;
- my $firstfail;
- my $count=0;
- foreach my $p (@candidates) {
- my $r=$sub->($p, location => $page);
- if ($r) {
- push @matches, [$p, $r];
- last if defined $params{num} && ++$count == $params{num};
- }
- elsif (! defined $firstfail) {
- $firstfail=$r;
- }
- }
-
- $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
-
- my @ret;
- if (@matches) {
- # Add all influences from successful matches.
- foreach my $m (@matches) {
- push @ret, $m->[0];
- my %i=$m->[1]->influences;
- foreach my $i (keys %i) {
- $depends_simple{$page}{lc $i} |= $i{$i};
- }
- }
- }
- elsif (defined $firstfail) {
- # Add influences from one failure. (Which one should not
- # matter; all should have the same influences.)
- my %i=$firstfail->influences;
- foreach my $i (keys %i) {
- $depends_simple{$page}{lc $i} |= $i{$i};
- }
-
- error(sprintf(gettext("cannot match pages: %s"), $firstfail))
- if $firstfail->isa("IkiWiki::ErrorReason");
- }
-
- return @ret;
-}
-
sub deptype (@) {
my $deptype=0;
foreach my $type (@_) {
@@ -2055,27 +1970,95 @@ sub pagespec_match ($$;@) {
}
sub pagespec_match_list ($$;@) {
- my $pages=shift;
- my $spec=shift;
- my @params=@_;
+ my $page=shift;
+ my $pagespec=shift;
+ my %params=@_;
- my $sub=pagespec_translate($spec);
- error "syntax error in pagespec \"$spec\""
+ # Backwards compatability with old calling convention.
+ if (ref $page) {
+ print STDERR "warning: a plugin (".caller().") is using pagespec_match_list in an obsolete way, and needs to be updated\n";
+ $params{list}=$page;
+ $page=$params{location}; # ugh!
+ }
+
+ my $sub=pagespec_translate($pagespec);
+ error "syntax error in pagespec \"$pagespec\""
if $@ || ! defined $sub;
+
+ my @candidates;
+ if (exists $params{limit}) {
+ @candidates=grep { $params{limit}->($_) } keys %pagesources;
+ }
+ else {
+ @candidates=keys %pagesources;
+ }
+
+ if (defined $params{sort}) {
+ my $f;
+ if ($params{sort} eq 'title') {
+ $f=sub { pagetitle(basename($a)) cmp pagetitle(basename($b)) };
+ }
+ elsif ($params{sort} eq 'title_natural') {
+ eval q{use Sort::Naturally};
+ if ($@) {
+ error(gettext("Sort::Naturally needed for title_natural sort"));
+ }
+ $f=sub { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) };
+ }
+ elsif ($params{sort} eq 'mtime') {
+ $f=sub { $pagemtime{$b} <=> $pagemtime{$a} };
+ }
+ elsif ($params{sort} eq 'age') {
+ $f=sub { $pagectime{$b} <=> $pagectime{$a} };
+ }
+ else {
+ error sprintf(gettext("unknown sort type %s"), $params{sort});
+ }
+ @candidates = sort { &$f } @candidates;
+ }
+
+ @candidates=reverse(@candidates) if $params{reverse};
- my @ret;
- my $r;
- foreach my $page (@$pages) {
- $r=$sub->($page, @params);
- push @ret, $page if $r;
+ my @matches;
+ my $firstfail;
+ my $count=0;
+ foreach my $p (@candidates) {
+ my $r=$sub->($p, location => $page);
+ if ($r) {
+ push @matches, [$p, $r];
+ last if defined $params{num} && ++$count == $params{num};
+ }
+ elsif (! defined $firstfail) {
+ $firstfail=$r;
+ }
}
+
+ $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
- if (! @ret && defined $r && $r->isa("IkiWiki::ErrorReason")) {
- error(sprintf(gettext("cannot match pages: %s"), $r));
+ my @ret;
+ if (@matches) {
+ # Add all influences from successful matches.
+ foreach my $m (@matches) {
+ push @ret, $m->[0];
+ my %i=$m->[1]->influences;
+ foreach my $i (keys %i) {
+ $depends_simple{$page}{lc $i} |= $i{$i};
+ }
+ }
}
- else {
- return @ret;
+ elsif (defined $firstfail) {
+ # Add influences from one failure. (Which one should not
+ # matter; all should have the same influences.)
+ my %i=$firstfail->influences;
+ foreach my $i (keys %i) {
+ $depends_simple{$page}{lc $i} |= $i{$i};
+ }
+
+ error(sprintf(gettext("cannot match pages: %s"), $firstfail))
+ if $firstfail->isa("IkiWiki::ErrorReason");
}
+
+ return @ret;
}
sub pagespec_valid ($) {
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index a89175cfb..c50d038df 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -74,7 +74,7 @@ sub format_month (@) {
my $nyear = $params{nyear};
my %linkcache;
- foreach my $p (use_pagespec($params{page}, $params{pagespec},
+ foreach my $p (pagespec_match_list($params{page}, $params{pagespec},
# add presence dependencies to update
# month calendar when pages are added/removed
deptype => deptype("presence"))) {
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index c02137aed..815a37838 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -216,7 +216,7 @@ sub preprocess_inline (@) {
$num+=$params{skip};
}
- @list = use_pagespec($params{page}, $params{pages},
+ @list = pagespec_match_list($params{page}, $params{pages},
deptype => deptype($quick ? "presence" : "content"),
limit => sub { $_[0] ne $params{page} },
sort => exists $params{sort} ? $params{sort} : "age",
@@ -245,9 +245,11 @@ sub preprocess_inline (@) {
}
if ($feeds && exists $params{feedpages}) {
- @feedlist = use_pagespec($params{page}, "($params{pages}) and ($params{feedpages})",
+ @feedlist = pagespec_match_list(
+ $params{page}, "($params{pages}) and ($params{feedpages})",
deptype => deptype($quick ? "presence" : "content"),
- list => \@feedlist);
+ list => \@feedlist,
+ );
}
my ($feedbase, $feednum);
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 634b0e4d6..788b96827 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -36,7 +36,8 @@ sub preprocess (@) {
# Get all the items to map.
my %mapitems;
- foreach my $page (use_pagespec($params{page}, $params{pages}, deptype => $deptype)) {
+ foreach my $page (pagespec_match_list($params{page}, $params{pages},
+ deptype => $deptype)) {
if (exists $params{show} &&
exists $pagestate{$page} &&
exists $pagestate{$page}{meta}{$params{show}}) {
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 607239500..b1ebd1b9d 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -28,7 +28,7 @@ sub preprocess (@) {
# considering as orphans.
add_depends($params{page}, "*", deptype("links"));
- my @orphans=use_pagespec($params{page}, $params{pages},
+ my @orphans=pagespec_match_list($params{page}, $params{pages},
# update when orphans are added/removed
deptype => deptype("presence"),
limit => sub {
diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm
index 40474b2a1..8d36f057e 100644
--- a/IkiWiki/Plugin/pagecount.pm
+++ b/IkiWiki/Plugin/pagecount.pm
@@ -32,7 +32,7 @@ sub preprocess (@) {
return scalar keys %pagesources;
}
- return scalar use_pagespec($params{page}, $pages,
+ return scalar pagespec_match_list($params{page}, $pages,
deptype => deptype("presence"));
}
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index e64f7d9c3..47638210a 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -37,16 +37,17 @@ sub preprocess (@) {
my %counts;
my $max = 0;
- foreach my $page (use_pagespec($params{page}, $params{pages},
- # update when a displayed page is added or removed
- deptype => deptype("presence"))) {
+ foreach my $page (pagespec_match_list($params{page}, $params{pages},
+ # update when a displayed page is added/removed
+ deptype => deptype("presence"))) {
use IkiWiki::Render;
my @backlinks = IkiWiki::backlink_pages($page);
if (exists $params{among}) {
# only consider backlinks from the amoung pages
- @backlinks = use_pagespec($params{page}, $params{among},
+ @backlinks = pagespec_match_list(
+ $params{page}, $params{among},
# update whenever links on those pages change
deptype => deptype("links"),
list => \@backlinks
diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm
index f51e309c8..1d4532366 100644
--- a/IkiWiki/Plugin/postsparkline.pm
+++ b/IkiWiki/Plugin/postsparkline.pm
@@ -54,7 +54,7 @@ sub preprocess (@) {
}
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
- use_pagespec($params{page}, $params{pages},
+ pagespec_match_list($params{page}, $params{pages},
deptype => $deptype,
limit => sub { $_[0] ne $params{page} },
);
diff --git a/debian/changelog b/debian/changelog
index 3a6fdf77d..49809e6cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,9 +33,9 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
info.
* Plugins providing PageSpec `match_*` functions should pass additional
influence information when creating result objects.
- * Added `use_pagespec` function, that plugins can use to find a list
- of matching pages and add dependencies and influences, all at once,
- and efficiently.
+ * API change: `pagespec_match_list` has completly changed its interface.
+ The old interface will be removed soon, and a warning will be printed
+ if any plugins try to use it.
* Optimize away most expensive file prune calls, when refreshing,
by only checking new files.
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 62bebbeed..f6ea76c36 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -625,16 +625,16 @@ dependency type from one or more of these keywords:
If multiple types are specified, they are combined.
-#### `use_pagespec($$;@)`
+#### `pagespec_match_list($$;@)`
Passed a page name, and [[ikiwiki/PageSpec]], returns a list of pages
in the wiki that match the [[ikiwiki/PageSpec]].
The page will automatically be made to depend on the specified
[[ikiwiki/PageSpec]], so `add_depends` does not need to be called. This
-is significantly more efficient than calling `add_depends`
-followed by `pagespec_match_list`. You should use this anytime a plugin
-needs to match a set of pages and generate something based on that list.
+is significantly more efficient than calling `add_depends` and
+`pagespec_match` in a loop. You should use this anytime a plugin
+needs to match a set of pages and do something based on that list.
Additional named parameters can be specified:
@@ -650,6 +650,9 @@ Additional named parameters can be specified:
* `list` makes it only match amoung the specified list of pages.
Default is to match amoung all pages in the wiki.
+Unlike pagespec_match, this may throw an error if there is an error in
+the pagespec.
+
#### `add_depends($$;$)`
Makes the specified page depend on the specified [[ikiwiki/PageSpec]].
@@ -672,19 +675,6 @@ The most often used is "location", which specifies the location the
PageSpec should match against. If not passed, relative PageSpecs will match
relative to the top of the wiki.
-#### `pagespec_match_list($$;@)`
-
-Passed a reference to a list of page names, and [[ikiwiki/PageSpec]],
-returns the set of pages that match the [[ikiwiki/PageSpec]].
-
-Additional named parameters can be passed, to further limit the match.
-The most often used is "location", which specifies the location the
-PageSpec should match against. If not passed, relative PageSpecs will match
-relative to the top of the wiki.
-
-Unlike pagespec_match, this may throw an error if there is an error in
-the pagespec.
-
#### `bestlink($$)`
Given a page and the text of a link on the page, determine which
diff --git a/t/pagespec_match_list.t b/t/pagespec_match_list.t
new file mode 100755
index 000000000..85a30b542
--- /dev/null
+++ b/t/pagespec_match_list.t
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More tests => 10;
+
+BEGIN { use_ok("IkiWiki"); }
+
+%pagesources=(
+ foo => "foo.mdwn",
+ bar => "bar.mdwn",
+ "post/1" => "post/1.mdwn",
+ "post/2" => "post/2.mdwn",
+ "post/3" => "post/3.mdwn",
+);
+
+is_deeply([pagespec_match_list("foo", "bar")], ["bar"]);
+is_deeply([sort(pagespec_match_list("foo", "post/*"))], ["post/1", "post/2", "post/3"]);
+is_deeply([pagespec_match_list("foo", "post/*", sort => "title", reverse => 1)],
+ ["post/3", "post/2", "post/1"]);
+is_deeply([pagespec_match_list("foo", "post/*", sort => "title", num => 2)],
+ ["post/1", "post/2"]);
+is_deeply([pagespec_match_list("foo", "post/*", sort => "title", num => 50)],
+ ["post/1", "post/2", "post/3"]);
+is_deeply([pagespec_match_list("foo", "post/*", sort => "title",
+ limit => sub { $_[0] !~ /3/}) ],
+ ["post/1", "post/2"]);
+my $r=eval { pagespec_match_list("foo", "beep") };
+ok(eval { pagespec_match_list("foo", "beep") } == 0);
+ok(! $@, "does not fail with error when unable to match anything");
+eval { pagespec_match_list("foo", "this is not a legal pagespec!") };
+ok($@, "fails with error when pagespec bad");
diff --git a/t/use_pagespec.t b/t/use_pagespec.t
deleted file mode 100755
index 92d7977cf..000000000
--- a/t/use_pagespec.t
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/perl
-use warnings;
-use strict;
-use Test::More tests => 10;
-
-BEGIN { use_ok("IkiWiki"); }
-
-%pagesources=(
- foo => "foo.mdwn",
- bar => "bar.mdwn",
- "post/1" => "post/1.mdwn",
- "post/2" => "post/2.mdwn",
- "post/3" => "post/3.mdwn",
-);
-
-is_deeply([use_pagespec("foo", "bar")], ["bar"]);
-is_deeply([sort(use_pagespec("foo", "post/*"))], ["post/1", "post/2", "post/3"]);
-is_deeply([use_pagespec("foo", "post/*", sort => "title", reverse => 1)],
- ["post/3", "post/2", "post/1"]);
-is_deeply([use_pagespec("foo", "post/*", sort => "title", num => 2)],
- ["post/1", "post/2"]);
-is_deeply([use_pagespec("foo", "post/*", sort => "title", num => 50)],
- ["post/1", "post/2", "post/3"]);
-is_deeply([use_pagespec("foo", "post/*", sort => "title",
- limit => sub { $_[0] !~ /3/}) ],
- ["post/1", "post/2"]);
-my $r=eval { use_pagespec("foo", "beep") };
-ok(eval { use_pagespec("foo", "beep") } == 0);
-ok(! $@, "does not fail with error when unable to match anything");
-eval { use_pagespec("foo", "this is not a legal pagespec!") };
-ok($@, "fails with error when pagespec bad");
--
cgit v1.2.3
From 769b78df078d0287a10166ce828941a491858ff2 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 9 Oct 2009 13:02:10 -0400
Subject: pagespec_match_list allow additional pagespec limit parameters again
---
IkiWiki.pm | 12 ++++++++----
doc/plugins/write.mdwn | 7 +++++--
2 files changed, 13 insertions(+), 6 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 475e278c3..f959d868b 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -2019,21 +2019,25 @@ sub pagespec_match_list ($$;@) {
@candidates=reverse(@candidates) if $params{reverse};
+ $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
+
+ # clear params, remainder is passed to pagespec
+ my $num=$params{num};
+ delete @params{qw{num deptype reverse sort limit}};
+
my @matches;
my $firstfail;
my $count=0;
foreach my $p (@candidates) {
- my $r=$sub->($p, location => $page);
+ my $r=$sub->($p, %params, location => $page);
if ($r) {
push @matches, [$p, $r];
- last if defined $params{num} && ++$count == $params{num};
+ last if defined $num && ++$count == $num;
}
elsif (! defined $firstfail) {
$firstfail=$r;
}
}
-
- $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
my @ret;
if (@matches) {
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index f6ea76c36..9661bf4de 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -636,6 +636,9 @@ is significantly more efficient than calling `add_depends` and
`pagespec_match` in a loop. You should use this anytime a plugin
needs to match a set of pages and do something based on that list.
+Unlike pagespec_match, this may throw an error if there is an error in
+the pagespec.
+
Additional named parameters can be specified:
* `deptype` optionally specifies the type of dependency to add. Use the
@@ -650,8 +653,8 @@ Additional named parameters can be specified:
* `list` makes it only match amoung the specified list of pages.
Default is to match amoung all pages in the wiki.
-Unlike pagespec_match, this may throw an error if there is an error in
-the pagespec.
+Any other named parameters are passed on to `pagespec_match`, to further
+limit the match.
#### `add_depends($$;$)`
--
cgit v1.2.3
From 6f2cc5ac8cc7e76b3faf20cd7516f82bcb3de7ed Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 9 Oct 2009 13:20:41 -0400
Subject: pagespec_match_list: change limit to filter
---
IkiWiki.pm | 6 +++---
IkiWiki/Plugin/inline.pm | 2 +-
IkiWiki/Plugin/orphans.pm | 10 +++++-----
IkiWiki/Plugin/postsparkline.pm | 2 +-
doc/plugins/write.mdwn | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index f959d868b..49c76c4d4 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1986,8 +1986,8 @@ sub pagespec_match_list ($$;@) {
if $@ || ! defined $sub;
my @candidates;
- if (exists $params{limit}) {
- @candidates=grep { $params{limit}->($_) } keys %pagesources;
+ if (exists $params{filter}) {
+ @candidates=grep { ! $params{filter}->($_) } keys %pagesources;
}
else {
@candidates=keys %pagesources;
@@ -2023,7 +2023,7 @@ sub pagespec_match_list ($$;@) {
# clear params, remainder is passed to pagespec
my $num=$params{num};
- delete @params{qw{num deptype reverse sort limit}};
+ delete @params{qw{num deptype reverse sort filter}};
my @matches;
my $firstfail;
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 815a37838..0fe0bd2e1 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -218,7 +218,7 @@ sub preprocess_inline (@) {
@list = pagespec_match_list($params{page}, $params{pages},
deptype => deptype($quick ? "presence" : "content"),
- limit => sub { $_[0] ne $params{page} },
+ filter => sub { $_[0] eq $params{page} },
sort => exists $params{sort} ? $params{sort} : "age",
reverse => yesno($params{reverse}),
num => $num,
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index b1ebd1b9d..702943f87 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -31,24 +31,24 @@ sub preprocess (@) {
my @orphans=pagespec_match_list($params{page}, $params{pages},
# update when orphans are added/removed
deptype => deptype("presence"),
- limit => sub {
+ filter => sub {
my $page=shift;
# Filter out pages that other pages link to.
- return 0 if IkiWiki::backlink_pages($page);
+ return 1 if IkiWiki::backlink_pages($page);
# Toplevel index is assumed to never be orphaned.
- return 0 if $page eq 'index';
+ return 1 if $page eq 'index';
# If the page has a link to some other page, it's
# indirectly linked via that page's backlinks.
- return 0 if grep {
+ return 1 if grep {
length $_ &&
($_ !~ /\/\Q$config{discussionpage}\E$/i || ! $config{discussion}) &&
bestlink($page, $_) !~ /^(\Q$page\E|)$/
} @{$links{$page}};
- return 1;
+ return 0;
},
);
diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm
index 1d4532366..0d5a12e33 100644
--- a/IkiWiki/Plugin/postsparkline.pm
+++ b/IkiWiki/Plugin/postsparkline.pm
@@ -56,7 +56,7 @@ sub preprocess (@) {
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
pagespec_match_list($params{page}, $params{pages},
deptype => $deptype,
- limit => sub { $_[0] ne $params{page} },
+ filter => sub { $_[0] eq $params{page} },
);
my @data=eval qq{IkiWiki::Plugin::postsparkline::formula::$formula(\\\%params, \@list)};
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 9661bf4de..2254d7025 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -643,8 +643,8 @@ Additional named parameters can be specified:
* `deptype` optionally specifies the type of dependency to add. Use the
`deptype` function to generate a dependency type.
-* `limit` is a reference to a function, that is called and passed a page,
- and must return true for the page to be included.
+* `filter` is a reference to a function, that is called and passed a page,
+ and returns true if the page should be filtered out of the list.
* `sort` specifies a sort order for the list. See
[[ikiwiki/PageSpec/sorting]] for the avilable sort methods.
* `reverse` if true, sorts in reverse.
--
cgit v1.2.3
From 74409f940d24f51a08becb626e266c91d40d69bd Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 9 Oct 2009 17:15:40 -0400
Subject: add_depends: optimise influence calculation
I made match_* functions whose influences can vary depending on the page
matched set a special "" influence to indicate this.
Then add_depends can try just one page, and if static influences are found,
stop there.
---
IkiWiki.pm | 52 +++++++++++++++++++++++++-------------------------
IkiWiki/Plugin/meta.pm | 6 +++---
doc/plugins/write.mdwn | 2 +-
3 files changed, 30 insertions(+), 30 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index c67a1e138..cd93fe969 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1780,19 +1780,17 @@ sub add_depends ($$;$) {
return 1;
}
- # Analyse the pagespec, and match it against all pages
- # to get a list of influences, and add explicit dependencies
- # for those.
- #my $sub=pagespec_translate($pagespec);
- #return if $@;
- #foreach my $p (keys %pagesources) {
- # my $r=$sub->($p, location => $page );
- # my %i=$r->influences;
- # foreach my $i (keys %i) {
- # $depends_simple{$page}{lc $i} |= $i{$i};
- # }
- #}
- print STDERR "warning: use of add_depends by ".caller()."; influences not tracked\n";
+ # Add explicit dependencies for influences.
+ my $sub=pagespec_translate($pagespec);
+ return if $@;
+ foreach my $p (keys %pagesources) {
+ my $r=$sub->($p, location => $page);
+ my $i=$r->influences;
+ foreach my $k (keys %$i) {
+ $depends_simple{$page}{lc $k} |= $i->{$k};
+ }
+ last if $r->influences_static;
+ }
$depends{$page}{$pagespec} |= $deptype;
return 1;
@@ -2045,9 +2043,9 @@ sub pagespec_match_list ($$;@) {
}
# Add simple dependencies for accumulated influences.
- my %i=$accum->influences;
- foreach my $i (keys %i) {
- $depends_simple{$page}{lc $i} |= $i{$i};
+ my $i=$accum->influences;
+ foreach my $k (keys %$i) {
+ $depends_simple{$page}{lc $k} |= $i->{$k};
}
return @matches;
@@ -2099,12 +2097,14 @@ sub new {
sub influences {
my $this=shift;
- if (! @_) {
- return %{$this->[1]};
- }
- else {
- $this->[1]={@_};
- }
+ $this->[1]={@_} if @_;
+ my %i=%{$this->[1]};
+ delete $i{""};
+ return \%i;
+}
+
+sub influences_static {
+ return ! $_[0][1]->{""};
}
sub merge_influences {
@@ -2173,19 +2173,19 @@ sub match_link ($$;@) {
my $bestlink = IkiWiki::bestlink($from, $link);
foreach my $p (@{$links}) {
if (length $bestlink) {
- return IkiWiki::SuccessReason->new("$page links to $link", $page => $IkiWiki::DEPEND_LINKS)
+ return IkiWiki::SuccessReason->new("$page links to $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
if $bestlink eq IkiWiki::bestlink($page, $p);
}
else {
- return IkiWiki::SuccessReason->new("$page links to page $p matching $link", $page => $IkiWiki::DEPEND_LINKS)
+ return IkiWiki::SuccessReason->new("$page links to page $p matching $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
if match_glob($p, $link, %params);
my ($p_rel)=$p=~/^\/?(.*)/;
$link=~s/^\///;
- return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link", $page => $IkiWiki::DEPEND_LINKS)
+ return IkiWiki::SuccessReason->new("$page links to page $p_rel matching $link", $page => $IkiWiki::DEPEND_LINKS, "" => 1)
if match_glob($p_rel, $link, %params);
}
}
- return IkiWiki::FailReason->new("$page does not link to $link");
+ return IkiWiki::FailReason->new("$page does not link to $link", "" => 1);
}
sub match_backlink ($$;@) {
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index c675880b3..8dcd73a1a 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -291,14 +291,14 @@ sub match {
if (defined $val) {
if ($val=~/^$re$/i) {
- return IkiWiki::SuccessReason->new("$re matches $field of $page", $page => $IkiWiki::DEPEND_CONTENT);
+ return IkiWiki::SuccessReason->new("$re matches $field of $page", $page => $IkiWiki::DEPEND_CONTENT, "" => 1);
}
else {
- return IkiWiki::FailReason->new("$re does not match $field of $page");
+ return IkiWiki::FailReason->new("$re does not match $field of $page", "" => 1);
}
}
else {
- return IkiWiki::FailReason->new("$page does not have a $field");
+ return IkiWiki::FailReason->new("$page does not have a $field", "" => 1);
}
}
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 2254d7025..c72418c3c 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -632,7 +632,7 @@ in the wiki that match the [[ikiwiki/PageSpec]].
The page will automatically be made to depend on the specified
[[ikiwiki/PageSpec]], so `add_depends` does not need to be called. This
-is significantly more efficient than calling `add_depends` and
+is often significantly more efficient than calling `add_depends` and
`pagespec_match` in a loop. You should use this anytime a plugin
needs to match a set of pages and do something based on that list.
--
cgit v1.2.3
From 800d165037ee9bc3362e21048ab07bdd120dcfe0 Mon Sep 17 00:00:00 2001
From: Jogo
Date: Sat, 10 Oct 2009 04:22:41 -0400
Subject:
---
doc/plugins/lockedit/discussion.mdwn | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 doc/plugins/lockedit/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/lockedit/discussion.mdwn b/doc/plugins/lockedit/discussion.mdwn
new file mode 100644
index 000000000..b058b2b07
--- /dev/null
+++ b/doc/plugins/lockedit/discussion.mdwn
@@ -0,0 +1,21 @@
+This plugin not only locks pages but ensures too a user is logged in. This seems to me redundant with signedit. I propose :
+
+ sub canedit ($$) {
+ my $page=shift;
+ my $cgi=shift;
+ my $session=shift;
+
+ my $user=$session->param("name");
+ return undef if defined $user && IkiWiki::is_admin($user);
+
+ if (defined $config{locked_pages} && length $config{locked_pages} &&
+ pagespec_match($page, $config{locked_pages},
+ user => $session->param("name"),
+ ip => $ENV{REMOTE_ADDR},
+ )) {
+ return sprintf(gettext("%s is locked and cannot be edited"),
+ htmllink("", "", $page, noimageinline => 1));
+ }
+
+ return undef;
+ }
--
cgit v1.2.3
From 22ed3f388b6433c512ca7a026d868861ea1990ea Mon Sep 17 00:00:00 2001
From: Jogo
Date: Sun, 11 Oct 2009 04:34:17 -0400
Subject:
---
doc/plugins/contrib/groupfile.mdwn | 105 +++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
create mode 100644 doc/plugins/contrib/groupfile.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/groupfile.mdwn b/doc/plugins/contrib/groupfile.mdwn
new file mode 100644
index 000000000..e5c0ded42
--- /dev/null
+++ b/doc/plugins/contrib/groupfile.mdwn
@@ -0,0 +1,105 @@
+[[!template id=plugin name=groupfile core=0 author="[[Jogo]]"]]
+
+This plugin add a `group(groupname)` function to [[ikiwiki/PageSpec]], which is true
+only if the actual user is member of the group named `groupname`.
+
+Groups membership are read from a file. The syntax of this file is very close to
+usual `/etc/passwd` Unix file : the group's name, followed by a colon, followed by
+a coma separated list of user's names. For exemple :
+
+ dev:toto,foo
+ i18n:zorba
+
+-----
+
+ #!/usr/bin/perl
+ # GroupFile plugin.
+ # by Joseph Boudou
+
+ package IkiWiki::Plugin::groupfile;
+
+ use warnings;
+ use strict;
+ use IkiWiki 3.00;
+
+ sub import {
+ hook(type => 'getsetup', id => 'groups', call => \&get_setup);
+ }
+
+ sub get_setup () {
+ return (
+ plugin => {
+ safe => 0,
+ rebuild => 0,
+ },
+ group_file => {
+ type => 'string',
+ example => '/etc/ikiwiki/group',
+ description => 'group file location',
+ safe => 0,
+ rebuild => 0,
+ },
+ );
+ }
+
+ my $users_of = 0;
+
+ sub get_groups () {
+ if (not $users_of) {
+
+ if (not defined $config{group_file}) {
+ return 'group_file option not set';
+ }
+
+ open my $file, '<', $config{group_file}
+ or return 'Unable to open group_file';
+
+ $users_of = {};
+ READ:
+ while (<$file>) {
+ next READ if (/^\s*$/);
+
+ if (/^(\w+):([\w,]+)/) {
+ %{ $users_of->{$1} } = map { $_ => 1 } split /,/, $2;
+ }
+ else {
+ $users_of = "Error at group_file:$.";
+ last READ;
+ }
+ }
+
+ close $file;
+ }
+
+ return $users_of;
+ }
+
+ package IkiWiki::PageSpec;
+
+ sub match_group ($$;@) {
+ shift;
+ my $group = shift;
+ my %params = @_;
+
+ if (not exists $params{user}) {
+ return IkiWiki::ErrorReason->new('no user specified');
+ }
+ if (not defined $params{user}) {
+ return IkiWiki::FailReason->new('not logged in');
+ }
+
+ my $users_of = IkiWiki::Plugin::groupfile::get_groups();
+ if (not ref $users_of) {
+ return IkiWiki::ErrorReason->new($users_of);
+ }
+
+ if (exists $users_of->{$group}{ $params{user} }) {
+ return IkiWiki::SuccessReason->new("user is member of $group");
+ }
+ else {
+ return IkiWiki::FailReason->new(
+ "user $params{user} isn't member of $group");
+ }
+ }
+
+ 1
--
cgit v1.2.3
From 5dba91cdc88c01ac1d314f24b12eb2cda651e206 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 11 Oct 2009 13:51:23 -0400
Subject: typo
---
doc/plugins/calendar.mdwn | 2 +-
t/pagespec_match_result.t | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn
index d695762b7..8ade70004 100644
--- a/doc/plugins/calendar.mdwn
+++ b/doc/plugins/calendar.mdwn
@@ -6,7 +6,7 @@ The directive displays a calendar, similar to the typical calendars shown on
some blogs.
Since ikiwiki is a wiki compiler, to keep the calendar up-to-date,
-wikis that include it need to be periodically refreshes, typically by cron
+wikis that include it need to be periodically refreshed, typically by cron
at midnight. Example crontab:
0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh
diff --git a/t/pagespec_match_result.t b/t/pagespec_match_result.t
index d9c31d6f0..c2112bf14 100755
--- a/t/pagespec_match_result.t
+++ b/t/pagespec_match_result.t
@@ -57,3 +57,21 @@ ok(! $s->influences->{foo}, "removed 0 influence");
ok(! $s->influences->{bar}, "removed 1 influence");
ok($s->influences->{baz}, "set influence");
ok($s->influences_static);
+
+# influence blocking
+my $r=F()->block & S(foo => 1);
+ok(! $r->influences->{foo}, "failed blocker & influence -> does not pass");
+$r=F()->block | S(foo => 1);
+ok($r->influences->{foo}, "failed blocker | influence -> does pass");
+$r=S(foo => 1) & F()->block;
+ok(! $r->influences->{foo}, "influence & failed blocker -> does not pass");
+$r=S(foo => 1) | F()->block;
+ok($r->influences->{foo}, "influence | failed blocker -> does pass");
+$r=S(foo => 1) & F()->block & S(foo => 2);
+ok(! $r->influences->{foo}, "influence & failed blocker & influence -> does not pass");
+$r=S(foo => 1) | F()->block | S(foo => 2);
+ok($r->influences->{foo}, "influence | failed blocker | influence -> does pass");
+$r=S()->block & S(foo => 1);
+ok($r->influences->{foo}, "successful blocker -> does pass");
+$r=(! S()->block) & S(foo => 1);
+ok(! $r->influences->{foo}, "! successful blocker -> failed blocker");
--
cgit v1.2.3
From 5cddd8a0a3b1b42dd3a92eb4f839679c12ddf97e Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 11 Oct 2009 16:04:03 -0400
Subject: typo
---
doc/plugins/calendar.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn
index d695762b7..8ade70004 100644
--- a/doc/plugins/calendar.mdwn
+++ b/doc/plugins/calendar.mdwn
@@ -6,7 +6,7 @@ The directive displays a calendar, similar to the typical calendars shown on
some blogs.
Since ikiwiki is a wiki compiler, to keep the calendar up-to-date,
-wikis that include it need to be periodically refreshes, typically by cron
+wikis that include it need to be periodically refreshed, typically by cron
at midnight. Example crontab:
0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh
--
cgit v1.2.3
From e1939185d29e1431861e63d6526cb3a498d6033e Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 11 Oct 2009 16:42:49 -0400
Subject: ikiwiki-calendar: New command automates creation of archive pages
using the calendar plugin.
---
debian/changelog | 7 +++++
doc/examples/blog.mdwn | 4 +++
doc/ikiwiki-calendar.mdwn | 51 ++++++++++++++++++++++++++++++++
doc/ikiwiki/directive/calendar.mdwn | 29 ++++++++++++------
doc/plugins/calendar.mdwn | 8 ++---
ikiwiki-calendar | 59 +++++++++++++++++++++++++++++++++++++
templates/calendarmonth.tmpl | 3 ++
templates/calendaryear.tmpl | 1 +
8 files changed, 147 insertions(+), 15 deletions(-)
create mode 100644 doc/ikiwiki-calendar.mdwn
create mode 100755 ikiwiki-calendar
create mode 100644 templates/calendarmonth.tmpl
create mode 100644 templates/calendaryear.tmpl
(limited to 'doc/plugins')
diff --git a/debian/changelog b/debian/changelog
index a79faf7fb..22935955a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ikiwiki (3.20091010) UNRELEASED; urgency=low
+
+ * ikiwiki-calendar: New command automates creation of archive pages
+ using the calendar plugin.
+
+ -- Joey Hess Sun, 11 Oct 2009 15:54:45 -0400
+
ikiwiki (3.20091009) unstable; urgency=low
* parentlinks: Add has_parentlinks template parameter to allow styling
diff --git a/doc/examples/blog.mdwn b/doc/examples/blog.mdwn
index 2155d7fea..f542cad0c 100644
--- a/doc/examples/blog.mdwn
+++ b/doc/examples/blog.mdwn
@@ -23,3 +23,7 @@ Some additional configuration you might want to do:
enable comments to posts to the blog:
comments_pagespec => 'blog/posts/* and !*/Discussion',
+
+* Enable the [[calendar|plugins/calendar]] plugin and run the
+ [[ikiwiki-calendar]] command from cron daily to get an interlinked
+ set of calendar archives.
diff --git a/doc/ikiwiki-calendar.mdwn b/doc/ikiwiki-calendar.mdwn
new file mode 100644
index 000000000..e2cc612f3
--- /dev/null
+++ b/doc/ikiwiki-calendar.mdwn
@@ -0,0 +1,51 @@
+# NAME
+
+ikiwiki-calendar - create calendar archive pages
+
+# SYNOPSIS
+
+ikiwiki-calendar [-f] your.setup [pagespec] [year]
+
+# DESCRIPTION
+
+`ikiwiki-calendar` creates pages that use the [[ikiwiki/directive/calendar]]
+directive, allowing the archives to be browsed one month
+at a time, with calendar-based navigation.
+
+You must specify the setup file for your wiki. The pages will
+be created inside its `srcdir`, beneath the `archivebase`
+directory used by the calendar plugin (default "archives").
+
+You will probably want to specify a [[ikiwiki/PageSpec]]
+to control which pages are included on the calendars. The
+default is all pages. To limit it to only posts in a blog,
+use something like "posts/* and !*/Discussion".
+
+It defaults to creating calendar pages for the current
+year, as well as the previous year, and the next year.
+If you specify a year, it will create pages for that year.
+
+Existing pages will not be overwritten by this command by default.
+Use the `-f` switch to force it to overwrite any existing pages.
+
+## CRONTAB
+
+While this command only needs to be run once a year to update
+the archive pages for each new year, you are recommended to set up
+a cron job to run it daily, at midnight. Then it will also update
+the calendars to highlight the current day.
+
+An example crontab:
+
+ 0 0 * * * ikiwiki-calendar ~/ikiwiki.setup "posts/* and !*/Discussion"
+
+# TEMPLATES
+
+This command uses two [[template|wikitemplates]] to generate
+the pages, `calendarmonth.tmpl` and `calendaryear.tmpl`.
+
+# AUTHOR
+
+Joey Hess
+
+Warning: this page is automatically made into ikiwiki-calendar's man page, edit with care
diff --git a/doc/ikiwiki/directive/calendar.mdwn b/doc/ikiwiki/directive/calendar.mdwn
index 8a257d6eb..b2ac75b11 100644
--- a/doc/ikiwiki/directive/calendar.mdwn
+++ b/doc/ikiwiki/directive/calendar.mdwn
@@ -1,5 +1,4 @@
The `calendar` directive is supplied by the [[!iki plugins/calendar desc=calendar]] plugin.
-This plugin requires extra setup. See the plugin documentation for details.
This directive displays a calendar, similar to the typical calendars shown on
some blogs.
@@ -12,16 +11,28 @@ some blogs.
\[[!calendar type="year" year="2005" pages="blog/* and !*/Discussion"]]
+## setup
+
The calendar is essentially a fancy front end to archives of previous
pages, usually used for blogs. It can produce a calendar for a given month,
-or a list of months for a given year.
-
-The month format calendar simply links to any page posted on each
-day of the month. The year format calendar links to archive pages, with
-names like `archives/2007` (for all of 2007) and `archives/2007/01`
-(for January, 2007). For this to work, you'll need to create these archive
-pages. They typically use [[inline]] to display or list pages created in
-the given time frame.
+or a list of months for a given year. The month format calendar simply
+links to any page posted on each day of the month. The year format calendar
+links to archive pages, with names like `archives/2007` (for all of 2007)
+and `archives/2007/01` (for January, 2007).
+
+While you can insert calendar directives anywhere on your wiki, including
+in the sidebar, you'll also need to create these archive pages. They
+typically use this directive to display a calendar, and also use [[inline]]
+to display or list pages created in the given time frame.
+
+The `ikiwiki-calendar` command can be used to automatically generate the
+archive pages. It also refreshes the wiki, updating the calendars to
+highlight the current day. This command is typically run at midnight from
+cron. An example crontab:
+
+An example crontab:
+
+ 0 0 * * * ikiwiki-calendar ~/ikiwiki.setup "posts/* and !*/Discussion"
## usage
diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn
index 8ade70004..bc1bc6c71 100644
--- a/doc/plugins/calendar.mdwn
+++ b/doc/plugins/calendar.mdwn
@@ -3,13 +3,9 @@
This plugin provides a [[ikiwiki/directive/calendar]] [[ikiwiki/directive]].
The directive displays a calendar, similar to the typical calendars shown on
-some blogs.
+some blogs.
-Since ikiwiki is a wiki compiler, to keep the calendar up-to-date,
-wikis that include it need to be periodically refreshed, typically by cron
-at midnight. Example crontab:
-
- 0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh
+The [[ikiwiki-calendar]] command is used to keep the calendar up-to-date.
## CSS
diff --git a/ikiwiki-calendar b/ikiwiki-calendar
new file mode 100755
index 000000000..ec572cb7c
--- /dev/null
+++ b/ikiwiki-calendar
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use IkiWiki;
+use IkiWiki::Setup;
+use Getopt::Long;
+
+sub usage () {
+ die gettext("usage: ikiwiki-calendar [-f] your.setup [pagespec] [year]"), "\n";
+}
+
+my $force=0;
+GetOptions(
+ "force" => \$force,
+) || usage();
+my $setup=shift || usage();
+my $pagespec=shift || "*";
+my $year=shift || 1900+(localtime(time))[5];
+
+%config=IkiWiki::defaultconfig();
+IkiWiki::Setup::load($setup);
+IkiWiki::loadplugins();
+IkiWiki::checkconfig();
+
+my $archivebase = 'archives';
+$archivebase = $config{archivebase} if defined $config{archivebase};
+
+sub writearchive ($$;$) {
+ my $template=template(shift);
+ my $year=shift;
+ my $month=shift;
+
+ my $page=defined $month ? "$year/$month" : $year;
+
+ my $pagefile=newpagefile("$archivebase/$page", $config{default_pageext});
+ $template->param(pagespec => $pagespec);
+ $template->param(year => $year);
+ $template->param(month => $month) if defined $month;
+
+ if ($force || ! -e "$config{srcdir}/$pagefile") {
+ writefile($pagefile, $config{srcdir}, $template->output);
+ IkiWiki::rcs_add($pagefile) if $config{rcs};
+ }
+}
+
+IkiWiki::lockwiki();
+
+foreach my $y ($year-1, $year, $year+1) {
+ writearchive("calendaryear.tmpl", $y);
+ foreach my $m (qw{01 02 03 04 05 06 07 08 09 10 11 12}) {
+ writearchive("calendarmonth.tmpl", $y, $m);
+ }
+}
+
+IkiWiki::rcs_commit_staged(gettext("calendar update"), undef, undef)
+ if $config{rcs};
+IkiWiki::unlockwiki();
+
+system("ikiwiki", "-setup", $setup, "-refresh");
diff --git a/templates/calendarmonth.tmpl b/templates/calendarmonth.tmpl
new file mode 100644
index 000000000..37ad78c5c
--- /dev/null
+++ b/templates/calendarmonth.tmpl
@@ -0,0 +1,3 @@
+[[!calendar type=month month= year= pages=""]]
+
+[[!inline pages="creation_month() and creation_year() and " show=0 feeds=no reverse=yes]]
diff --git a/templates/calendaryear.tmpl b/templates/calendaryear.tmpl
new file mode 100644
index 000000000..714bd6d47
--- /dev/null
+++ b/templates/calendaryear.tmpl
@@ -0,0 +1 @@
+[[!calendar type=year year= pages=""]]
--
cgit v1.2.3
From 6993d1f905c35bbad415d3f60cde924da32e80a4 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 11 Oct 2009 22:58:17 -0400
Subject: response
---
doc/plugins/lockedit/discussion.mdwn | 27 +++++++--------------------
1 file changed, 7 insertions(+), 20 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/lockedit/discussion.mdwn b/doc/plugins/lockedit/discussion.mdwn
index b058b2b07..8a08edaad 100644
--- a/doc/plugins/lockedit/discussion.mdwn
+++ b/doc/plugins/lockedit/discussion.mdwn
@@ -1,21 +1,8 @@
-This plugin not only locks pages but ensures too a user is logged in. This seems to me redundant with signedit. I propose :
+This plugin not only locks pages but ensures too a user is logged in. This
+seems to me redundant with signedit. I propose [removing the if block that
+calls needsignin ].
- sub canedit ($$) {
- my $page=shift;
- my $cgi=shift;
- my $session=shift;
-
- my $user=$session->param("name");
- return undef if defined $user && IkiWiki::is_admin($user);
-
- if (defined $config{locked_pages} && length $config{locked_pages} &&
- pagespec_match($page, $config{locked_pages},
- user => $session->param("name"),
- ip => $ENV{REMOTE_ADDR},
- )) {
- return sprintf(gettext("%s is locked and cannot be edited"),
- htmllink("", "", $page, noimageinline => 1));
- }
-
- return undef;
- }
+> That was added because the most typical reason for being unable to edit a
+> page is that you are not logged in. And without the jump to logging the
+> user in, there is no way for the user to log in, without navigating away
+> from the page they were trying to edit. --[[Joey]]
--
cgit v1.2.3
From 7272938a116b2c87f8c34057034b5f4e9244cdf8 Mon Sep 17 00:00:00 2001
From: Jogo
Date: Mon, 12 Oct 2009 16:44:12 -0400
Subject:
---
doc/plugins/lockedit/discussion.mdwn | 10 ++++++++++
1 file changed, 10 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/lockedit/discussion.mdwn b/doc/plugins/lockedit/discussion.mdwn
index 8a08edaad..867fc6a51 100644
--- a/doc/plugins/lockedit/discussion.mdwn
+++ b/doc/plugins/lockedit/discussion.mdwn
@@ -6,3 +6,13 @@ calls needsignin ].
> page is that you are not logged in. And without the jump to logging the
> user in, there is no way for the user to log in, without navigating away
> from the page they were trying to edit. --[[Joey]]
+
+>> Ok, but the problem is that when you don't want any signin form you end up
+>> with a lone login button. That might happend if you lock pages only on IP
+>> adresses, if you use another cookie from another webapp...
+
+>> That happends to me and I had to reimplement lockedit in my private auth
+>> plugin.
+
+>> Perhaps you could return undef on that case and let another plugin do the
+>> needsignin call ? -- [[Jogo]]
--
cgit v1.2.3
From 7e25c2116cc2ababf7b099e1044dee619837dd23 Mon Sep 17 00:00:00 2001
From: "http://schmonz.livejournal.com/"
Date: Tue, 13 Oct 2009 20:51:43 -0400
Subject: .htaccess hack
---
doc/plugins/rsync/discussion.mdwn | 2 ++
1 file changed, 2 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/rsync/discussion.mdwn b/doc/plugins/rsync/discussion.mdwn
index 6bf7a3826..ef0fa9967 100644
--- a/doc/plugins/rsync/discussion.mdwn
+++ b/doc/plugins/rsync/discussion.mdwn
@@ -47,6 +47,8 @@ The wiki now lives on (1), and clicking "edit" just works. --[[schmonz]]
>> a DVCS (of which I've got at least one other), and possibly for
>> other uses not yet imagined. ;-) --[[schmonz]]
+>>> I'm now using this plugin for an additional purpose. One of the aforementioned wikis (there are actually two) can only be read by trusted users, the list of which is kept in an `.htaccess` file. I added it to git as `htaccess.txt`, enabled the [[plugins/txt]] plugin, and in my `rsync_command` script, have it copied to the destdir as `.htaccess` before calling `rsync`. Now my users (who aren't tech-savvy, but are trustworthy) can edit the access list directly in the wiki. This idea might also be useful for wikis not using `rsync` at all. --[[schmonz]]
+
----
Revew: --[[Joey]]
--
cgit v1.2.3
From cd5bf7eb7f74c2414a87c77141ed0c502ff7f464 Mon Sep 17 00:00:00 2001
From: "http://smcv.pseudorandom.co.uk/"
Date: Thu, 15 Oct 2009 23:16:52 -0400
Subject: comments after trying to implement joey's idea
---
doc/plugins/contrib/album/discussion.mdwn | 134 ++++++++++++++++++++++++++----
1 file changed, 119 insertions(+), 15 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/album/discussion.mdwn b/doc/plugins/contrib/album/discussion.mdwn
index 5c8e74fa6..156cd7ad8 100644
--- a/doc/plugins/contrib/album/discussion.mdwn
+++ b/doc/plugins/contrib/album/discussion.mdwn
@@ -68,6 +68,9 @@ code or tried it yet, but here goes. --[[Joey]]
> you (since the requirements for that CGI interface change depending
> on the implementation). I agree that this is ugly, though. -s
+>> Would you accept a version where the albumimage "viewer" pages
+>> could be 0 bytes long, at least until metadata gets added? -s
+
* With each viewer page having next/prev links, I can see how you
were having the scalability issues with ikiwiki's data structures
earlier!
@@ -80,7 +83,7 @@ code or tried it yet, but here goes. --[[Joey]]
>> these can be presence dependencies, which will probably help with
>> avoiding rebuilds of a page if the next/prev page is changed.
>> (Unless you use img to make the thumbnails for those links, then it
->> would rebuild the thumbnails anyway. Have not looked at the code.) --[[Joey]]
+>> would rebuild the thumbnails anyway. Have not looked at the code.) --[[Joey]]
* And doesn't each viewer page really depend on every other page in the
same albumsection? If a new page is added, the next/prev links
@@ -108,6 +111,11 @@ code or tried it yet, but here goes. --[[Joey]]
>> metadata. Er, I mean, I have a cheezy hack in `add_depends` now that does
>> it to deal with a similar case. --[[Joey]]
+>>> I think I was misunderstanding how early you have to call `add_depends`?
+>>> The critical thing I missed was that if you're scanning a page, you're
+>>> going to rebuild it in a moment anyway, so it doesn't matter if you
+>>> have no idea what it depends on until the rebuild phase. -s
+
* One thing I do like about having individual pages per image is
that they can each have their own comments, etc.
@@ -121,9 +129,25 @@ code or tried it yet, but here goes. --[[Joey]]
album. Think tags. So it seems it would be better to have the album
directive control what pages it includes (a la inline).
-> See note above about pagespecs not being very safe early on.
-> You did merge my inline-with-pagenames feature, which is safe to use
-> at scan time, though.
+> I'm inclined to fix this by constraining images to be subpages of exactly
+> one album: if they're subpages of 2+ nested albums then they're only
+> considered to be in the deepest-nested one (i.e. longest URL), and if
+> they're not in any album then that's a usage error. This would
+> also make prev/next links sane.
+>
+> If you want to reference images from elsewhere in the wiki and display
+> them as if in an album, then you can use an ordinary inline with
+> the same template that the album would use, and I'll make sure the
+> templates are set up so this works.
+>
+> (Implementation detail: this means that an image X/Y/Z/W/V, where X and
+> Y are albums, Z does not exist and W exists but is not an album,
+> would have a content dependency on Y, a presence dependency on Z
+> and a content dependency on W.)
+>
+> Perhaps I should just restrict to having the album images be direct
+> subpages of the album, although that would mean breaking some URLs
+> on the existing website I'm doing all this work for... -s
* Putting a few of the above thoughts together, my ideal album system
seems to be one where I can just drop the images into a directory and
@@ -137,15 +161,57 @@ code or tried it yet, but here goes. --[[Joey]]
> Putting a JPEG in the web form is not an option from my point of
> view :-) but perhaps there could just be a "web-editable" flag supplied
> by plugins, and things could be changed to respect it.
->
+
+>> Replying to myself: would you accept patches to support
+>> `hook(type => 'htmlize', editable => 0, ...)` in editpage? This would
+>> essentially mean "this is an opaque binary: you can delete it
+>> or rename it, and it might have its own special editing UI, but you
+>> can never get it in a web form".
+>>
+>> On the other hand, that essentially means we need to reimplement
+>> editpage in order to edit the sidecar files that contain the metadata.
+>> Having already done one partial reimplementation of editpage (for
+>> comments) I'm in no hurry to do another.
+>>
+>> I suppose another possibility would be to register hook
+>> functions to be called by editpage when it loads and saves the
+>> file. In this case, the loading hook would be to discard
+>> the binary and use filter() instead, and the saving conversion
+>> would be to write the edited content into the metadata sidecar
+>> (creating it if necessary).
+>>
+>> I'd also need to make editpage (and also comments!) not allow the
+>> creation of a file of type albumjpg, albumgif etc., which is something
+>> I previously missed; and I'd need to make attachment able to
+>> upload-and-rename.
+>> -s
+
> In a way, what you really want for metadata is to have it in the album
> page, so you can batch-edit the whole lot by editing one file (this
> does mean that editing the album necessarily causes each of its viewers
> to be rebuilt, but in practice that happens anyway). -s
->
->> Yes, that would make some sense.. It also allows putting one image in
->> two albums, with different caption etc. (Maybe for different audiences.)
+
+>> Replying to myself: in practice that *doesn't* happen anyway. Having
+>> the metadata in the album page is somewhat harmful because it means
+>> that changing the title of one image causes every viewer in the album
+>> to be rebuilt, whereas if you have a metadata file per image, only
+>> the album itself, plus the next and previous viewers, need
+>> rebuilding. So, I think a file per image is the way to go.
>>
+>> Ideally we'd have some way to "batch-edit" the metadata of all
+>> images in an album at once, except that would make conflict
+>> resolution much more complicated to deal with; maybe just
+>> give up and scream about mid-air collisions in that case?
+>> (That's apparently good enough for Bugzilla, but not really
+>> for ikiwiki). -s
+
+>> Yes, [all metadata in one file] would make some sense.. It also allows putting one image in
+>> two albums, with different caption etc. (Maybe for different audiences.)
+>> --[[Joey]]
+
+>>> Eek. No, that's not what I had in mind at all; the metadata ends up
+>>> in the "viewer" page, so it's necessarily the same for all albums. -s
+
>> It would probably be possible to add a new dependency type, and thus
>> make ikiwiki smart about noticing whether the metadata has actually
>> changed, and only update those viewers where it has. But the dependency
@@ -164,23 +230,26 @@ mushroom and snake.
> etc as the htmlize extensions. May need some fixes to ikiwiki to support
> that. --[[Joey]]
+>> foo.albumjpg (etc.) for images, and foo._albummeta (with
+>> `keepextension => 1`) for sidecar metadata files, seems viable. -s
+
Files in git repo:
* index.mdwn
* memes.mdwn
-* memes/badger.albumimage (a renamed JPEG)
+* memes/badger.albumjpg (a renamed JPEG)
* memes/badger/comment_1._comment
* memes/badger/comment_2._comment
-* memes/mushroom.albumimage (a renamed GIF)
-* memes/mushroom.meta (sidecar file with metadata)
-* memes/snake.albumimage (a renamed video)
+* memes/mushroom.albumgif (a renamed GIF)
+* memes/mushroom._albummeta (sidecar file with metadata)
+* memes/snake.albummov (a renamed video)
Files in web content:
* index.html
* memes/index.html
* memes/96x96-badger.jpg (from img)
-* memes/96x96-mushroom.jpg (from img)
+* memes/96x96-mushroom.gif (from img)
* memes/96x96-snake.jpg (from img, hacked up to use totem-video-thumbnailer :-) )
* memes/badger/index.html (including comments)
* memes/badger.jpg
@@ -200,10 +269,28 @@ way to get them rendered anyway.
> the image, as well as eg, smiley trying to munge it in sanitize.
> --[[Joey]]
+>> As long as nothing has a filter() hook that assumes it's already
+>> text... filters are run in arbitrary order. We seem to be OK so far
+>> though.
+>>
+>> If this is the route I take, I propose to have the result of filter()
+>> be the contents of the sidecar metadata file (empty string if none),
+>> with the `\[[!albumimage]]` directive (which no longer requires
+>> arguments) prepended if not already present. This would mean that
+>> meta directives in the metadata file would work as normal, and it
+>> would be possible to insert text both before and after the viewer
+>> if desired. The result of filter() would also be a sensible starting
+>> point for editing, and the result of editing could be diverted into
+>> the metadata file. -s
+
do=edit&page=memes/badger needs to not put the JPG in a text box: somehow
divert or override the normal edit CGI by telling it that .albumimage
files are not editable in the usual way?
+> Something I missed here is that editpage also needs to be told that
+> creating new files of type albumjpg, albumgif etc. is not allowed
+> either! -s
+
Every image needs to depend on, and link to, the next and previous images,
which is a bit tricky. In previous thinking about this I'd been applying
the overly strict constraint that the ordered sequence of pages in each
@@ -217,6 +304,9 @@ in order.
> memoization to avoid each image in an album building the same list.
> I sense that I may be missing a subtelty though. --[[Joey]]
+>> I think I was misunderstanding how early you have to call `add_depends`
+>> as mentioned above. -s
+
Perhaps restricting to "the images in an album A must match A/*"
would be useful; then the unordered superset could just be "A/*". Your
"albums via tags" idea would be nice too though, particularly for feature
@@ -233,6 +323,9 @@ album, or something?
> Ugh, yeah, that is a problem. Perhaps wanting to support that was just
> too ambitious. --[[Joey]]
+>> I propose to restrict to having images be subpages of albums, as
+>> described above. -s
+
Requiring renaming is awkward for non-technical Windows/Mac users, with both
platforms' defaults being to hide extensions; however, this could be
circumvented by adding some sort of hook in attachment to turn things into
@@ -244,13 +337,24 @@ extensions visible is a "don't do that then" situation :-)
> with an extension. (Or allow specifying a full pagespec,
> but I hesitate to seriously suggest that.) --[[Joey]]
+>> I think that might be a terrifying idea for another day. If we can
+>> mutate the extension during the `attach` upload, that'd be enough;
+>> I don't think people who are skilled enough to use git/svn/...,
+>> but not skilled enough to tell Explorer to show file extensions,
+>> represent a major use case. -s
+
Ideally attachment could also be configured to upload into a specified
underlay, so that photos don't have to be in your source-code control
(you might want that, but I don't!).
+> Replying to myself: perhaps best done as an orthogonal extension
+> to attach? -s
+
Things that would be nice, and are probably possible:
* make the "Edit page" link on viewers divert to album-specific CGI instead
- of just failing or not appearing
+ of just failing or not appearing (probably possible via pagetemplate)
+
* some way to deep-link to memes/badger.jpg with a wikilink, without knowing a
- priori that it's secretly a JPEG
+ priori that it's secretly a JPEG (probably harder than it looks - you'd
+ have to make a directive for it and it's probably not worth it)
--
cgit v1.2.3
From 969ce8c5f889f8f2696c3ed4995f021b2a6539e1 Mon Sep 17 00:00:00 2001
From: "http://smcv.pseudorandom.co.uk/"
Date: Thu, 15 Oct 2009 23:22:18 -0400
Subject: add a bit more attribution so it's clearer what Joey wrote
---
doc/plugins/contrib/album/discussion.mdwn | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/album/discussion.mdwn b/doc/plugins/contrib/album/discussion.mdwn
index 156cd7ad8..50d6c8ddd 100644
--- a/doc/plugins/contrib/album/discussion.mdwn
+++ b/doc/plugins/contrib/album/discussion.mdwn
@@ -60,7 +60,7 @@ code or tried it yet, but here goes. --[[Joey]]
* Needing to create the albumimage "viewer" pages for each photo
seems like it will become a pain. Everyone will need to come up
with their own automation for it, and then there's the question
- of how to automate it when uploading attachments.
+ of how to automate it when uploading attachments. -J
> There's already a script (ikiwiki-album) to populate a git
> checkout with skeleton "viewer" pages; I was planning to make a
@@ -73,7 +73,7 @@ code or tried it yet, but here goes. --[[Joey]]
* With each viewer page having next/prev links, I can see how you
were having the scalability issues with ikiwiki's data structures
- earlier!
+ earlier! -J
> Yeah, I think they're a basic requirement from a UI point of view
> though (although they don't necessarily have to be full wikilinks).
@@ -88,7 +88,7 @@ code or tried it yet, but here goes. --[[Joey]]
* And doesn't each viewer page really depend on every other page in the
same albumsection? If a new page is added, the next/prev links
may need to be updated, for example. If so, there will be much
- unnecessary rebuilding.
+ unnecessary rebuilding. -J
> albumsections are just a way to insert headings into the flow of
> photos, so they don't actually affect dependencies.
@@ -117,7 +117,7 @@ code or tried it yet, but here goes. --[[Joey]]
>>> have no idea what it depends on until the rebuild phase. -s
* One thing I do like about having individual pages per image is
- that they can each have their own comments, etc.
+ that they can each have their own comments, etc. -J
> Yes; also, they can be wikilinked. I consider those to be
> UI requirements. -s
@@ -127,7 +127,7 @@ code or tried it yet, but here goes. --[[Joey]]
album, but then anyone who can write to any other page on the wiki can
add an image to it. 2: I may want an image to appear in more than one
album. Think tags. So it seems it would be better to have the album
- directive control what pages it includes (a la inline).
+ directive control what pages it includes (a la inline). -J
> I'm inclined to fix this by constraining images to be subpages of exactly
> one album: if they're subpages of 2+ nested albums then they're only
@@ -156,7 +156,7 @@ code or tried it yet, but here goes. --[[Joey]]
etc. (Real pity we can't just put arbitrary metadata into the images
themselves.) This is almost pointing toward making the images first-class
wiki page sources. Hey, it worked for po! :) But the metadata and editing
- problems probably don't really allow that.
+ problems probably don't really allow that. -J
> Putting a JPEG in the web form is not an option from my point of
> view :-) but perhaps there could just be a "web-editable" flag supplied
--
cgit v1.2.3
From bc4b8e4e239e56fedcc3cf065f7c6cbd224f7525 Mon Sep 17 00:00:00 2001
From: "http://smcv.pseudorandom.co.uk/"
Date: Thu, 15 Oct 2009 23:27:53 -0400
Subject: not another hidden requirement...
---
doc/plugins/contrib/album/discussion.mdwn | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/album/discussion.mdwn b/doc/plugins/contrib/album/discussion.mdwn
index 50d6c8ddd..9720589b4 100644
--- a/doc/plugins/contrib/album/discussion.mdwn
+++ b/doc/plugins/contrib/album/discussion.mdwn
@@ -69,7 +69,16 @@ code or tried it yet, but here goes. --[[Joey]]
> on the implementation). I agree that this is ugly, though. -s
>> Would you accept a version where the albumimage "viewer" pages
->> could be 0 bytes long, at least until metadata gets added? -s
+>> could be 0 bytes long, at least until metadata gets added?
+>>
+>> The more I think about the "binaries as first-class pages" approach,
+>> the more subtle interactions I notice with other plugins. I
+>> think I'm up to needing changes to editpage, comments, attachment
+>> and recentchanges, plus adjustments to img and Render (to reduce
+>> duplication when thumbnailing an image with a strange extension
+>> while simultaneously changing the extension, and to hardlink/copy
+>> an image with a strange extension to a differing target filename
+>> with the normal extension, respectively). -s
* With each viewer page having next/prev links, I can see how you
were having the scalability issues with ikiwiki's data structures
@@ -350,6 +359,10 @@ underlay, so that photos don't have to be in your source-code control
> Replying to myself: perhaps best done as an orthogonal extension
> to attach? -s
+> Yet another non-obvious thing this design would need to do is to find
+> some way to have each change to memes/badger._albummeta show up as a
+> change to memes/badger in `recentchanges`. -s
+
Things that would be nice, and are probably possible:
* make the "Edit page" link on viewers divert to album-specific CGI instead
--
cgit v1.2.3
From 002b6d2c41300052a056f4f95f417d5d0667f5ce Mon Sep 17 00:00:00 2001
From: tschwinge
Date: Fri, 16 Oct 2009 03:19:55 -0400
Subject: shortcuts: local file.
---
doc/plugins/shortcut/discussion.mdwn | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn
index 4e11ce08c..2e2b1b281 100644
--- a/doc/plugins/shortcut/discussion.mdwn
+++ b/doc/plugins/shortcut/discussion.mdwn
@@ -9,4 +9,10 @@ Maybe use the `default_pageext` is better than hardcode .mdwn?
> done, it will use `default_pageext` now --[[Joey]]
+---
+Instead of modifying the [[basewiki]]'s [[shortcuts]] file for local needs --
+thus copying it at some point and losing continuity with upstream enhancements --
+what about handling a `shortcuts-local.mdwn` or `shortcuts/local.mdwn` (if such
+a file exists in the wiki), and additionally process that one. Possibily a
+conditional `\[[!inline]]` could be used. --[[tschwinge]]
--
cgit v1.2.3
From 8dfd5289a970e2a77499a2178c493c2c233ba27e Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 26 Oct 2009 13:24:27 -0400
Subject: moderatedcomments: New plugin to allow comment moderation w/o relying
on blogspam.net.
---
IkiWiki/Plugin/moderatedcomments.pm | 44 +++++++++++++++++++++++++++++++++++++
debian/changelog | 2 ++
doc/plugins/comments.mdwn | 3 ++-
doc/plugins/moderatedcomments.mdwn | 10 +++++++++
4 files changed, 58 insertions(+), 1 deletion(-)
create mode 100644 IkiWiki/Plugin/moderatedcomments.pm
create mode 100644 doc/plugins/moderatedcomments.mdwn
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/moderatedcomments.pm b/IkiWiki/Plugin/moderatedcomments.pm
new file mode 100644
index 000000000..2555927b7
--- /dev/null
+++ b/IkiWiki/Plugin/moderatedcomments.pm
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::moderatedcomments;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+ hook(type => "getsetup", id => "moderatedcomments", call => \&getsetup);
+ hook(type => "checkcontent", id => "moderatedcomments", call => \&checkcontent);
+}
+
+sub getsetup () {
+ return
+ plugin => {
+ safe => 1,
+ rebuild => 0,
+ },
+ moderate_users => {
+ type => 'boolean',
+ example => 1,
+ description => 'Moderate comments of logged-in users?',
+ safe => 1,
+ rebuild => 0,
+ },
+}
+
+sub checkcontent (@) {
+ my %params=@_;
+
+ # only handle comments
+ return undef unless pagespec_match($params{page}, "postcomment(*)",
+ location => $params{page});
+
+ # admins and maybe users can comment w/o moderation
+ my $session=$params{session};
+ my $user=$session->param("name") if $session;
+ return undef if defined $user && (IkiWiki::is_admin($user) ||
+ (exists $config{moderate_users} && ! $config{moderate_users}));
+
+ return gettext("comment needs moderation");
+}
+
+1
diff --git a/debian/changelog b/debian/changelog
index 336924317..f517111b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ ikiwiki (3.20091024) UNRELEASED; urgency=low
* po: Fix breakage caused by changes to render code.
* mdwn: Avoid trying to use multimarkdown if it is not installed.
+ * moderatedcomments: New plugin to allow comment moderation w/o relying
+ on blogspam.net.
-- Joey Hess Mon, 26 Oct 2009 11:53:32 -0400
diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn
index 7e2232411..b6d4d252b 100644
--- a/doc/plugins/comments.mdwn
+++ b/doc/plugins/comments.mdwn
@@ -45,7 +45,8 @@ There are some global options for the setup file:
## comment moderation
If you enable the [[blogspam]] plugin, comments that appear spammy will be
-held for moderation. Wiki admins can access the comment moderation queue
+held for moderation. (Or with the [[moderatedcomments]] plugin, all
+comments will be held.) Wiki admins can access the comment moderation queue
via a button on their Preferences page.
The comments are stored in `.ikiwiki/comments_pending/`, and can be
diff --git a/doc/plugins/moderatedcomments.mdwn b/doc/plugins/moderatedcomments.mdwn
new file mode 100644
index 000000000..97924d742
--- /dev/null
+++ b/doc/plugins/moderatedcomments.mdwn
@@ -0,0 +1,10 @@
+[[!template id=plugin name=moderatedcomments author="[[Joey]]"]]
+[[!tag type/auth]]
+
+This plugin causes [[comments]] to be held for manual moderation.
+Admins can access the comment moderation queue via their preferences page.
+
+By default, all comments made by anyone who is not an admin will be held
+for moderation. The `moderate_users` setting can be set to false to avoid
+moderating comments of logged-in users, while still moderating anonymous
+comments.
--
cgit v1.2.3
From 11fc28970b329334d88d3667e5b55e0d57e353ab Mon Sep 17 00:00:00 2001
From: Jogo
Date: Tue, 27 Oct 2009 17:44:06 -0400
Subject: 403 response may be a "not found" too
---
doc/plugins/404/discussion.mdwn | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 doc/plugins/404/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/404/discussion.mdwn b/doc/plugins/404/discussion.mdwn
new file mode 100644
index 000000000..5a8e8ed85
--- /dev/null
+++ b/doc/plugins/404/discussion.mdwn
@@ -0,0 +1,3 @@
+With Apache, if you have a page foo/bar/baz but no foo/bar, and if you've
+disabled `Indexes` option, you'll end up with a `403` response for foo/bar.
+The 404 plugin doesn't try to handle that. But it should. -- [[Jogo]]
--
cgit v1.2.3
From 57213fa0dbabd52001897d0b63bfb1a8d9d6926a Mon Sep 17 00:00:00 2001
From: Amitai Schlair
Date: Tue, 27 Oct 2009 22:22:11 -0400
Subject: Google will take a full URL, request that the plugin send it
---
doc/plugins/google/discussion.mdwn | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn
index babc919d2..39403f9f9 100644
--- a/doc/plugins/google/discussion.mdwn
+++ b/doc/plugins/google/discussion.mdwn
@@ -4,3 +4,8 @@ This is not very good since the default ikiwiki
templates produce XHTML instead of HTML.
> Fixed, thanks for the patch! --[[Joey]]
+
+It works to pass the whole wiki baseurl to Google, not just the
+domain, and appears to be legal. I've got a wiki that'd benefit
+(it's a few directories down from the root). Can the plugin be
+tweaked to do this? --[[schmonz]]
--
cgit v1.2.3
From 4dd50ba1bc4cb86c408ff45bbe06069e511e28fc Mon Sep 17 00:00:00 2001
From: Jon Dowland
Date: Wed, 28 Oct 2009 13:52:05 +0000
Subject: update URL to mediawiki plugin
---
doc/plugins/contrib/mediawiki.mdwn | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/mediawiki.mdwn b/doc/plugins/contrib/mediawiki.mdwn
index 7bf1ba0df..13c2d04b2 100644
--- a/doc/plugins/contrib/mediawiki.mdwn
+++ b/doc/plugins/contrib/mediawiki.mdwn
@@ -1,7 +1,10 @@
[[!template id=plugin name=mediawiki author="[[sabr]]"]]
[[!tag type/format]]
-[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to
-process pages written using MediaWiki markup.
+The Mediawiki plugin allows ikiwiki to process pages written using MediaWiki
+markup.
-Available at
+Available at .
+
+This plugin originally lived at , but that
+website has disappeared.
--
cgit v1.2.3
From 879f2f683e878ca859f98eb8b182002cdbc69a20 Mon Sep 17 00:00:00 2001
From: Amitai Schlair
Date: Wed, 28 Oct 2009 20:57:27 -0400
Subject: the setup file wants `rsync_command`, not `rsync`
---
doc/plugins/rsync.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/rsync.mdwn b/doc/plugins/rsync.mdwn
index db7fcb4f7..315b663c0 100644
--- a/doc/plugins/rsync.mdwn
+++ b/doc/plugins/rsync.mdwn
@@ -7,7 +7,7 @@ The command to run is specified by setting `rsync_command` in your setup
file. The command will be run in your destdir, so something like this
is a typical command:
- rsync => 'rsync -qa --delete . user@host:/path/to/docroot/',
+ rsync_command => 'rsync -qa --delete . user@host:/path/to/docroot/',
If using rsync over ssh, you will need to enable noninteractive ssh login
to the remote host. It's also a good idea to specify the exact command line
--
cgit v1.2.3
From c29957e0177c3c654a1ea1feffdba00307449560 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Thu, 29 Oct 2009 18:05:58 -0400
Subject: google: Pass the whole wiki url to google, not just the domain, so
that search works correctly for wikis that are located in subdirectories of
domains.
---
IkiWiki/Plugin/google.pm | 9 +--------
debian/changelog | 3 +++
doc/plugins/google/discussion.mdwn | 2 ++
templates/googleform.tmpl | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm
index 1683220e7..483fa1707 100644
--- a/IkiWiki/Plugin/google.pm
+++ b/IkiWiki/Plugin/google.pm
@@ -6,8 +6,6 @@ use strict;
use IkiWiki 3.00;
use URI;
-my $host;
-
sub import {
hook(type => "getsetup", id => "google", call => \&getsetup);
hook(type => "checkconfig", id => "google", call => \&checkconfig);
@@ -26,11 +24,6 @@ sub checkconfig () {
if (! length $config{url}) {
error(sprintf(gettext("Must specify %s when using the %s plugin"), "url", 'google'));
}
- my $uri=URI->new($config{url});
- if (! $uri || ! defined $uri->host) {
- error(gettext("Failed to parse url, cannot determine domain name"));
- }
- $host=$uri->host;
}
my $form;
@@ -43,7 +36,7 @@ sub pagetemplate (@) {
if ($template->query(name => "searchform")) {
if (! defined $form) {
my $searchform = template("googleform.tmpl", blind_cache => 1);
- $searchform->param(sitefqdn => $host);
+ $searchform->param(url => $config{url});
$form=$searchform->output;
}
diff --git a/debian/changelog b/debian/changelog
index 4c8c4d6fc..f19b4eae4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,9 @@ ikiwiki (3.20091024) UNRELEASED; urgency=low
url is uri-encoded. Most browsers other than MSIE don't care, but it's
the right thing to do.
* Add a spec file to allow building rpm from the source package.
+ * google: Pass the whole wiki url to google, not just the domain,
+ so that search works correctly for wikis that are located in
+ subdirectories of domains.
-- Joey Hess Mon, 26 Oct 2009 11:53:32 -0400
diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn
index 39403f9f9..94fc36a35 100644
--- a/doc/plugins/google/discussion.mdwn
+++ b/doc/plugins/google/discussion.mdwn
@@ -9,3 +9,5 @@ It works to pass the whole wiki baseurl to Google, not just the
domain, and appears to be legal. I've got a wiki that'd benefit
(it's a few directories down from the root). Can the plugin be
tweaked to do this? --[[schmonz]]
+
+> Done. --[[Joey]]
diff --git a/templates/googleform.tmpl b/templates/googleform.tmpl
index e2d4a1f43..bcf1004a4 100644
--- a/templates/googleform.tmpl
+++ b/templates/googleform.tmpl
@@ -1,6 +1,6 @@
--
cgit v1.2.3
From 06293fc92e17cee816721a95fb3a4dfee34a3d7f Mon Sep 17 00:00:00 2001
From: "http://mcfrisk.myopenid.com/"
Date: Wed, 4 Nov 2009 17:51:10 -0500
Subject: from html to ikiwiki with url compatibility
---
doc/plugins/html/discussion.mdwn | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 doc/plugins/html/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/html/discussion.mdwn b/doc/plugins/html/discussion.mdwn
new file mode 100644
index 000000000..5446468bb
--- /dev/null
+++ b/doc/plugins/html/discussion.mdwn
@@ -0,0 +1,5 @@
+I'm trying to convert hand written html site to ikiwiki and maintain url compatibility.
+html plugin with indexpages=1 converts all dir_name/index.html correctly dir_name urls with wiki/css
+based content, but somedir/somefile.html files are only accessible as somedir/somefile/.
+
+How to make somedir/somefile.html accessible as somedir/somefile.html under ikiwiki?
--
cgit v1.2.3
From b37bca1dffed48747f89d420798396eddc1991d7 Mon Sep 17 00:00:00 2001
From: "http://mcfrisk.myopenid.com/"
Date: Thu, 5 Nov 2009 03:46:13 -0500
Subject: move forum
---
doc/plugins/html/discussion.mdwn | 4 ----
1 file changed, 4 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/html/discussion.mdwn b/doc/plugins/html/discussion.mdwn
index 5446468bb..8b1378917 100644
--- a/doc/plugins/html/discussion.mdwn
+++ b/doc/plugins/html/discussion.mdwn
@@ -1,5 +1 @@
-I'm trying to convert hand written html site to ikiwiki and maintain url compatibility.
-html plugin with indexpages=1 converts all dir_name/index.html correctly dir_name urls with wiki/css
-based content, but somedir/somefile.html files are only accessible as somedir/somefile/.
-How to make somedir/somefile.html accessible as somedir/somefile.html under ikiwiki?
--
cgit v1.2.3
From 2faf2d706b98863c74fa27796f080b166ae933ba Mon Sep 17 00:00:00 2001
From: Jon Dowland
Date: Thu, 5 Nov 2009 09:26:57 +0000
Subject: rm empty discussion page
---
doc/plugins/html/discussion.mdwn | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 doc/plugins/html/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/html/discussion.mdwn b/doc/plugins/html/discussion.mdwn
deleted file mode 100644
index 8b1378917..000000000
--- a/doc/plugins/html/discussion.mdwn
+++ /dev/null
@@ -1 +0,0 @@
-
--
cgit v1.2.3
From 66b46576ec097b9f10b45d4b1de18bb214cd5bd5 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Sun, 8 Nov 2009 13:48:07 -0500
Subject: Moved the postscan hook to run on the raw html of a page, before the
template is filled out. This improves the search plugin's indexing, since it
will not include navigational elements from the page template or sidebar.
---
IkiWiki/Render.pm | 8 ++++----
debian/changelog | 4 ++++
...y_includes_text_from_navigational_elements.mdwn | 13 +++++++++++++
doc/plugins/write.mdwn | 22 +++++++++++-----------
4 files changed, 32 insertions(+), 15 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 0889fed62..ab3a71671 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -61,6 +61,10 @@ sub backlinks ($) {
sub genpage ($$) {
my $page=shift;
my $content=shift;
+
+ run_hooks(postscan => sub {
+ shift->(page => $page, content => $content);
+ });
my $templatefile;
run_hooks(templatefile => sub {
@@ -130,10 +134,6 @@ sub genpage ($$) {
$content=$template->output;
- run_hooks(postscan => sub {
- shift->(page => $page, content => $content);
- });
-
run_hooks(format => sub {
$content=shift->(
page => $page,
diff --git a/debian/changelog b/debian/changelog
index 0026d9ddc..6a5ae30ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,10 @@ ikiwiki (3.20091032) UNRELEASED; urgency=low
references.
* underlay: Avoid crashing if lists of underlays (or template
directories) are not configured.
+ * Moved the postscan hook to run on the raw html of a page, before
+ the template is filled out. This improves the search plugin's indexing,
+ since it will not include navigational elements from the page template
+ or sidebar.
-- Joey Hess Fri, 06 Nov 2009 12:04:29 -0500
diff --git a/doc/bugs/Search_summary_includes_text_from_navigational_elements.mdwn b/doc/bugs/Search_summary_includes_text_from_navigational_elements.mdwn
index 874b9ffeb..b774c4531 100644
--- a/doc/bugs/Search_summary_includes_text_from_navigational_elements.mdwn
+++ b/doc/bugs/Search_summary_includes_text_from_navigational_elements.mdwn
@@ -7,3 +7,16 @@ A way to name some CSS ids that should be removed in search results within the i
http://leaf.dragonflybsd.org/mailarchive/users/2009-11/msg00077.html
(bin attachment on that page is actually a .diff.)
+
+> So I was looking at this and I relized that while the search plugin used
+> to use the format hook, and so there was no way to avoid it seeing all
+> the gunk around the page body, it was changed a while ago for different
+> reasons to use its own hook, postscan. So there's really no reason not
+> to move postscan so it runs before said gunk is added to the page.
+> (Aside from a small risk of breaking other third-party plugins that
+> somehow use postscan.)
+>
+> I've implemented that in git, and it drops the navigation elements nicely.
+> It's perhaps less general than allowing specific divs to be skipped from
+> search, but it seems good enough. Please thank the dragonfly guys for their
+> work on this. [[done]] --[[Joey]]
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index c72418c3c..2f179d46f 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -201,6 +201,17 @@ like `Makefile` that have no extension.
If `hook` is passed an optional "longname" parameter, this value is used
when prompting a user to choose a page type on the edit page form.
+### postscan
+
+ hook(type => "postscan", id => "foo", call => \&postscan);
+
+This hook is called once the page has been converted to html (but before
+the generated html is put in a template). The most common use is to
+update search indexes. Added in ikiwiki 2.54.
+
+The function is passed named parameters "page" and "content". Its return
+value is ignored.
+
### pagetemplate
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
@@ -237,17 +248,6 @@ modify the body of a page after it has been fully converted to html.
The function is passed named parameters: "page", "destpage", and "content",
and should return the sanitized content.
-### postscan
-
- hook(type => "postscan", id => "foo", call => \&postscan);
-
-This hook is called once the full page body is available (but before the
-format hook). The most common use is to update search indexes. Added in
-ikiwiki 2.54.
-
-The function is passed named parameters "page" and "content". Its return
-value is ignored.
-
### format
hook(type => "format", id => "foo", call => \&format);
--
cgit v1.2.3
From 9f0931ce21e5f58e2e9de0ef302beca08b8f9177 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Mon, 9 Nov 2009 13:32:08 -0500
Subject: localstyle: New plugin, allows overrding the toplevel local.css with
one that is closer to a page.
I chose not to have it override style.css, because style.css is not really
intended to be edited; the one from the underlay is intended to be used as
a base that local.css overrides.
I chose to use a plugin rather than changing the default behavior, both
because I didn't want to have to worry about possibly breaking backwards
compatability (though this seems unlikely), and because it seemed cleaner
to not include style template parameters in the main page template code.
I suppose someone might want a way to not override the toplevel
local.css, but instead include it as well as foo/local.css. Probably the
best way to do that would be to have foo/local.css @import ../local.css
(modulo browser compatability issues). Alternatively, edit page.tmpl
to always include the toplevel local.css, or swap out this plugin for
another one.
---
IkiWiki/Plugin/localstyle.pm | 35 +++++++++++++++++++++++++++++++++++
debian/changelog | 2 ++
doc/css.mdwn | 3 +++
doc/plugins/localstyle.mdwn | 12 ++++++++++++
templates/page.tmpl | 5 +++++
5 files changed, 57 insertions(+)
create mode 100644 IkiWiki/Plugin/localstyle.pm
create mode 100644 doc/plugins/localstyle.mdwn
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/localstyle.pm b/IkiWiki/Plugin/localstyle.pm
new file mode 100644
index 000000000..111f4dc30
--- /dev/null
+++ b/IkiWiki/Plugin/localstyle.pm
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+package IkiWiki::Plugin::localstyle;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+ hook(type => "getsetup", id => "localstyle", call => \&getsetup);
+ hook(type => "pagetemplate", id => "localstyle", call => \&pagetemplate);
+}
+
+sub getsetup () {
+ return
+ plugin => {
+ safe => 1,
+ rebuild => 1,
+ },
+}
+
+sub pagetemplate (@) {
+ my %params=@_;
+
+ my $template=$params{template};
+
+ if ($template->query(name => "local_css")) {
+ my $best=bestlink($params{page}, 'local.css');
+ if ($best) {
+ $template->param(local_css => $best);
+ }
+ }
+}
+
+1
diff --git a/debian/changelog b/debian/changelog
index 6a5ae30ab..4ab63f175 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ ikiwiki (3.20091032) UNRELEASED; urgency=low
the template is filled out. This improves the search plugin's indexing,
since it will not include navigational elements from the page template
or sidebar.
+ * localstyle: New plugin, allows overrding the toplevel local.css
+ with one that is closer to a page.
-- Joey Hess Fri, 06 Nov 2009 12:04:29 -0500
diff --git a/doc/css.mdwn b/doc/css.mdwn
index 20790b3d1..29a335596 100644
--- a/doc/css.mdwn
+++ b/doc/css.mdwn
@@ -16,3 +16,6 @@ files.
The [[plugins/meta]] plugin can be used to add additional style sheets to a
page.
+
+The [[plugins/localstyle]] plugin can be used to override the toplevel
+[[local.css]] for a whole section of the wiki.
diff --git a/doc/plugins/localstyle.mdwn b/doc/plugins/localstyle.mdwn
new file mode 100644
index 000000000..70a909d68
--- /dev/null
+++ b/doc/plugins/localstyle.mdwn
@@ -0,0 +1,12 @@
+[[!template id=plugin name=localstyle author="[[Joey]]"]]
+[[!tag type/chrome]]
+
+This plugin allows styling different sections of a wiki using different
+versions of the local.css [[CSS]] file. Normally this file is read from the
+top level of the wiki, but with this plugin enabled, standard
+[[ikiwiki/subpage/LinkingRules]] are used to find the closest local.css
+file to each page.
+
+So, for example, to use different styling for page `foo`, as well as all
+of its [[SubPages|ikiwiki/subpage]], such as `foo/bar`, create a
+`foo/local.css`.
diff --git a/templates/page.tmpl b/templates/page.tmpl
index e71ba316d..0e73463ec 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -7,8 +7,13 @@
+
+
+
+
+
--
cgit v1.2.3
From 92a6f2e5e88b513ceaa1b9083ddbf6e928122893 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Tue, 10 Nov 2009 00:50:59 -0500
Subject: httpauth: Add cgiauthurl setting that can be used to do http basic
auth only when ikiwiki needs authentication, rather than for any access to
the cgi/wiki.
---
IkiWiki/Plugin/httpauth.pm | 11 +++++++++++
debian/changelog | 3 +++
doc/plugins/httpauth.mdwn | 24 ++++++++++++++++++++----
3 files changed, 34 insertions(+), 4 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm
index 1816c9d74..bbfff859a 100644
--- a/IkiWiki/Plugin/httpauth.pm
+++ b/IkiWiki/Plugin/httpauth.pm
@@ -17,6 +17,13 @@ sub getsetup () {
safe => 1,
rebuild => 0,
},
+ cgiauthurl => {
+ type => "string",
+ example => "ttp://example.com/wiki/auth/ikiwiki.cgi",
+ description => "url to redirect to when authentication is needed",
+ safe => 1,
+ rebuild => 0,
+ },
}
sub auth ($$) {
@@ -26,6 +33,10 @@ sub auth ($$) {
if (defined $cgi->remote_user()) {
$session->param("name", $cgi->remote_user());
}
+ elsif (defined $config{cgiauthurl}) {
+ IkiWiki::redirect($cgi, $config{cgiauthurl}.'?'.$cgi->query_string());
+ exit;
+ }
}
1
diff --git a/debian/changelog b/debian/changelog
index 4ab63f175..1a703b11f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ ikiwiki (3.20091032) UNRELEASED; urgency=low
or sidebar.
* localstyle: New plugin, allows overrding the toplevel local.css
with one that is closer to a page.
+ * httpauth: Add cgiauthurl setting that can be used to do http basic auth
+ only when ikiwiki needs authentication, rather than for any access to
+ the cgi/wiki.
-- Joey Hess Fri, 06 Nov 2009 12:04:29 -0500
diff --git a/doc/plugins/httpauth.mdwn b/doc/plugins/httpauth.mdwn
index 11ed223e7..77796a3d7 100644
--- a/doc/plugins/httpauth.mdwn
+++ b/doc/plugins/httpauth.mdwn
@@ -2,8 +2,24 @@
[[!tag type/auth]]
This plugin allows HTTP basic authentication to be used to log into the
-wiki. To use the plugin, your web server should be set up to perform HTTP
-basic authentiation for at least the directory containing `ikiwiki.cgi`.
-The authenticated user will be automatically signed into the wiki.
+wiki.
-This plugin is included in ikiwiki, but is not enabled by default.
+## fully authenticated wiki
+
+One way to use the plugin is to configure your web server to require
+HTTP basic authentication for any access to the directory containing the
+wiki (and `ikiwiki.cgi`). The authenticated user will be automatically
+signed into the wiki. This method is suitable only for private wikis.
+
+## separate cgiauthurl
+
+To use httpauth for a wiki where the content is public, and where
+the `ikiwiki.cgi` needs to be usable without authentication (for searching
+and so on), you can configure a separate url that is used for
+authentication, via the `cgiauthurl` option in the setup file. This
+url will then be redirected to whenever authentication is needed.
+
+A typical setup is to make an `auth` subdirectory, and symlink `ikiwiki.cgi`
+into it. Then configure the web server to require authentication only for
+access to the `auth` subdirectory. Then `cgiauthurl` is pointed at this
+symlink.
--
cgit v1.2.3
From df75c5b93a1067461b649e48cc62d4c7f4d18ec7 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Wed, 25 Nov 2009 01:18:43 -0500
Subject: date: New plugin that allows inserting date directives that expand to
pretty-printed dates, using the same formatting as used for page modification
date display, etc.
---
IkiWiki/Plugin/date.pm | 33 +++++++++++++++++++++++++++++++++
debian/changelog | 3 +++
doc/ikiwiki/directive/date.mdwn | 14 ++++++++++++++
doc/plugins/date.mdwn | 6 ++++++
4 files changed, 56 insertions(+)
create mode 100644 IkiWiki/Plugin/date.pm
create mode 100644 doc/ikiwiki/directive/date.mdwn
create mode 100644 doc/plugins/date.mdwn
(limited to 'doc/plugins')
diff --git a/IkiWiki/Plugin/date.pm b/IkiWiki/Plugin/date.pm
new file mode 100644
index 000000000..8f2aa73d6
--- /dev/null
+++ b/IkiWiki/Plugin/date.pm
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+package IkiWiki::Plugin::date;
+
+use warnings;
+use strict;
+use IkiWiki 3.00;
+
+sub import {
+ hook(type => "getsetup", id => "meta", call => \&getsetup);
+ hook(type => "preprocess", id => "meta", call => \&preprocess);
+}
+
+sub getsetup () {
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+}
+
+sub preprocess (@) {
+ my $str=shift;
+
+ eval q{use Date::Parse};
+ error $@ if $@;
+ my $time = str2time($str);
+ if (! defined $time) {
+ error("unable to parse $str");
+ }
+ return displaytime($time);
+}
+
+1
diff --git a/debian/changelog b/debian/changelog
index 15d56a693..10fcebbec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@ ikiwiki (3.20091114) UNRELEASED; urgency=low
larger for inlines of many, or complex pages.
* Added (incomplete) Turkish po file. Closes: #556744
Thanks, Recai Oktaş
+ * date: New plugin that allows inserting date directives that expand to
+ pretty-printed dates, using the same formatting as used for page
+ modification date display, etc.
-- Joey Hess Mon, 16 Nov 2009 15:46:45 -0500
diff --git a/doc/ikiwiki/directive/date.mdwn b/doc/ikiwiki/directive/date.mdwn
new file mode 100644
index 000000000..df45fa840
--- /dev/null
+++ b/doc/ikiwiki/directive/date.mdwn
@@ -0,0 +1,14 @@
+The `date` directive is supplied by the [[!iki plugins/date desc=date]] plugin.
+
+This directive can be used to display a date on a page, using the same
+display method that is used to display the modification date in the page
+footer, and other dates in the wiki. This can be useful for consistency
+of display, or if you want to embed parseable dates into the page source.
+
+Like the dates used by the [[meta]] directive, the date can be entered in
+nearly any format, since it's parsed by [[!cpan TimeDate]].
+
+For example, an update to a page with an embedded date stamp could look
+like:
+
+ Updated \[[!date "Wed, 25 Nov 2009 01:11:55 -0500"]]: mumble mumble
diff --git a/doc/plugins/date.mdwn b/doc/plugins/date.mdwn
new file mode 100644
index 000000000..b8dbdfee5
--- /dev/null
+++ b/doc/plugins/date.mdwn
@@ -0,0 +1,6 @@
+[[!template id=plugin name=date author="[[Joey]]"]]
+[[!tag type/meta]]
+
+This plugin provides the [[ikiwiki/directive/date]]
+[[ikiwiki/directive]], which provides a way to display an arbitrary date
+in a page.
--
cgit v1.2.3
From f4cb6edd0f4d32710e2ef6ddef7de1b06b103389 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Wed, 25 Nov 2009 01:31:44 -0500
Subject: remove info about how to manually add relativedates
The date directive is a better approach.
---
doc/plugins/relativedate.mdwn | 6 ------
1 file changed, 6 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/relativedate.mdwn b/doc/plugins/relativedate.mdwn
index 3ada0864b..50c96c5d7 100644
--- a/doc/plugins/relativedate.mdwn
+++ b/doc/plugins/relativedate.mdwn
@@ -8,9 +8,3 @@ cause a tooltip to pop up with the absolute date.
This only works in browsers with javascript enabled; other browsers will
show the absolute date instead. Also, this plugin can be used with other
plugins like [[prettydate]] that change how the absolute date is displayed.
-
-If this plugin is enabled, you may also add relative dates to pages in the
-wiki, by using html elements in the "relativedate" class. For example, this
-will display as a relative date:
-
- Tue Jan 20 12:00:00 EDT 2009
--
cgit v1.2.3
From 268a2dd54cd47d6ec39c22d61baa5f6f9d40b7f5 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Thu, 26 Nov 2009 14:10:21 -0500
Subject: htmllink: allow a title attribute to be specified
---
IkiWiki.pm | 9 ++++-----
debian/changelog | 1 +
doc/plugins/write.mdwn | 1 +
3 files changed, 6 insertions(+), 5 deletions(-)
(limited to 'doc/plugins')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 1e9d1ca2a..611ba6f65 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1081,11 +1081,10 @@ sub htmllink ($$$;@) {
}
my @attrs;
- if (defined $opts{rel}) {
- push @attrs, ' rel="'.$opts{rel}.'"';
- }
- if (defined $opts{class}) {
- push @attrs, ' class="'.$opts{class}.'"';
+ foreach my $attr (qw{rel class title}) {
+ if (defined $opts{$attr}) {
+ push @attrs, " $attr=\"".$opts{attr}.'"';
+ }
}
return "$linktext";
diff --git a/debian/changelog b/debian/changelog
index 10fcebbec..e31928223 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ ikiwiki (3.20091114) UNRELEASED; urgency=low
* date: New plugin that allows inserting date directives that expand to
pretty-printed dates, using the same formatting as used for page
modification date display, etc.
+ * htmllink: Allow a title attribute to be specified.
-- Joey Hess Mon, 16 Nov 2009 15:46:45 -0500
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 2f179d46f..45f083b42 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -712,6 +712,7 @@ control some options. These are:
* anchor - set to make the link include an anchor
* rel - set to add a rel attribute to the link
* class - set to add a css class to the link
+* title - set to add a title attribute to the link
#### `readfile($;$)`
--
cgit v1.2.3
From 9f30da3e1cb4fef022e1ad4802a6406e61c524d4 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Mon, 30 Nov 2009 21:55:06 -0500
Subject: xslt plugin
---
doc/plugins/contrib/xslt.mdwn | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 doc/plugins/contrib/xslt.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt.mdwn b/doc/plugins/contrib/xslt.mdwn
new file mode 100644
index 000000000..406d42f4e
--- /dev/null
+++ b/doc/plugins/contrib/xslt.mdwn
@@ -0,0 +1,37 @@
+## NAME
+
+IkiWiki::Plugin::xslt - ikiwiki directive to process an XML file with XSLT
+
+## SYNOPSIS
+
+\[[!xslt file="data1.xml" stylesheet="style1.xsl"]]
+
+## DESCRIPTION
+
+IkiWiki::Plugin::xslt is an IkiWiki plugin implementing a directive
+to process an input XML data file with XSLT, and output the result in
+the page where the directive was called.
+
+It is expected that the XSLT stylesheet will output valid HTML markup.
+
+## OPTIONS
+
+There are two arguments to this directive.
+
+* **file:**
+ The file which contains XML data to be processed. This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
+
+* **stylesheet:**
+ The file which contains XSLT stylesheet to apply to the XML data. This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
+
+## PREREQUISITES
+
+ IkiWiki
+ XML::LibXML
+ XML::LibXSLT
+
+## DOWNLOAD
+
+* browse at GitHub:
+* git repo at git://github.com/rubykat/ikiplugins.git
+
--
cgit v1.2.3
From d57ec1c6a4d2e05d2570fb273c7682d383b3b7d9 Mon Sep 17 00:00:00 2001
From: "http://jmtd.livejournal.com/"
Date: Tue, 1 Dec 2009 11:30:03 -0500
Subject: add plugin template
---
doc/plugins/contrib/xslt.mdwn | 1 +
1 file changed, 1 insertion(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt.mdwn b/doc/plugins/contrib/xslt.mdwn
index 406d42f4e..e26f58e38 100644
--- a/doc/plugins/contrib/xslt.mdwn
+++ b/doc/plugins/contrib/xslt.mdwn
@@ -1,3 +1,4 @@
+[[!template id=plugin name=xslt author="rubykat"]]
## NAME
IkiWiki::Plugin::xslt - ikiwiki directive to process an XML file with XSLT
--
cgit v1.2.3
From db746519ebca6495342d836a77c0664977ee0d99 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Tue, 1 Dec 2009 16:04:18 -0500
Subject: security and comments
---
doc/plugins/contrib/xslt/discussion.mdwn | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 doc/plugins/contrib/xslt/discussion.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt/discussion.mdwn b/doc/plugins/contrib/xslt/discussion.mdwn
new file mode 100644
index 000000000..a549681de
--- /dev/null
+++ b/doc/plugins/contrib/xslt/discussion.mdwn
@@ -0,0 +1,16 @@
+## security
+
+I'm curious what the security implications of having this plugin on a
+publically writable wiki are.
+
+First, it looks like the way it looks up the stylesheet file will happily
+use a regular .mdwn wiki page as the stylsheet. Which means any user can
+create a stylesheet and have it be used, without needing permission to
+upload arbitrary files. That probably needs to be fixed; one way would be
+to mandate that the `srcfile` has a `.xsl` extension.
+
+Secondly, if an attacker is able to upload a stylesheet file somehow, could
+this be used to attack the server where it is built? I know that xslt is
+really a full programming language, so I assume at least DOS attacks are
+possible. Can it also read other arbitrary files, run other programs, etc?
+--[[Joey]]
--
cgit v1.2.3
From 3ca05b15d6c47446e89128b405b9ffce8a418a3c Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Tue, 1 Dec 2009 18:30:25 -0500
Subject: reply to comment
---
doc/plugins/contrib/xslt/discussion.mdwn | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt/discussion.mdwn b/doc/plugins/contrib/xslt/discussion.mdwn
index a549681de..3288150a4 100644
--- a/doc/plugins/contrib/xslt/discussion.mdwn
+++ b/doc/plugins/contrib/xslt/discussion.mdwn
@@ -14,3 +14,9 @@ this be used to attack the server where it is built? I know that xslt is
really a full programming language, so I assume at least DOS attacks are
possible. Can it also read other arbitrary files, run other programs, etc?
--[[Joey]]
+
+> For the first point, agreed. It should probably check that the data file has a `.xml` extension also. Will fix soon.
+
+> For the second point, I think the main concern would be resource usage. XSLT is a pretty limited language; it can read other XML files, but it can't run other programs so far as I know.
+
+> -- [[KathrynAndersen]]
--
cgit v1.2.3
From cbdd0d85078eb8bc9d01698e9cc8ac24e12ca7ea Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Tue, 1 Dec 2009 18:51:10 -0500
Subject: bug fix; now checks extensions.
---
doc/plugins/contrib/xslt.mdwn | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt.mdwn b/doc/plugins/contrib/xslt.mdwn
index e26f58e38..f98f8378d 100644
--- a/doc/plugins/contrib/xslt.mdwn
+++ b/doc/plugins/contrib/xslt.mdwn
@@ -20,10 +20,10 @@ It is expected that the XSLT stylesheet will output valid HTML markup.
There are two arguments to this directive.
* **file:**
- The file which contains XML data to be processed. This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
+ The file which contains XML data to be processed. This file *must* have a `.xml` extension (`filename.xml`). This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
* **stylesheet:**
- The file which contains XSLT stylesheet to apply to the XML data. This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
+ The file which contains XSLT stylesheet to apply to the XML data. This file *must* have a `.xsl` extension (`filename.xsl`). This file is searched for using the usual IkiWiki mechanism, thus finding the file first in the same directory as the page, then in the directory above, and so on.
## PREREQUISITES
--
cgit v1.2.3
From 18840f67e991e48e1c78bf848ce3dd50a649569b Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Tue, 1 Dec 2009 18:51:48 -0500
Subject: now have fixed xslt plugin
---
doc/plugins/contrib/xslt/discussion.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt/discussion.mdwn b/doc/plugins/contrib/xslt/discussion.mdwn
index 3288150a4..9cda02f88 100644
--- a/doc/plugins/contrib/xslt/discussion.mdwn
+++ b/doc/plugins/contrib/xslt/discussion.mdwn
@@ -15,7 +15,7 @@ really a full programming language, so I assume at least DOS attacks are
possible. Can it also read other arbitrary files, run other programs, etc?
--[[Joey]]
-> For the first point, agreed. It should probably check that the data file has a `.xml` extension also. Will fix soon.
+> For the first point, agreed. It should probably check that the data file has a `.xml` extension also. Have now fixed.
> For the second point, I think the main concern would be resource usage. XSLT is a pretty limited language; it can read other XML files, but it can't run other programs so far as I know.
--
cgit v1.2.3
From 6eb35262d5c2cd3a9b24029d958cc24743ccd64f Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Tue, 1 Dec 2009 20:55:25 -0500
Subject: clearing up a bit of confusion about who I am
---
doc/plugins/contrib/xslt.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt.mdwn b/doc/plugins/contrib/xslt.mdwn
index f98f8378d..c30e618ea 100644
--- a/doc/plugins/contrib/xslt.mdwn
+++ b/doc/plugins/contrib/xslt.mdwn
@@ -1,4 +1,4 @@
-[[!template id=plugin name=xslt author="rubykat"]]
+[[!template id=plugin name=xslt author="[[rubykat]]"]]
## NAME
IkiWiki::Plugin::xslt - ikiwiki directive to process an XML file with XSLT
--
cgit v1.2.3
From 5d68ee9e4e920ef3756c7489fd84eafd1b332f87 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 2 Dec 2009 00:43:47 -0500
Subject: here be a plugin for processing POD!
---
doc/plugins/contrib/pod.mdwn | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 doc/plugins/contrib/pod.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
new file mode 100644
index 000000000..648e3b0c2
--- /dev/null
+++ b/doc/plugins/contrib/pod.mdwn
@@ -0,0 +1,35 @@
+## NAME
+
+IkiWiki::Plugin::pod - process pages written in POD format.
+
+## SYNOPSIS
+
+In the ikiwiki setup file, enable this plugin by adding it to the
+list of active plugins.
+
+ add_plugins => [qw{goodstuff pod ....}],
+
+## DESCRIPTION
+
+IkiWiki::Plugin::pod is an IkiWiki plugin enabling ikiwiki to
+process pages written in POD (Plain Old Documentation) format.
+This will treat files with a `.pod` or `.pm` extension as files
+which contain POD markup.
+
+## OPTIONS
+
+The following options can be set in the ikiwiki setup file.
+
+* **pod_index:** If true, this will generate an index (table of contents) for the page.
+* **pod_toplink:** The label to be used for links back to the top of the page. If this is empty, then no top-links will be generated.
+
+## PREREQUISITES
+
+ IkiWiki
+ Pod::Xhtml
+ IO::String
+
+## DOWNLOAD
+
+* browse at GitHub:
+* git repo at git://github.com/rubykat/ikiplugins.git
--
cgit v1.2.3
From 11a6112b561a5624b30cb587a067d35e0098c21d Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 2 Dec 2009 00:45:23 -0500
Subject: added the proper template thingie
---
doc/plugins/contrib/pod.mdwn | 1 +
1 file changed, 1 insertion(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
index 648e3b0c2..5ca1b3347 100644
--- a/doc/plugins/contrib/pod.mdwn
+++ b/doc/plugins/contrib/pod.mdwn
@@ -1,3 +1,4 @@
+[[!template id=plugin name=pod author="[[rubykat]]"]]
## NAME
IkiWiki::Plugin::pod - process pages written in POD format.
--
cgit v1.2.3
From c4b7d046690a7d35f5f6dc73fcbc83b72bc95f42 Mon Sep 17 00:00:00 2001
From: "http://lj.rossia.org/users/imz/"
Date: Wed, 2 Dec 2009 13:08:42 -0500
Subject: minor: a link to describe the format
---
doc/plugins/contrib/pod.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
index 5ca1b3347..dafffa844 100644
--- a/doc/plugins/contrib/pod.mdwn
+++ b/doc/plugins/contrib/pod.mdwn
@@ -13,7 +13,7 @@ list of active plugins.
## DESCRIPTION
IkiWiki::Plugin::pod is an IkiWiki plugin enabling ikiwiki to
-process pages written in POD (Plain Old Documentation) format.
+process pages written in POD ([Plain Old Documentation](http://en.wikipedia.org/wiki/Plain_Old_Documentation)) format.
This will treat files with a `.pod` or `.pm` extension as files
which contain POD markup.
--
cgit v1.2.3
From 917b8e5ba17ba4b0c9a2cf5c12781f1880d02ff5 Mon Sep 17 00:00:00 2001
From: "http://lj.rossia.org/users/imz/"
Date: Wed, 2 Dec 2009 13:20:43 -0500
Subject: minor: a link to describe the mentioned format
---
doc/plugins/table.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/table.mdwn b/doc/plugins/table.mdwn
index 7b080acda..10a85bb2c 100644
--- a/doc/plugins/table.mdwn
+++ b/doc/plugins/table.mdwn
@@ -3,6 +3,6 @@
This plugin provides the [[ikiwiki/directive/table]] [[ikiwiki/directive]].
It can build HTML tables from data in CSV (comma-separated values)
-or DSV (delimiter-separated values) format.
+or DSV ([delimiter-separated values](http://en.wikipedia.org/wiki/Delimiter-separated_values)) format.
It needs the perl module [[!cpan Text::CSV]] for the CSV data.
--
cgit v1.2.3
From 658da70f6aa52331389566cd1824e8342264dfe5 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Fri, 4 Dec 2009 04:09:44 -0500
Subject: added field plugin
---
doc/plugins/contrib/field.mdwn | 97 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100644 doc/plugins/contrib/field.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/field.mdwn b/doc/plugins/contrib/field.mdwn
new file mode 100644
index 000000000..f7c2f4b1b
--- /dev/null
+++ b/doc/plugins/contrib/field.mdwn
@@ -0,0 +1,97 @@
+[[!template id=plugin name=pod author="[[rubykat]]"]]
+[[!toc]]
+## NAME
+
+IkiWiki::Plugin::field - front-end for per-page record fields.
+
+## SYNOPSIS
+
+ # activate the plugin
+ add_plugins => [qw{goodstuff field ....}],
+
+ # simple registration
+ field_register => [qw{meta}],
+
+## DESCRIPTION
+
+This plugin is meant to be used in conjunction with other plugins
+in order to provide a uniform interface to access per-page structured
+data, where each page is treated like a record, and the structured data
+are fields in that record. This can include the meta-data for that page,
+such as the page title.
+
+Plugins can register a function which will return the value of a "field" for
+a given page. This can be used in three ways:
+
+* In page templates; all registered fields will be passed to the page template in the "pagetemplate" processing.
+* In PageSpecs; the "field" function can be used to match the value of a field in a page.
+* By other plugins, using the field_get_value function, to get the value of a field for a page, and do with it what they will.
+
+## OPTIONS
+
+The following options can be set in the ikiwiki setup file.
+
+**field_register**
+
+A list of plugin-IDs to register. This assumes that the plugins in
+question store data in the %pagestatus hash using the ID of that plugin,
+and thus the field values are looked for there.
+
+This is the simplest form of registration, but the advantage is that it
+doesn't require the plugin to be modified in order for it to be
+registered with the "field" plugin.
+
+## PageSpec
+
+The "field" PageSpec function can be used to match the value of a field for a page.
+
+field(*name* *glob*)
+
+For example:
+
+field(bar Foo*) will match if the "bar" field starts with "Foo".
+
+## FUNCTIONS
+
+### field_register
+
+field_register(id=>$id);
+
+Register a plugin as having field data. The above form is the simplest, where the field value
+is looked up in the %pagestatus hash under the plugin-id.
+
+Additional Options:
+
+**call=>&myfunc**
+
+A reference to a function to call rather than just looking up the value in the %pagestatus hash.
+It takes two arguments: the name of the field, and the name of the page. It is expected to return
+the value of that field, or undef if there is no field by that name.
+
+ sub myfunc ($$) {
+ my $field = shift;
+ my $page = shift;
+
+ ...
+
+ return $value;
+ }
+
+**first=>1**
+
+Set this to be called first in the sequence of calls looking for values. Since the first found
+value is the one which is returned, ordering is significant.
+
+**last=>1**
+
+Set this to be called last in the sequence of calls looking for values. Since the first found
+value is the one which is returned, ordering is significant.
+
+### field_get_value($field, $page)
+
+Returns the value of the field for that page, or undef if none is found.
+
+## DOWNLOAD
+
+* browse at GitHub:
+* git repo at git://github.com/rubykat/ikiplugins.git
--
cgit v1.2.3
From 2a4f37b4622bd5ce8e2c153fff2ae5d1d57f57de Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Fri, 4 Dec 2009 04:11:12 -0500
Subject: oops, fixed name
---
doc/plugins/contrib/field.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/field.mdwn b/doc/plugins/contrib/field.mdwn
index f7c2f4b1b..745a36bcd 100644
--- a/doc/plugins/contrib/field.mdwn
+++ b/doc/plugins/contrib/field.mdwn
@@ -1,4 +1,4 @@
-[[!template id=plugin name=pod author="[[rubykat]]"]]
+[[!template id=plugin name=field author="[[rubykat]]"]]
[[!toc]]
## NAME
--
cgit v1.2.3
From a3803f3cd82af36b77a8ee718f9057515adf05ea Mon Sep 17 00:00:00 2001
From: "http://www.google.com/profiles/schmonz"
Date: Fri, 11 Dec 2009 21:59:08 -0500
Subject: on my unixauth branch now
---
doc/plugins/contrib/unixauth.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/unixauth.mdwn b/doc/plugins/contrib/unixauth.mdwn
index 137195139..c97312b59 100644
--- a/doc/plugins/contrib/unixauth.mdwn
+++ b/doc/plugins/contrib/unixauth.mdwn
@@ -1,7 +1,7 @@
[[!template id=plugin name=unixauth core=0 author="[[schmonz]]"]]
[[!tag type/auth]]
-[[!template id=gitbranch branch=schmonz author="[[schmonz]]"]]
+[[!template id=gitbranch branch=unixauth author="[[schmonz]]"]]
This plugin authenticates users against the Unix user database. It presents a similar UI to [[plugins/passwordauth]], but simpler, as there's no need to be able to register or change one's password.
--
cgit v1.2.3
From 5b48f1412e8117372af081c513b8c8a41176d4e7 Mon Sep 17 00:00:00 2001
From: "http://www.google.com/profiles/kari.pahula"
Date: Sat, 12 Dec 2009 06:33:21 -0500
Subject: Getting OpenID verified identity externally
---
doc/plugins/openid/discussion.mdwn | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/openid/discussion.mdwn b/doc/plugins/openid/discussion.mdwn
index 39e947b82..a88da8b9d 100644
--- a/doc/plugins/openid/discussion.mdwn
+++ b/doc/plugins/openid/discussion.mdwn
@@ -19,3 +19,8 @@ It looks like OpenID 2.0 (the only supported by Yahoo) is not supported in ikiwi
-- Ivan Z.
They have more on OpenID 2.0 in [their FAQ](http://developer.yahoo.com/openid/faq.html). --Ivan Z.
+
+----
+I'm trying to add a way to query the data saved by the OpenID plugin from outside of ikiwiki, to see what identity the user has been authenticated as, if any. I'm thinking of designating some directories as internal pages and check the identity against a list in a mod_perl access hook. I would also write a CGI script that would return a JSON formatted reply to tell if the user is authenticated for those pages and query it with AJAX and only render links to the internal pages if the user would have access to them. That's just a couple of ideas I'm working on first, but I can imagine that there's any number of other tricks that people could implement with that sort of a thing.
+
+Also, this isn't really specific to OpenID but to all auth plugins, but I'm going to use only OpenID for authentication so that's what I'm targeting right now. I suppose that would be worth its own TODO item. --[[kaol]]
--
cgit v1.2.3
From 407a94c6a6d5ea125f5c31787799c864e2c1b7f0 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 23 Dec 2009 15:07:11 +0000
Subject: added tag
---
doc/plugins/contrib/pod.mdwn | 3 +++
1 file changed, 3 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
index dafffa844..d6fdf4b63 100644
--- a/doc/plugins/contrib/pod.mdwn
+++ b/doc/plugins/contrib/pod.mdwn
@@ -34,3 +34,6 @@ The following options can be set in the ikiwiki setup file.
* browse at GitHub:
* git repo at git://github.com/rubykat/ikiplugins.git
+
+----
+[[!taglink format]]
--
cgit v1.2.3
From 85eab3e9ff30ba42307a53bf22ef72ce87e18616 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 23 Dec 2009 15:08:14 +0000
Subject: try again with tag
---
doc/plugins/contrib/pod.mdwn | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
index d6fdf4b63..19b0111df 100644
--- a/doc/plugins/contrib/pod.mdwn
+++ b/doc/plugins/contrib/pod.mdwn
@@ -1,4 +1,5 @@
[[!template id=plugin name=pod author="[[rubykat]]"]]
+[[!tag format]]
## NAME
IkiWiki::Plugin::pod - process pages written in POD format.
@@ -35,5 +36,3 @@ The following options can be set in the ikiwiki setup file.
* browse at GitHub:
* git repo at git://github.com/rubykat/ikiplugins.git
-----
-[[!taglink format]]
--
cgit v1.2.3
From 01e744af0f099fcf28d9cf0bc0f090262c092bdf Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 23 Dec 2009 15:09:59 +0000
Subject: third time lucky?
---
doc/plugins/contrib/pod.mdwn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/pod.mdwn b/doc/plugins/contrib/pod.mdwn
index 19b0111df..97a9c648a 100644
--- a/doc/plugins/contrib/pod.mdwn
+++ b/doc/plugins/contrib/pod.mdwn
@@ -1,5 +1,5 @@
[[!template id=plugin name=pod author="[[rubykat]]"]]
-[[!tag format]]
+[[!tag type/format]]
## NAME
IkiWiki::Plugin::pod - process pages written in POD format.
--
cgit v1.2.3
From c7e822a4962c36a3f26e1f0413734b2e67e2e607 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 23 Dec 2009 15:13:04 +0000
Subject: added tag
---
doc/plugins/contrib/field.mdwn | 1 +
1 file changed, 1 insertion(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/field.mdwn b/doc/plugins/contrib/field.mdwn
index 745a36bcd..a43bf24b2 100644
--- a/doc/plugins/contrib/field.mdwn
+++ b/doc/plugins/contrib/field.mdwn
@@ -1,4 +1,5 @@
[[!template id=plugin name=field author="[[rubykat]]"]]
+[[!tag type/meta]]
[[!toc]]
## NAME
--
cgit v1.2.3
From c4a2d93115b6a7826b21f13b9d29bd947551c6c6 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 23 Dec 2009 15:14:57 +0000
Subject: added tag
---
doc/plugins/contrib/xslt.mdwn | 1 +
1 file changed, 1 insertion(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/xslt.mdwn b/doc/plugins/contrib/xslt.mdwn
index c30e618ea..80c956c58 100644
--- a/doc/plugins/contrib/xslt.mdwn
+++ b/doc/plugins/contrib/xslt.mdwn
@@ -1,4 +1,5 @@
[[!template id=plugin name=xslt author="[[rubykat]]"]]
+[[!tag type/chrome]]
## NAME
IkiWiki::Plugin::xslt - ikiwiki directive to process an XML file with XSLT
--
cgit v1.2.3
From cf26aa6bc76ada153b265ef7851eacb1c6f2417e Mon Sep 17 00:00:00 2001
From: "http://weakish.pigro.net/"
Date: Thu, 24 Dec 2009 08:46:40 +0000
Subject: question: "still domain specific or not?"
---
doc/plugins/google/discussion.mdwn | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'doc/plugins')
diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn
index 94fc36a35..32a0a41b9 100644
--- a/doc/plugins/google/discussion.mdwn
+++ b/doc/plugins/google/discussion.mdwn
@@ -11,3 +11,12 @@ domain, and appears to be legal. I've got a wiki that'd benefit
tweaked to do this? --[[schmonz]]
> Done. --[[Joey]]
+
+The main page said:
+
+> Also, if the same domain has other content, outside the wiki's
+> content, it will be searched as well.
+
+Is it still true now? (Or this statement is out of date?) --[weakish]
+
+[weakish]: http://weakish.pigro.net
--
cgit v1.2.3
From d35bf0be6765d692d97769cd2d81ed143c8e9036 Mon Sep 17 00:00:00 2001
From: Joey Hess
Date: Fri, 25 Dec 2009 15:08:22 -0500
Subject: correction
---
doc/plugins/google.mdwn | 3 +--
doc/plugins/google/discussion.mdwn | 3 +++
2 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/google.mdwn b/doc/plugins/google.mdwn
index 7c61e637b..349c278ee 100644
--- a/doc/plugins/google.mdwn
+++ b/doc/plugins/google.mdwn
@@ -5,8 +5,7 @@ This plugin adds a search form to the wiki, using google's site search.
Google is asked to search for pages in the domain specified in the wiki's
`url` configuration parameter. Results will depend on whether google has
-indexed the site, and how recently. Also, if the same domain has other
-content, outside the wiki's content, it will be searched as well.
+indexed the site, and how recently.
The [[search]] plugin offers full text search of only the wiki, but
requires that a search engine be installed on your site.
diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn
index 32a0a41b9..e664f5723 100644
--- a/doc/plugins/google/discussion.mdwn
+++ b/doc/plugins/google/discussion.mdwn
@@ -20,3 +20,6 @@ The main page said:
Is it still true now? (Or this statement is out of date?) --[weakish]
[weakish]: http://weakish.pigro.net
+
+> I checked, and it's never been true; google is given the url to the top
+> of the wiki and only searches things in there. --[[Joey]]
--
cgit v1.2.3
From 0c89eabcf5a7f9dd881abc8a8cb5f2271ec4e01e Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 13 Jan 2010 00:37:56 +0000
Subject: more options for field configuration, additional pagespec test
---
doc/plugins/contrib/field.mdwn | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/field.mdwn b/doc/plugins/contrib/field.mdwn
index a43bf24b2..09646d28a 100644
--- a/doc/plugins/contrib/field.mdwn
+++ b/doc/plugins/contrib/field.mdwn
@@ -13,6 +13,9 @@ IkiWiki::Plugin::field - front-end for per-page record fields.
# simple registration
field_register => [qw{meta}],
+ # allow the config to be queried as a field
+ field_allow_config => 1,
+
## DESCRIPTION
This plugin is meant to be used in conjunction with other plugins
@@ -32,8 +35,17 @@ a given page. This can be used in three ways:
The following options can be set in the ikiwiki setup file.
+**field_allow_config**
+
+ field_allow_config => 1,
+
+Allow the $config hash to be queried like any other field; the
+keys of the config hash are the field names.
+
**field_register**
+ field_register => [qw{meta}],
+
A list of plugin-IDs to register. This assumes that the plugins in
question store data in the %pagestatus hash using the ID of that plugin,
and thus the field values are looked for there.
@@ -46,12 +58,17 @@ registered with the "field" plugin.
The "field" PageSpec function can be used to match the value of a field for a page.
-field(*name* *glob*)
+**field(*name* *glob*)**
For example:
field(bar Foo*) will match if the "bar" field starts with "Foo".
+**destfield(*name* *glob*)**
+
+is the same, except that it tests the destination page (that is, in cases
+when the source page is being included in another page).
+
## FUNCTIONS
### field_register
--
cgit v1.2.3
From 9ccd1ba41bff43c1a5d06197b454c8748224e30f Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 13 Jan 2010 02:20:34 +0000
Subject: ymlfront: backend for structured data
---
doc/plugins/contrib/ymlfront.mdwn | 99 +++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
create mode 100644 doc/plugins/contrib/ymlfront.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/ymlfront.mdwn b/doc/plugins/contrib/ymlfront.mdwn
new file mode 100644
index 000000000..f4438f23c
--- /dev/null
+++ b/doc/plugins/contrib/ymlfront.mdwn
@@ -0,0 +1,99 @@
+[[!template id=plugin name=ymlfront author="[[rubykat]]"]]
+[[!tag type/meta]]
+[[!toc]]
+## NAME
+
+IkiWiki::Plugin::ymlfront - add YAML-format data to a page
+
+## SYNOPSIS
+
+ # activate the plugin
+ add_plugins => [qw{goodstuff ymlfront ....}],
+
+## DESCRIPTION
+
+This plugin provides a way of adding arbitrary meta-data (data fields) to any
+page by prefixing the page with a YAML-format document. This provides a way to
+create per-page structured data, where each page is treated like a record, and
+the structured data are fields in that record. This can include the meta-data
+for that page, such as the page title.
+
+This plugin is meant to be used in conjunction with the [[field]] plugin.
+
+## DETAILS
+
+The YAML-format data in a page must be placed at the start of the page
+and delimited by lines containing precisely three dashes. The "normal"
+content of the page then follows.
+
+For example:
+
+ ---
+ title: Foo does not work
+ Urgency: High
+ Status: Assigned
+ AssignedTo: Fred Nurk
+ Version: 1.2.3
+ ---
+ When running on the Sprongle system, the Foo function returns incorrect data.
+
+What will normally be displayed is everything following the second line of dashes.
+That will be htmlized using the page-type of the page-file.
+
+### Accessing the Data
+
+There are three ways to access the data given in the YAML section.
+
+* [[getfield]] plugin
+
+ The **getfield** plugin can display the data as individual variable values.
+
+ For example:
+
+ ---
+ title: Foo does not work
+ Urgency: High
+ Status: Assigned
+ AssignedTo: Fred Nurk
+ Version: 1.2.3
+ ---
+ # {{$title}}
+
+ **Urgency:** {{$Urgency}}\\
+ **Status:** {{$Status}}\\
+ **Assigned To:** {{$AssignedTo}}\\
+ **Version:** {{$Version}}
+
+ When running on the Sprongle system, the Foo function returns incorrect data.
+
+* [[ftemplate]] plugin
+
+ The **ftemplate** plugin is like the [[plugins/template]] plugin, but it is also aware of [[field]] values.
+
+ For example:
+
+ ---
+ title: Foo does not work
+ Urgency: High
+ Status: Assigned
+ AssignedTo: Fred Nurk
+ Version: 1.2.3
+ ---
+ \[[!ftemplate id="bug_display_template"]]
+
+ When running on the Sprongle system, the Foo function returns incorrect data.
+
+* write your own plugin
+
+ In conjunction with the [[field]] plugin, you can write your own plugin to access the data.
+
+## PREREQUISITES
+
+ IkiWiki
+ IkiWiki::Plugin::field
+ YAML::Any
+
+## DOWNLOAD
+
+* browse at GitHub:
+* git repo at git://github.com/rubykat/ikiplugins.git
--
cgit v1.2.3
From ccc8e8868269bf2751596e04f792c388acb85c12 Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 13 Jan 2010 02:27:59 +0000
Subject: getfield: query field (meta-data) values
---
doc/plugins/contrib/getfield.mdwn | 85 +++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 doc/plugins/contrib/getfield.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/getfield.mdwn b/doc/plugins/contrib/getfield.mdwn
new file mode 100644
index 000000000..ed03dc439
--- /dev/null
+++ b/doc/plugins/contrib/getfield.mdwn
@@ -0,0 +1,85 @@
+[[!template id=plugin name=getfield author="[[rubykat]]"]]
+[[!tag type/meta]]
+[[!toc]]
+## NAME
+
+IkiWiki::Plugin::getfield - query the values of fields
+
+## SYNOPSIS
+
+ # activate the plugin
+ add_plugins => [qw{goodstuff getfield ....}],
+
+## DESCRIPTION
+
+This plugin provides a way of querying the meta-data (data fields) of a page
+inside the page content (rather than inside a template) This provides a way to
+use per-page structured data, where each page is treated like a record, and the
+structured data are fields in that record. This can include the meta-data for
+that page, such as the page title.
+
+This plugin is meant to be used in conjunction with the B plugin.
+
+### USAGE
+
+One can get the value of a field by using special markup in the page.
+This does not use directive markup, in order to make it easier to
+use the markup inside other directives. There are two forms:
+
+* {{$*fieldname*}}
+
+ This queries the value of *fieldname* for the source page.
+
+ For example:
+
+ \[[!meta title="My Long and Complicated Title With Potential For Spelling Mistakes"]]
+ # {{$title}}
+
+ When the page is processed, this will give you:
+
+
My Long and Complicated Title With Potential For Spelling Mistakes
+
+* {{+$*fieldname*+}}
+
+ This queries the value of *fieldname* for the destination page; that is,
+ the value when this page is included inside another page.
+
+ For example:
+
+ On PageA:
+
+ \[[!meta title="I Am Page A"]]
+ # {{+$title+}}
+
+ Stuff about A.
+
+ On PageB:
+
+ \[[!meta title="I Am Page B"]]
+ \[[!inline pagespec="PageA"]]
+
+ When PageA is displayed:
+
+
I Am Page A
+
Stuff about A.
+
+ When PageB is displayed:
+
+
I Am Page B
+
Stuff about A.
+
+### More Examples
+
+Listing all the sub-pages of the current page:
+
+ \[[!map pages="{{$page}}/*"]]
+
+### LIMITATIONS
+
+One cannot query the values of fields on pages other than the current
+page or the destination page.
+
+## DOWNLOAD
+
+* browse at GitHub:
+* git repo at git://github.com/rubykat/ikiplugins.git
--
cgit v1.2.3
From 7d997f1007b240c14c04ff73b09a2a62fa3e64ad Mon Sep 17 00:00:00 2001
From: "http://kerravonsen.dreamwidth.org/"
Date: Wed, 13 Jan 2010 02:36:28 +0000
Subject: ftemplate: field-aware structured template plugin
---
doc/plugins/contrib/ftemplate.mdwn | 94 ++++++++++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 doc/plugins/contrib/ftemplate.mdwn
(limited to 'doc/plugins')
diff --git a/doc/plugins/contrib/ftemplate.mdwn b/doc/plugins/contrib/ftemplate.mdwn
new file mode 100644
index 000000000..bcc6f2c67
--- /dev/null
+++ b/doc/plugins/contrib/ftemplate.mdwn
@@ -0,0 +1,94 @@
+[[!template id=plugin name=ftemplate author="[[rubykat]]"]]
+[[!tag type/meta type/format]]
+[[!toc]]
+## NAME
+
+IkiWiki::Plugin::ftemplate - field-aware structured template plugin
+
+## SYNOPSIS
+
+ # activate the plugin
+ add_plugins => [qw{goodstuff ftemplate ....}],
+
+## DESCRIPTION
+
+This plugin provides the **ftemplate** directive. This is like
+the [[ikiwiki/directive/template]] directive, with the addition that one does not
+have to provide all the values in the call to the template,
+because ftemplate can query structured data ("fields") using
+the [[field]] plugin.
+
+Templates are files that can be filled out and inserted into pages in
+the wiki, by using the ftemplate directive. The directive has an id
+parameter that identifies the template to use.
+
+Additional parameters can be used to fill out the template, in
+addition to the "field" values. Passed-in values override the
+"field" values.
+
+There are two places where template files can live. One is, as with the
+[[plugins/template]] plugin, in the /templates directory on the wiki. These
+templates are wiki pages, and can be edited from the web like other wiki
+pages.
+
+The second place where template files can live is in the global
+templates directory (the same place where the page.tmpl template lives).
+This is a useful place to put template files if you want to prevent
+them being edited from the web, and you don't want to have to make
+them work as wiki pages.
+
+### EXAMPLES
+
+#### Example 1
+
+PageA:
+
+ [[!meta title="I Am Page A"]]
+ [[!meta description="A is for Apple."]]
+ [[!meta author="Fred Nurk"]]
+ [[!ftemplate id="mytemplate"]]
+
+Template "mytemplate":
+
+ #
+ by