Photos
Blog
Projects
vanrenterghem.biz
projects
/
git.ikiwiki.info.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
866cdd7
)
* Apply a patch from Carl Worth adding support for using globs in link()
author
joey
<joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 30 May 2007 19:54:08 +0000
(19:54 +0000)
committer
joey
<joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 30 May 2007 19:54:08 +0000
(19:54 +0000)
in a PageSpec.
IkiWiki.pm
patch
|
blob
|
history
debian/changelog
patch
|
blob
|
history
doc/pagespec.mdwn
patch
|
blob
|
history
doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn
patch
|
blob
|
history
po/ikiwiki.pot
patch
|
blob
|
history
t/pagespec_match.t
patch
|
blob
|
history
diff --git
a/IkiWiki.pm
b/IkiWiki.pm
index 761160eca5056d87f947f322c0853060d27a2021..8143f5256d8618b9d5da77ff51e27780a845b6f5 100644
(file)
--- a/
IkiWiki.pm
+++ b/
IkiWiki.pm
@@
-1056,8
+1056,8
@@
sub match_glob ($$;@) { #{{{
# relative matching
if ($glob =~ m!^\./!) {
# relative matching
if ($glob =~ m!^\./!) {
- $from=~s
!/?[^/]+$!!
;
- $glob=~s
!^\./!!
;
+ $from=~s
#/?[^/]+$##
;
+ $glob=~s
#^\./##
;
$glob="$from/$glob" if length $from;
}
$glob="$from/$glob" if length $from;
}
@@
-1083,18
+1083,23
@@
sub match_link ($$;@) { #{{{
# relative matching
if ($link =~ m!^\.! && defined $from) {
# relative matching
if ($link =~ m!^\.! && defined $from) {
- $from=~s
!/?[^/]+$!!
;
- $link=~s
!^\./!!
;
+ $from=~s
#/?[^/]+$##
;
+ $link=~s
#^\./##
;
$link="$from/$link" if length $from;
}
my $links = $IkiWiki::links{$page} or return undef;
return IkiWiki::FailReason->new("$page has no links") unless @$links;
my $bestlink = IkiWiki::bestlink($from, $link);
$link="$from/$link" if length $from;
}
my $links = $IkiWiki::links{$page} or return undef;
return IkiWiki::FailReason->new("$page has no links") unless @$links;
my $bestlink = IkiWiki::bestlink($from, $link);
- return IkiWiki::FailReason->new("no such link") unless length $bestlink;
foreach my $p (@$links) {
foreach my $p (@$links) {
- return IkiWiki::SuccessReason->new("$page links to $link")
- if $bestlink eq IkiWiki::bestlink($page, $p);
+ if (length $bestlink) {
+ return IkiWiki::SuccessReason->new("$page links to $link")
+ if $bestlink eq IkiWiki::bestlink($page, $p);
+ }
+ else {
+ return IkiWiki::SuccessReason->new("$page links to page matching $link")
+ if match_glob($p, $link, %params);
+ }
}
return IkiWiki::FailReason->new("$page does not link to $link");
} #}}}
}
return IkiWiki::FailReason->new("$page does not link to $link");
} #}}}
diff --git
a/debian/changelog
b/debian/changelog
index b50da4a407f344d938d8f554446f3efe1aa07b47..0589f56878e7ce276dc6bcfd3fb3a39cc9690afd 100644
(file)
--- a/
debian/changelog
+++ b/
debian/changelog
@@
-28,6
+28,8
@@
ikiwiki (2.2) UNRELEASED; urgency=low
doesn't specify encoding, and variously broken feed consumers, according
to <http://www.rssboard.org/rss-profile#data-types-characterdata>.
* Correct some issues with display of unhandled preprocessor directives.
doesn't specify encoding, and variously broken feed consumers, according
to <http://www.rssboard.org/rss-profile#data-types-characterdata>.
* Correct some issues with display of unhandled preprocessor directives.
+ * Apply a patch from Carl Worth adding support for using globs in link()
+ in a PageSpec.
-- Joey Hess <joeyh@debian.org> Mon, 28 May 2007 21:56:11 -0400
-- Joey Hess <joeyh@debian.org> Mon, 28 May 2007 21:56:11 -0400
diff --git
a/doc/pagespec.mdwn
b/doc/pagespec.mdwn
index b26a42e2803db992f4e9e042c8a925904bffafee..e004de4af9a0e7238e9bac017b1a1ad064e512fc 100644
(file)
--- a/
doc/pagespec.mdwn
+++ b/
doc/pagespec.mdwn
@@
-24,7
+24,7
@@
match all pages except for Discussion pages and the SandBox:
Some more elaborate limits can be added to what matches using any of these
functions:
Some more elaborate limits can be added to what matches using any of these
functions:
-* "`link(page)`" - match only pages that link to a given page
+* "`link(page)`" - match only pages that link to a given page
(or glob)
* "`backlink(page)`" - match only pages that a given page links to
* "`creation_month(month)`" - match only pages created on the given month
* "`creation_day(mday)`" - or day of the month
* "`backlink(page)`" - match only pages that a given page links to
* "`creation_month(month)`" - match only pages created on the given month
* "`creation_day(mday)`" - or day of the month
diff --git
a/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn
b/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn
index 4197cece7353cb4fa67735e202d2f64c2d519010..24f9054f749c683d2f59d48fdcf40fafff707346 100644
(file)
--- a/
doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn
+++ b/
doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn
@@
-41,3
+41,5
@@
That doesn't work in ikiwiki 2.1, but I have it
} #}}}
--
1.5.1.1.g6aead
} #}}}
--
1.5.1.1.g6aead
+
+Thanks! [[done]] --[[Joey]]
diff --git
a/po/ikiwiki.pot
b/po/ikiwiki.pot
index 55e8429d8c8263590d1f15c2be524e733666c3b7..e63ead2fba21b1153a29cd1674c0d55bf24eca10 100644
(file)
--- a/
po/ikiwiki.pot
+++ b/
po/ikiwiki.pot
@@
-8,7
+8,7
@@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-05-
24 15:47
-0400\n"
+"POT-Creation-Date: 2007-05-
30 15:53
-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"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git
a/t/pagespec_match.t
b/t/pagespec_match.t
index 635381e2bccc9ce0573ee14eb59c2662914e2330..3a641c6a8b13bbf54365819e63240e24b41971b5 100755
(executable)
--- a/
t/pagespec_match.t
+++ b/
t/pagespec_match.t
@@
-1,7
+1,7
@@
#!/usr/bin/perl
use warnings;
use strict;
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 5
2
;
+use Test::More tests => 5
4
;
BEGIN { use_ok("IkiWiki"); }
BEGIN { use_ok("IkiWiki"); }
@@
-40,7
+40,9
@@
$links{"examples/softwaresite/bugs/fails_to_frobnicate"}=[qw{done}];
$links{"examples/softwaresite/bugs/done"}=[];
ok(pagespec_match("foo", "link(bar)"), "link");
$links{"examples/softwaresite/bugs/done"}=[];
ok(pagespec_match("foo", "link(bar)"), "link");
+ok(pagespec_match("foo", "link(ba?)"), "glob link");
ok(! pagespec_match("foo", "link(quux)"), "failed link");
ok(! pagespec_match("foo", "link(quux)"), "failed link");
+ok(! pagespec_match("foo", "link(qu*)"), "failed glob link");
ok(pagespec_match("bugs/foo", "link(done)", location => "bugs/done"), "link match to bestlink");
ok(! pagespec_match("examples/softwaresite/bugs/done", "link(done)",
location => "bugs/done"), "link match to bestlink");
ok(pagespec_match("bugs/foo", "link(done)", location => "bugs/done"), "link match to bestlink");
ok(! pagespec_match("examples/softwaresite/bugs/done", "link(done)",
location => "bugs/done"), "link match to bestlink");