* Fix link() PageSpecs to not just look at the raw link text, but at where
that given link points based on the page doing the linking. Note that this could make such PageSpecs match different things than before, if you relied on the old behavior of them only matching the raw link text. * This required changing the match_* interface, adding a third parameter. * Allow link() PageSpecs to match relative, as is allowed with globs.a * Add postform option to inline plugin. * Add an bug tracker to the softwaresite example.master
parent
0daec2bf14
commit
2a0d91af2f
33
IkiWiki.pm
33
IkiWiki.pm
|
@ -921,7 +921,7 @@ sub pagespec_translate ($) { #{{{
|
|||
}
|
||||
elsif ($word =~ /^(\w+)\((.*)\)$/) {
|
||||
if (exists $IkiWiki::PageSpec::{"match_$1"}) {
|
||||
$code.=" IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).")";
|
||||
$code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \$from)";
|
||||
}
|
||||
else {
|
||||
$code.=" 0";
|
||||
|
@ -968,22 +968,35 @@ sub match_glob ($$$) { #{{{
|
|||
return $page=~/^$glob$/i;
|
||||
} #}}}
|
||||
|
||||
sub match_link ($$) { #{{{
|
||||
sub match_link ($$$) { #{{{
|
||||
my $page=shift;
|
||||
my $link=lc(shift);
|
||||
my $from=shift;
|
||||
if (! defined $from){
|
||||
$from = "";
|
||||
}
|
||||
|
||||
# relative matching
|
||||
if ($link =~ m!^\.! && defined $from) {
|
||||
$from=~s!/?[^/]+$!!;
|
||||
$link=~s!^\./!!;
|
||||
$link="$from/$link" if length $from;
|
||||
}
|
||||
|
||||
my $links = $IkiWiki::links{$page} or return undef;
|
||||
return 0 unless @$links;
|
||||
my $bestlink = IkiWiki::bestlink($from, $link);
|
||||
foreach my $p (@$links) {
|
||||
return 1 if lc $p eq $link;
|
||||
return 1 if $bestlink eq IkiWiki::bestlink($page, $p);
|
||||
}
|
||||
return 0;
|
||||
} #}}}
|
||||
|
||||
sub match_backlink ($$) { #{{{
|
||||
match_link(pop, pop);
|
||||
sub match_backlink ($$$) { #{{{
|
||||
match_link($_[1], $_[0], $_[3]);
|
||||
} #}}}
|
||||
|
||||
sub match_created_before ($$) { #{{{
|
||||
sub match_created_before ($$$) { #{{{
|
||||
my $page=shift;
|
||||
my $testpage=shift;
|
||||
|
||||
|
@ -995,7 +1008,7 @@ sub match_created_before ($$) { #{{{
|
|||
}
|
||||
} #}}}
|
||||
|
||||
sub match_created_after ($$) { #{{{
|
||||
sub match_created_after ($$$) { #{{{
|
||||
my $page=shift;
|
||||
my $testpage=shift;
|
||||
|
||||
|
@ -1007,15 +1020,15 @@ sub match_created_after ($$) { #{{{
|
|||
}
|
||||
} #}}}
|
||||
|
||||
sub match_creation_day ($$) { #{{{
|
||||
sub match_creation_day ($$$) { #{{{
|
||||
return ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift);
|
||||
} #}}}
|
||||
|
||||
sub match_creation_month ($$) { #{{{
|
||||
sub match_creation_month ($$$) { #{{{
|
||||
return ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift);
|
||||
} #}}}
|
||||
|
||||
sub match_creation_year ($$) { #{{{
|
||||
sub match_creation_year ($$$) { #{{{
|
||||
return ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift);
|
||||
} #}}}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ sub preprocess_if (@) { #{{{
|
|||
# tests.
|
||||
if ($params{test} =~ /^(enabled|sourcepage|destpage)\((.*)\)$/) {
|
||||
$result=eval "IkiWiki::PageSpec::match_$1(undef, ".
|
||||
IkiWiki::safequote($2).")";
|
||||
IkiWiki::safequote($2).", \$params{page})";
|
||||
}
|
||||
else {
|
||||
add_depends($params{page}, $params{test});
|
||||
|
@ -59,7 +59,7 @@ sub preprocess_if (@) { #{{{
|
|||
|
||||
package IkiWiki::PageSpec;
|
||||
|
||||
sub match_enabled ($$) { #{{{
|
||||
sub match_enabled ($$$) { #{{{
|
||||
shift;
|
||||
my $plugin=shift;
|
||||
|
||||
|
@ -67,7 +67,7 @@ sub match_enabled ($$) { #{{{
|
|||
return UNIVERSAL::can("IkiWiki::Plugin::".$plugin, "import");
|
||||
} #}}}
|
||||
|
||||
sub match_sourcepage ($$) { #{{{
|
||||
sub match_sourcepage ($$$) { #{{{
|
||||
shift;
|
||||
my $glob=shift;
|
||||
|
||||
|
@ -75,7 +75,7 @@ sub match_sourcepage ($$) { #{{{
|
|||
$IkiWiki::Plugin::conditional::sourcepage);
|
||||
} #}}}
|
||||
|
||||
sub match_destpage ($$) { #{{{
|
||||
sub match_destpage ($$$) { #{{{
|
||||
shift;
|
||||
my $glob=shift;
|
||||
|
||||
|
@ -83,7 +83,7 @@ sub match_destpage ($$) { #{{{
|
|||
$IkiWiki::Plugin::conditional::sourcepage);
|
||||
} #}}}
|
||||
|
||||
sub match_included ($$) { #{{{
|
||||
sub match_included ($$$) { #{{{
|
||||
return $IkiWiki::Plugin::conditional::sourcepage ne $IkiWiki::Plugin::conditional::destpage;
|
||||
} #}}}
|
||||
|
||||
|
|
|
@ -121,11 +121,13 @@ sub preprocess_inline (@) { #{{{
|
|||
my $atomurl=atompage(basename($params{page}));
|
||||
my $ret="";
|
||||
|
||||
if (exists $params{rootpage} && $config{cgiurl}) {
|
||||
if ($config{cgiurl} && (exists $params{rootpage} ||
|
||||
(exists $params{postform} && yesno($params{postform})))) {
|
||||
# Add a blog post form, with feed buttons.
|
||||
my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
|
||||
$formtemplate->param(cgiurl => $config{cgiurl});
|
||||
$formtemplate->param(rootpage => $params{rootpage});
|
||||
$formtemplate->param(rootpage =>
|
||||
exists $params{rootpage} ? $params{rootpage} : $params{page});
|
||||
$formtemplate->param(rssurl => $rssurl) if $feeds && $rss;
|
||||
$formtemplate->param(atomurl => $atomurl) if $feeds && $atom;
|
||||
$ret.=$formtemplate->output;
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
ikiwiki (1.48) UNRELEASED; urgency=low
|
||||
|
||||
* Fix link() PageSpecs to not just look at the raw link text, but at where
|
||||
that given link points based on the page doing the linking. Note that this
|
||||
could make such PageSpecs match different things than before, if you
|
||||
relied on the old behavior of them only matching the raw link text.
|
||||
* This required changing the match_* interface, adding a third parameter.
|
||||
* Allow link() PageSpecs to match relative, as is allowed with globs.a
|
||||
* Add postform option to inline plugin.
|
||||
* Add an bug tracker to the softwaresite example.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Wed, 21 Mar 2007 16:58:00 -0400
|
||||
|
||||
ikiwiki (1.47) unstable; urgency=low
|
||||
|
||||
* Fix a security hole that allowed insertion of unsafe content via the meta
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
This is FooBar's bug list. Link bugs to [[bugs/done]] when done.
|
||||
|
||||
[[inline pages="./bugs/* and !./bugs/done and !link(done)
|
||||
and !*/Discussion" actions=yes postform=yes show=0]]
|
|
@ -0,0 +1,3 @@
|
|||
recently fixed [[bugs]]
|
||||
|
||||
[[inline pages="./* and link(./done) and !*/Discussion" show=10]]
|
|
@ -0,0 +1,4 @@
|
|||
FooBar, when used with the `--frob` option, fails to properly forbnicate
|
||||
output.
|
||||
|
||||
> This is fixed in [[news/version_1.0]]; marking this bug [[done]].
|
|
@ -4,6 +4,7 @@ your example program needs. This is its wiki.
|
|||
* [[download]]
|
||||
* [[news]]
|
||||
* [[documentation|doc]]
|
||||
* [[bugs]]
|
||||
* [[contact]]
|
||||
|
||||
----
|
||||
|
|
|
@ -29,7 +29,9 @@ directive:
|
|||
configured to use atom feeds, set to "no" to disable.
|
||||
* `feeds` - controls generation of all types of feeds. Set to "no" to
|
||||
disable generating any feeds.
|
||||
* `rootpage` - Enables a form to post new pages to a [[blog]].
|
||||
* `postform` - Set to "yes" to enables a form to post new pages to a [[blog]].
|
||||
* `rootpage` - Also enables a form to post new pages to a [[blog]], and
|
||||
allows specifying of a page that is used as the parent page for new pages.
|
||||
* `archive` - If set to "yes", only list page titles and some metadata, not
|
||||
full controls.
|
||||
* `quick` - Build archives in quick mode, without reading page contents for
|
||||
|
|
|
@ -431,6 +431,7 @@ See [[about_RCS_backends]] for some more info.
|
|||
It's also possible to write plugins that add new functions to
|
||||
[[PageSpecs|PageSpec]]. Such a plugin should add a function to the
|
||||
IkiWiki::PageSpec package, that is named `match_foo`, where "foo()" is
|
||||
how it will be accessed in a [[PageSpec]]. The function will be passed two
|
||||
parameters: The name of the page being matched, and the thing to match
|
||||
against. It should return true if the page matches.
|
||||
how it will be accessed in a [[PageSpec]]. The function will be passed
|
||||
three parameters: The name of the page being matched, the thing to match
|
||||
against, and the page that the matching is occuring on. It should return
|
||||
true if the page matches.
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2007-03-21 15:14-0400\n"
|
||||
"POT-Creation-Date: 2007-03-21 18:59-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -30,7 +30,7 @@ msgid "%s is not an editable page"
|
|||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
|
||||
#: ../IkiWiki/Plugin/inline.pm:172 ../IkiWiki/Plugin/opendiscussion.pm:17
|
||||
#: ../IkiWiki/Plugin/inline.pm:174 ../IkiWiki/Plugin/opendiscussion.pm:17
|
||||
#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:97
|
||||
#: ../IkiWiki/Render.pm:165
|
||||
msgid "discussion"
|
||||
|
@ -152,16 +152,16 @@ msgstr ""
|
|||
msgid "unknown sort type %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:143
|
||||
#: ../IkiWiki/Plugin/inline.pm:145
|
||||
#, perl-format
|
||||
msgid "nonexistant template %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:180 ../IkiWiki/Render.pm:101
|
||||
#: ../IkiWiki/Plugin/inline.pm:182 ../IkiWiki/Render.pm:101
|
||||
msgid "Discussion"
|
||||
msgstr ""
|
||||
|
||||
#: ../IkiWiki/Plugin/inline.pm:395
|
||||
#: ../IkiWiki/Plugin/inline.pm:397
|
||||
msgid "RPC::XML::Client not found, not pinging"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
use warnings;
|
||||
use strict;
|
||||
use Test::More tests => 42;
|
||||
use Test::More tests => 46;
|
||||
|
||||
BEGIN { use_ok("IkiWiki"); }
|
||||
|
||||
|
@ -25,11 +25,28 @@ ok(pagespec_match("a/b/foo", "./*", "a/b"), "relative 2");
|
|||
ok(pagespec_match("foo", "./*", "a"), "relative toplevel");
|
||||
ok(pagespec_match("foo/bar", "*", "baz"), "absolute");
|
||||
|
||||
# The link and backlink stuff needs this.
|
||||
$config{userdir}="";
|
||||
$links{foo}=[qw{bar baz}];
|
||||
ok(pagespec_match("foo", "link(bar)", ""));
|
||||
ok(! pagespec_match("foo", "link(quux)", ""));
|
||||
ok(pagespec_match("bar", "backlink(foo)", ""));
|
||||
ok(! pagespec_match("quux", "backlink(foo)", ""));
|
||||
$links{bar}=[];
|
||||
$links{baz}=[];
|
||||
$links{"bugs/foo"}=[qw{bugs/done}];
|
||||
$links{"bugs/done"}=[];
|
||||
$links{"bugs/bar"}=[qw{done}];
|
||||
$links{"done"}=[];
|
||||
$links{"examples/softwaresite/bugs/fails_to_frobnicate"}=[qw{done}];
|
||||
$links{"examples/softwaresite/bugs/done"}=[];
|
||||
|
||||
ok(pagespec_match("foo", "link(bar)", ""), "link");
|
||||
ok(! pagespec_match("foo", "link(quux)", ""), "failed link");
|
||||
ok(pagespec_match("bugs/foo", "link(done)", "bugs/done"), "link match to bestlink");
|
||||
ok(! pagespec_match("examples/softwaresite/bugs/done", "link(done)",
|
||||
"bugs/done"), "link match to bestlink");
|
||||
ok(pagespec_match("examples/softwaresite/bugs/fails_to_frobnicate",
|
||||
"link(./done)", "examples/softwaresite/bugs/done"), "link relative");
|
||||
ok(! pagespec_match("foo", "link(./bar)", "foo/bar"), "link relative fail");
|
||||
ok(pagespec_match("bar", "backlink(foo)", ""), "backlink");
|
||||
ok(! pagespec_match("quux", "backlink(foo)", ""), "failed backlink");
|
||||
|
||||
$IkiWiki::pagectime{foo}=1154532692; # Wed Aug 2 11:26 EDT 2006
|
||||
$IkiWiki::pagectime{bar}=1154532695; # after
|
||||
|
|
Loading…
Reference in New Issue