From c721a9ef872db85b26d430a2098234a4fca6ec51 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:41:06 -0400 Subject: my autotag branch --- .../auto-create_tag_pages_according_to_a_template.mdwn | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn index def55f3ee..867306f0d 100644 --- a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn +++ b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn @@ -269,14 +269,12 @@ wrong direction. >> True. I'll do that. --[[David_Riebenbauer]] -> Seems that `%autofiles` stores plugin names as keys, but never -> really uses them. So it could just as easily be an array. -> -> I'd be happy if the `%del_hash` global were not needed. -> Looks like it could be avoided by moving the checks -> that `add_autofile` does into the autofile handling loop in -> `Render`. (Also, that loop should probably be in its own -> function anyway.) --[[Joey]] +>> I've pushed an autotag branch of my own, which refactors +>> things a bit. It is untested so far though. --[[Joey]] +>> +>> * `verify_src_file` only called from Render.pm +>> * Gets rid of `%del_files`. +>> * Uses `%wikistate`. [f3abeac919c4736429bd3362af6edf51ede8e7fe]: http://git.liegesta.at/?p=ikiwiki.git;a=commitdiff;h=f3abeac919c4736429bd3362af6edf51ede8e7fe (commitdiff for f3abeac919c4736429bd3362af6edf51ede8e7fe) [4af4d26582f0c2b915d7102fb4a604b176385748]: http://git.liegesta.at/?p=ikiwiki.git;a=commitdiff;h=4af4d26582f0c2b915d7102fb4a604b176385748 (commitdiff for 4af4d26582f0c2b915d7102fb4a604b176385748) -- cgit v1.2.3 From 9fbef7e1d2c4e8bbaf3eaf89885f18b88edbe429 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:42:50 -0400 Subject: reformat --- doc/todo/auto-create_tag_pages_according_to_a_template.mdwn | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn index 867306f0d..ed681ac4d 100644 --- a/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn +++ b/doc/todo/auto-create_tag_pages_according_to_a_template.mdwn @@ -269,12 +269,13 @@ wrong direction. >> True. I'll do that. --[[David_Riebenbauer]] ->> I've pushed an autotag branch of my own, which refactors ->> things a bit. It is untested so far though. --[[Joey]] ->> ->> * `verify_src_file` only called from Render.pm ->> * Gets rid of `%del_files`. ->> * Uses `%wikistate`. +[[!template id=gitbranch branch=origin/autotag author="[[Joey]]"]] +I've pushed an autotag branch of my own, which refactors +things a bit. It is untested so far though. --[[Joey]] + +* `verify_src_file` only called from Render.pm +* Gets rid of `%del_files`. +* Uses `%wikistate`. [f3abeac919c4736429bd3362af6edf51ede8e7fe]: http://git.liegesta.at/?p=ikiwiki.git;a=commitdiff;h=f3abeac919c4736429bd3362af6edf51ede8e7fe (commitdiff for f3abeac919c4736429bd3362af6edf51ede8e7fe) [4af4d26582f0c2b915d7102fb4a604b176385748]: http://git.liegesta.at/?p=ikiwiki.git;a=commitdiff;h=4af4d26582f0c2b915d7102fb4a604b176385748 (commitdiff for 4af4d26582f0c2b915d7102fb4a604b176385748) -- cgit v1.2.3 From a1aa71efc9d1db42b425f43afc1ff4a37c4c0f3a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:49:20 -0400 Subject: document the gitbranch template --- doc/git.mdwn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/git.mdwn b/doc/git.mdwn index 55967e543..0f280fb35 100644 --- a/doc/git.mdwn +++ b/doc/git.mdwn @@ -65,6 +65,10 @@ think about merging them. This is recommended. :-) ## branches +In order to refer to a branch in one of the above git repositories, for +example when submitting a [[patch]], you can use the +[[templates/gitbranch]] template. + Some of the branches included in the main repository include: * `gallery` contains the [[todo/Gallery]] plugin. It's not yet merged -- cgit v1.2.3 From 9ff5174f1164cb2d31ff487a9c84d08559b81d39 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Apr 2010 18:45:23 +0200 Subject: Fix get_ctime implementation in Bazaar plugin, add get_mtime implementation. --- IkiWiki/Plugin/bzr.pm | 28 +++++++++++++++++++--------- t/bazaar.t | 5 ++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index f79ca7c8f..3712302ce 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -286,14 +286,8 @@ sub rcs_diff ($) { } } -sub rcs_getctime ($) { - my ($file) = @_; - - # XXX filename passes through the shell here, should try to avoid - # that just in case - my @cmdline = ("bzr", "log", "--limit", '1', "$config{srcdir}/$file"); - open (my $out, "@cmdline |"); - +sub extract_timestamp ($) { + my ($out) = @_; my @log = bzr_log($out); if (length @log < 1) { @@ -307,8 +301,24 @@ sub rcs_getctime ($) { return $ctime; } +sub rcs_getctime ($) { + my ($file) = @_; + + # XXX filename passes through the shell here, should try to avoid + # that just in case + my @cmdline = ("bzr", "log", "--forward", "--limit", '1', "$config{srcdir}/$file"); + open (my $out, "@cmdline |"); + return extract_timestamp($out); +} + sub rcs_getmtime ($) { - error "rcs_getmtime is not implemented for bzr\n"; # TODO + my ($file) = @_; + + # XXX filename passes through the shell here, should try to avoid + # that just in case + my @cmdline = ("bzr", "log", "--limit", '1', "$config{srcdir}/$file"); + open (my $out, "@cmdline |"); + return extract_timestamp($out); } 1 diff --git a/t/bazaar.t b/t/bazaar.t index 2ca44a65e..0bdd883d5 100755 --- a/t/bazaar.t +++ b/t/bazaar.t @@ -12,7 +12,7 @@ BEGIN { } } } -use Test::More tests => 16; +use Test::More tests => 17; BEGIN { use_ok("IkiWiki"); } @@ -60,6 +60,9 @@ is($changes[1]{pages}[0]{"page"}, "test1"); my $ctime = IkiWiki::rcs_getctime("test2.mdwn"); ok($ctime >= time() - 20); +my $mtime = IkiWiki::rcs_getmtime("test2.mdwn"); +ok($mtime >= time() - 20); + writefile('test3.mdwn', $config{srcdir}, $test1); IkiWiki::rcs_add("test3.mdwn"); IkiWiki::rcs_rename("test3.mdwn", "test4.mdwn"); -- cgit v1.2.3 From 2f9504a10d87f6950325dcea2d8a1f5a5d3eefe4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:55:32 -0400 Subject: bzr: changelog and refactor --- IkiWiki/Plugin/bzr.pm | 20 ++++++++------------ debian/changelog | 2 ++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 3712302ce..e7c1b8d8e 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -286,8 +286,10 @@ sub rcs_diff ($) { } } -sub extract_timestamp ($) { - my ($out) = @_; +sub extract_timestamp (@) { + # XXX filename passes through the shell here, should try to avoid + # that just in case + open (my $out, "@_ |"); my @log = bzr_log($out); if (length @log < 1) { @@ -297,28 +299,22 @@ sub extract_timestamp ($) { eval q{use Date::Parse}; error($@) if $@; - my $ctime = str2time($log[0]->{"timestamp"}); - return $ctime; + my $time = str2time($log[0]->{"timestamp"}); + return $time; } sub rcs_getctime ($) { my ($file) = @_; - # XXX filename passes through the shell here, should try to avoid - # that just in case my @cmdline = ("bzr", "log", "--forward", "--limit", '1', "$config{srcdir}/$file"); - open (my $out, "@cmdline |"); - return extract_timestamp($out); + return extract_timestamp(@cmdline); } sub rcs_getmtime ($) { my ($file) = @_; - # XXX filename passes through the shell here, should try to avoid - # that just in case my @cmdline = ("bzr", "log", "--limit", '1', "$config{srcdir}/$file"); - open (my $out, "@cmdline |"); - return extract_timestamp($out); + return extract_timestamp(@cmdline); } 1 diff --git a/debian/changelog b/debian/changelog index 01d650290..b7ec99463 100644 --- a/debian/changelog +++ b/debian/changelog @@ -60,6 +60,8 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low timestamps on basewiki files shipped in the deb are sane. * autoindex: Switch to using %wikistate instead of abusing $pagestate{index}. + * bzr: Support rcs_getmtime, and fix rcs_getctime implementation + (Jelmer Vernooij) -- Joey Hess Sun, 04 Apr 2010 12:17:11 -0400 -- cgit v1.2.3 From 6f485b8f459549521541af7bb087185dada112bf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:57:59 -0400 Subject: note that tla plugin is not being maintained --- doc/rcs/tla.mdwn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/rcs/tla.mdwn b/doc/rcs/tla.mdwn index cad5d51f4..79eecd627 100644 --- a/doc/rcs/tla.mdwn +++ b/doc/rcs/tla.mdwn @@ -2,6 +2,9 @@ [GNU](http://www.gnu.org/) [Arch](http://www.gnuarch.org/) revision control system. Ikiwiki supports storing a wiki in tla. +Warning: Since tla is not being maintained, neither is this plugin, and +using ikiwiki with tla is not recommended. + Ikiwiki can run as a [[post-commit]] hook to update a wiki whenever commits come in. When running as a [[cgi]] with tla, ikiwiki automatically commits edited pages to the Arch repostory, and uses the Arch -- cgit v1.2.3 From cd8ec309d26cbc3f634328cb90e4c9d38b404632 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 13:58:31 -0400 Subject: bzr getmtime done --- doc/rcs.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rcs.mdwn b/doc/rcs.mdwn index 450d16800..8b9929920 100644 --- a/doc/rcs.mdwn +++ b/doc/rcs.mdwn @@ -28,7 +28,7 @@ auto.setup |yes |yes |incomplete|yes |incomplete |yes `rcs_remove` |yes |yes |yes |yes |no |yes |no |yes `rcs_diff` |yes |yes |yes |yes |no |yes |yes |yes `rcs_getctime` |fast |slow |slow |slow |slow |slow |slow |slow -`rcs_getmtime` |fast |slow |no |no |no |no |no |no +`rcs_getmtime` |fast |slow |slow |no |no |no |no |no anonymous push |yes |no |no |no |no |no |no |no conflict handling |yes |yes |yes |buggy |yes |yes |yes |yes """]] -- cgit v1.2.3 From e289e0b4ba48d01e24586dbdcaeda367763edd67 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 14:00:25 -0400 Subject: recommend git --- doc/rcs.mdwn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/rcs.mdwn b/doc/rcs.mdwn index 8b9929920..248d93024 100644 --- a/doc/rcs.mdwn +++ b/doc/rcs.mdwn @@ -6,8 +6,7 @@ histories. Ikiwiki started out supporting only [[Subversion|svn]], but the interface ikiwiki uses to a revision control system is sufficiently simple and generic that it can be adapted to work with many systems by writing a -[[plugin|plugins/write]]. [[Subversion|svn]] is still a recommended choice; -[[git]] is another well-tested option. +[[plugin|plugins/write]]. These days, most people use [[git]]. While all supported revision control systems work well enough for basic use, some advanced or special features are not supported in all of them. -- cgit v1.2.3 From a97964688b73d0a3237c798dce3fb064ff29ff11 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Apr 2010 19:05:40 -0400 Subject: unfinished file_prune revamp Many calls to file_prune were incorrectly calling it with 2 parameters. In cases where the filename being checked is relative to the srcdir, that is not needed. Made absolute filenames be pruned. (This won't work for the 2 parameter call style.) --- IkiWiki.pm | 2 +- IkiWiki/Plugin/attachment.pm | 2 +- IkiWiki/Plugin/comments.pm | 4 ++-- IkiWiki/Plugin/editpage.pm | 4 ++-- IkiWiki/Plugin/rename.pm | 5 ++--- IkiWiki/Receive.pm | 2 +- t/file_pruned.t | 40 +++++++++++++++++++++++++++++++++++++--- 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index b37b1f344..a5f83ac7a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -355,7 +355,7 @@ sub getsetup () { }, wiki_file_prune_regexps => { type => "internal", - default => [qr/(^|\/)\.\.(\/|$)/, qr/^\./, qr/\/\./, + default => [qr/(^|\/)\.\.(\/|$)/, qr/^\//, qr/^\./, qr/\/\./, qr/\.x?html?$/, qr/\.ikiwiki-new$/, qr/(^|\/).svn\//, qr/.arch-ids\//, qr/{arch}\//, qr/(^|\/)_MTN\//, qr/(^|\/)_darcs\//, diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index ad1dd9bca..8c3ff887a 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -137,7 +137,7 @@ sub formbuilder (@) { $filename=linkpage(IkiWiki::possibly_foolish_untaint( attachment_location($form->field('page')). IkiWiki::basename($filename))); - if (IkiWiki::file_pruned($filename, $config{srcdir})) { + if (IkiWiki::file_pruned($filename)) { error(gettext("bad attachment filename")); } diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 0aa043215..1c219b6c6 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -338,7 +338,7 @@ sub editcomment ($$) { my $page = $form->field('page'); $page = IkiWiki::possibly_foolish_untaint($page); if (! defined $page || ! length $page || - IkiWiki::file_pruned($page, $config{srcdir})) { + IkiWiki::file_pruned($page)) { error(gettext("bad page name")); } @@ -548,7 +548,7 @@ sub commentmoderation ($$) { # pending comment before untainting. my ($f)= $id =~ /$config{wiki_file_regexp}/; if (! defined $f || ! length $f || - IkiWiki::file_pruned($f, $config{srcdir})) { + IkiWiki::file_pruned($f)) { error("illegal file"); } diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 44fe5514a..ee1de8eaa 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -94,7 +94,7 @@ sub cgi_editpage ($$) { $page=possibly_foolish_untaint($page); my $absolute=($page =~ s#^/+##); if (! defined $page || ! length $page || - file_pruned($page, $config{srcdir})) { + file_pruned($page)) { error(gettext("bad page name")); } @@ -220,7 +220,7 @@ sub cgi_editpage ($$) { my $best_loc; if (! defined $from || ! length $from || $from ne $form->field('from') || - file_pruned($from, $config{srcdir}) || + file_pruned($from) || $from=~/^\// || $absolute || $form->submitted) { diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 1a9da6363..69e615ead 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -63,9 +63,8 @@ sub check_canrename ($$$$$$) { error(gettext("no change to the file name was specified")); } - # Must be a legal filename, and not absolute. - if (IkiWiki::file_pruned($destfile, $config{srcdir}) || - $destfile=~/^\//) { + # Must be a legal filename. + if (IkiWiki::file_pruned($destfile)) { error(sprintf(gettext("illegal name"))); } diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index cd94d0938..ae1bd8bef 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -82,7 +82,7 @@ sub test () { my ($file)=$change->{file}=~/$config{wiki_file_regexp}/; $file=IkiWiki::possibly_foolish_untaint($file); if (! defined $file || ! length $file || - IkiWiki::file_pruned($file, $config{srcdir})) { + IkiWiki::file_pruned($file)) { error(gettext("bad file name %s"), $file); } diff --git a/t/file_pruned.t b/t/file_pruned.t index f9c1c257e..4335ed917 100755 --- a/t/file_pruned.t +++ b/t/file_pruned.t @@ -1,41 +1,75 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 27; +use Test::More tests => 54; BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); ok(IkiWiki::file_pruned("src/.htaccess", "src")); +ok(IkiWiki::file_pruned(".htaccess")); ok(IkiWiki::file_pruned("src/.ikiwiki/", "src")); +ok(IkiWiki::file_pruned(".ikiwiki/")); ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src")); +ok(IkiWiki::file_pruned(".ikiwiki/index")); ok(IkiWiki::file_pruned("src/CVS/foo", "src")); +ok(IkiWiki::file_pruned("CVS/foo")); ok(IkiWiki::file_pruned("src/subdir/CVS/foo", "src")); +ok(IkiWiki::file_pruned("subdir/CVS/foo")); ok(IkiWiki::file_pruned("src/.svn", "src")); +ok(IkiWiki::file_pruned(".svn")); ok(IkiWiki::file_pruned("src/subdir/.svn", "src")); +ok(IkiWiki::file_pruned("subdir/.svn")); ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src")); +ok(IkiWiki::file_pruned("subdir/.svn/foo")); ok(IkiWiki::file_pruned("src/.git", "src")); +ok(IkiWiki::file_pruned(".git")); ok(IkiWiki::file_pruned("src/subdir/.git", "src")); +ok(IkiWiki::file_pruned("subdir/.git")); ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src")); +ok(IkiWiki::file_pruned("subdir/.git/foo")); ok(! IkiWiki::file_pruned("src/svn/fo", "src")); +ok(! IkiWiki::file_pruned("svn/fo")); ok(! IkiWiki::file_pruned("src/git", "src")); +ok(! IkiWiki::file_pruned("git")); ok(! IkiWiki::file_pruned("src/index.mdwn", "src")); +ok(! IkiWiki::file_pruned("index.mdwn")); ok(! IkiWiki::file_pruned("src/index.", "src")); +ok(! IkiWiki::file_pruned("index.")); # these are ok because while the filename starts with ".", the canonpathed # version does not ok(! IkiWiki::file_pruned("src/.", "src")); ok(! IkiWiki::file_pruned("src/./", "src")); +# OTOH, without a srcdir, no canonpath, so they're not allowed. +ok(IkiWiki::file_pruned(".")); +ok(IkiWiki::file_pruned("./")); + +# Without a srcdir, absolute filenames are not allowed. +ok(IkiWiki::file_pruned("/etc/passwd")); +ok(IkiWiki::file_pruned("//etc/passwd")); +ok(IkiWiki::file_pruned("/")); +ok(IkiWiki::file_pruned("//")); +ok(IkiWiki::file_pruned("///")); + ok(IkiWiki::file_pruned("src/..", "src")); +ok(IkiWiki::file_pruned("..")); ok(IkiWiki::file_pruned("src/../", "src")); +ok(IkiWiki::file_pruned("../")); ok(IkiWiki::file_pruned("src/../", "src")); +ok(IkiWiki::file_pruned("../")); +# This is perhaps counterintuitive. ok(! IkiWiki::file_pruned("src", "src")); + +# Dots, etc, in the srcdir are ok. ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src")); ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src")); ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn")); -ok(IkiWiki::file_pruned("x/y/foo.dpkg-tmp", "src")); -ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src")); +ok(IkiWiki::file_pruned("src/y/foo.dpkg-tmp", "src")); +ok(IkiWiki::file_pruned("y/foo.dpkg-tmp")); +ok(IkiWiki::file_pruned("src/y/foo.ikiwiki-new", "src")); +ok(IkiWiki::file_pruned("y/foo.ikiwiki-new")); -- cgit v1.2.3 From 56bf9c04a290cfce6270f974c1d48be8a5d54942 Mon Sep 17 00:00:00 2001 From: PeteG Date: Sun, 18 Apr 2010 12:33:51 +0000 Subject: --- doc/peteg.mdwn | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 doc/peteg.mdwn diff --git a/doc/peteg.mdwn b/doc/peteg.mdwn new file mode 100644 index 000000000..90593c16f --- /dev/null +++ b/doc/peteg.mdwn @@ -0,0 +1,7 @@ +I'm adding some plugins to Ikiwiki to support a bioacoustic wiki. See here: + + + +Personal home page: + +http://peteg.org/ -- cgit v1.2.3 From 472694b8b420be128c1d9d0ba8393ea6efff8716 Mon Sep 17 00:00:00 2001 From: PeteG Date: Sun, 18 Apr 2010 12:34:20 +0000 Subject: --- doc/peteg.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/peteg.mdwn b/doc/peteg.mdwn index 90593c16f..4e2face0e 100644 --- a/doc/peteg.mdwn +++ b/doc/peteg.mdwn @@ -4,4 +4,4 @@ I'm adding some plugins to Ikiwiki to support a bioacoustic wiki. See here: Personal home page: -http://peteg.org/ + -- cgit v1.2.3 From 63e6c00890a11144f8d035f7052a6229227fce52 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Mon, 19 Apr 2010 02:23:12 +0000 Subject: response to the further thoughts --- doc/todo/Multiple_categorization_namespaces.mdwn | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/todo/Multiple_categorization_namespaces.mdwn b/doc/todo/Multiple_categorization_namespaces.mdwn index ee3bbd88d..1861d860c 100644 --- a/doc/todo/Multiple_categorization_namespaces.mdwn +++ b/doc/todo/Multiple_categorization_namespaces.mdwn @@ -56,17 +56,25 @@ and the tags would appear at the bottom of the post, the Rubrica next to the tit Aside from the name of the plugin (and thus of the main directive), which could be `tag`, `meta`, `field` or whatever (maybe extending `meta` would be the most sensible choice), the features we want are - 1. allow multiple values per type/attribute/field/whatever (fields currently only allows one) - 2. allow both hidden and visible references (à la tag vs taglink) - 3. allow each type/attribute/field to be exposed under multiple queries (e.g. tags and categories; this is mostly important for backwards compatibility, not sure if it might have other uses too) - 4. allow arbitrary types/attributes/fields/whatever (even 'undefined' ones) +1. allow multiple values per type/attribute/field/whatever (fields currently only allows one) + * Agreed about multiple values; I've been considering whether I should add that to `field`. -- K.A. +2. allow both hidden and visible references (a la tag vs taglink) + * Hidden and visible references; that's fair enough too. My approach with `ymlfront` and `getfield` is that the YAML code is hidden, and the display is done with `getfield`, but there's no reason not to use additional approaches. -- K.A. +3. allow each type/attribute/field to be exposed under multiple queries (e.g. tags and categories; this is mostly important for backwards compatibility, not sure if it might have other uses too) + * I'm not sure what you mean here. -- K.A. +4. allow arbitrary types/attributes/fields/whatever (even 'undefined' ones) + * Are you saying that these must be typed, or are you saying that they can be user-defined? -- K.A. Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would thus have the following parameters: - * `directive` : the name of the directive that can be used to set the value as a hidden reference; we can discuss whether, for pre- or user-defined types, it being undef means no directive or a default directive matching the attribute name would be defined. - * `linkdirective` : the name of the directive that can be used for a visible reference; no such directive would be defined by default - * `linktype` : link type for (hidden and visible) references - * `linkbase` : akin to the tagbase parameter - * `queries` : list of template queries this type/attribute/field/whatever is exposed to +* `directive` : the name of the directive that can be used to set the value as a hidden reference; we can discuss whether, for pre- or user-defined types, it being undef means no directive or a default directive matching the attribute name would be defined. + * I still want there to be able to be enough flexibility in the concept to enable plugins such as `yamlfront`, which sets the data using YAML format, rather than using directives. -- K.A. +* `linkdirective` : the name of the directive that can be used for a visible reference; no such directive would be defined by default +* `linktype` : link type for (hidden and visible) references + * Is this the equivalent to "field name"? -- K.A. +* `linkbase` : akin to the tagbase parameter + * Is this a field-name -> directory mapping? -- K.A. +* `queries` : list of template queries this type/attribute/field/whatever is exposed to + * I'm not sure what you mean here. -- K.A. Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. -- cgit v1.2.3 From 99cdd38dd54047d0e79dbf65d58ba11ee38f2c92 Mon Sep 17 00:00:00 2001 From: "http://oblomov.myopenid.com/" Date: Mon, 19 Apr 2010 08:36:38 +0000 Subject: Respond --- doc/todo/Multiple_categorization_namespaces.mdwn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/todo/Multiple_categorization_namespaces.mdwn b/doc/todo/Multiple_categorization_namespaces.mdwn index 1861d860c..ae35e8dfe 100644 --- a/doc/todo/Multiple_categorization_namespaces.mdwn +++ b/doc/todo/Multiple_categorization_namespaces.mdwn @@ -62,19 +62,25 @@ Aside from the name of the plugin (and thus of the main directive), which could * Hidden and visible references; that's fair enough too. My approach with `ymlfront` and `getfield` is that the YAML code is hidden, and the display is done with `getfield`, but there's no reason not to use additional approaches. -- K.A. 3. allow each type/attribute/field to be exposed under multiple queries (e.g. tags and categories; this is mostly important for backwards compatibility, not sure if it might have other uses too) * I'm not sure what you mean here. -- K.A. + * Typical example is tags: they are accessible both as `tags` and as `categories`, although the way they are presented changes a little -- G.B. 4. allow arbitrary types/attributes/fields/whatever (even 'undefined' ones) * Are you saying that these must be typed, or are you saying that they can be user-defined? -- K.A. + * I am saying that the user should be able to define (e.g. in the config) some set of types/fields/attributes/whatever, following the specification illustrated below, but also be able to use something like `\[[!meta somefield="somevalue"]]` where `somefield` was never defined before. In this case `somefield` will have some default values for the properties described in the spec below. -- G.B. Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would thus have the following parameters: * `directive` : the name of the directive that can be used to set the value as a hidden reference; we can discuss whether, for pre- or user-defined types, it being undef means no directive or a default directive matching the attribute name would be defined. * I still want there to be able to be enough flexibility in the concept to enable plugins such as `yamlfront`, which sets the data using YAML format, rather than using directives. -- K.A. + * The possibility to use a directive does not preclude other ways of defining the field values. IOW, even if the directive `somefield` is defined, the user would still be able to use the syntax `\[[!meta somefield="somevalue"]]`, or any other syntax (such as YAML). -- G.B. * `linkdirective` : the name of the directive that can be used for a visible reference; no such directive would be defined by default * `linktype` : link type for (hidden and visible) references * Is this the equivalent to "field name"? -- K.A. + * This would be such by default, but it could be set to something different. [[Typed links|matching_different_kinds_of_links]] is a very recent ikiwiki feature. -- G.B. * `linkbase` : akin to the tagbase parameter * Is this a field-name -> directory mapping? -- K.A. + * yes, with each directory having one page per value. It might not make sense for all fields, of course -- G.B. * `queries` : list of template queries this type/attribute/field/whatever is exposed to * I'm not sure what you mean here. -- K.A. + * as mentioned before, some fields may be made accessible through different template queries, in different form. This is the case already for tags, that also come up in the `categories` query (used by Atom and RSS feeds). -- G.B. -Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. +Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries, or also see what is done with the fields in the current `meta` plugin). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. -- cgit v1.2.3 From 1b7c455f4a4214bc9df766be4ec2b12adcf679e1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Apr 2010 16:03:53 -0400 Subject: thinking about changing how templatedir works and allowing wikitemplate files into the srcdir --- doc/todo/auto_rebuild_on_template_change.mdwn | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 doc/todo/auto_rebuild_on_template_change.mdwn diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn new file mode 100644 index 000000000..c4ffae178 --- /dev/null +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -0,0 +1,33 @@ +If `page.tmpl` is changed, it would be nice if ikiwiki automatically +noticed, and rebuilt all pages. If `inlinepage.tmpl` is changed, a rebuild +of all pages using it in an inline would be stellar. + +This would allow setting: + + templatedir => "$srcdir/templates", + +.. and then the [[wikitemplates]] are managed like other wiki files; and +like other wiki files, a change to them automatically updates dependent +pages. + +Originally, it made good sense not to have the templatedir inside the wiki. +Those templates can be used to bypass the htmlscrubber, and you don't want +just anyone to edit them. But the same can be said of `style.css` and +`ikiwiki.js`, which *are* in the wiki. We rely on `allowed_attachments` +being set to secure those to prevent users uploading replacements. And we +assume that users who can directly (non-anon) commit *can* edit them, and +that's ok. + +So, perhaps the easiest way to solve this [[wishlist]] would be to +make templatedir *default* to "$srcdir/templates/, and make ikiwiki +register dependencies on `page.tmpl`, `inlinepage.tmpl`, etc, as they're +used. Although, having every page declare an explicit dep on `page.tmpl` +is perhaps a bit much; might be better to implement a special case for that +one. Also, having the templates be copied to `destdir` is not desirable. + +The risk is that a site might have `allowed_attachments` set to "templates/*" +or "*.tmpl" something like that. I think such a configuration is the *only* +risk, and it's unlikely enough that a NEWS warning should suffice. + +(This would also help to clear up the tricky disctinction between +wikitemplates and in-wiki templates.) -- cgit v1.2.3 From e1ebdda72bb14c70c9d35c29f5a6afe197623282 Mon Sep 17 00:00:00 2001 From: Svend Sorensen Date: Mon, 19 Apr 2010 16:12:09 -0700 Subject: Remove www prefix from Svend's website URLs --- doc/ikiwikiusers.mdwn | 2 +- doc/users/svend.mdwn | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ikiwikiusers.mdwn b/doc/ikiwikiusers.mdwn index 4a3e41e83..cb4213405 100644 --- a/doc/ikiwikiusers.mdwn +++ b/doc/ikiwikiusers.mdwn @@ -120,7 +120,7 @@ Personal sites and blogs * [[Adam_Trickett|ajt]]'s home intranet/sanbox system ([Internet site & blog](http://www.iredale.net/) -- not ikiwiki yet) * [[Simon_McVittie|smcv]]'s [website](http://www.pseudorandom.co.uk/) and [blog](http://smcv.pseudorandom.co.uk/) -* Svend's [website](http://www.ciffer.net/~svend/) and [blog](http://www.ciffer.net/~svend/blog/) +* Svend's [website](http://ciffer.net/~svend/) and [blog](http://ciffer.net/~svend/blog/) * [muammar's site](http://muammar.me) * [Per Bothner's blog](http://per.bothner.com/blog/) * [Bernd Zeimetz (bzed)](http://bzed.de/) diff --git a/doc/users/svend.mdwn b/doc/users/svend.mdwn index 69d83584f..712a0d3e7 100644 --- a/doc/users/svend.mdwn +++ b/doc/users/svend.mdwn @@ -1,4 +1,4 @@ [[!meta title="Svend Sorensen"]] -* [website](http://www.ciffer.net/~svend/) -* [blog](http://www.ciffer.net/~svend/blog/) +* [website](http://ciffer.net/~svend/) +* [blog](http://ciffer.net/~svend/blog/) -- cgit v1.2.3 From 2111bf0408620a307c8c0373489ef34ca6626fd2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Apr 2010 22:14:22 -0400 Subject: move message into if block --- IkiWiki/Render.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index a6b0f0617..1114e05c8 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -366,13 +366,13 @@ sub find_new_files ($) { push @internal_new, $file; } elsif ($config{rcs}) { - if (! $times_noted) { - debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs})); - $times_noted=1; - } - push @new, $file; if ($config{gettime} && -e "$config{srcdir}/$file") { + if (! $times_noted) { + debug(sprintf(gettext("querying %s for file creation and modification times.."), $config{rcs})); + $times_noted=1; + } + eval { my $ctime=rcs_getctime("$config{srcdir}/$file"); if ($ctime > 0) { -- cgit v1.2.3 From 09c647c1773d5c8eafacea486082684909e47449 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Tue, 20 Apr 2010 02:31:00 +0000 Subject: response --- doc/todo/auto_rebuild_on_template_change.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index c4ffae178..2799842ed 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -31,3 +31,5 @@ risk, and it's unlikely enough that a NEWS warning should suffice. (This would also help to clear up the tricky disctinction between wikitemplates and in-wiki templates.) + +> But would this require that templates be parseable as wiki pages? Because that would be a nuisance. --[[KathrynAndersen]] -- cgit v1.2.3 From 9f00692a798888b9cc9edb30a961c6418efba39b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Apr 2010 22:37:55 -0400 Subject: response --- doc/todo/auto_rebuild_on_template_change.mdwn | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index 2799842ed..cde19700c 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -25,11 +25,15 @@ used. Although, having every page declare an explicit dep on `page.tmpl` is perhaps a bit much; might be better to implement a special case for that one. Also, having the templates be copied to `destdir` is not desirable. -The risk is that a site might have `allowed_attachments` set to "templates/*" -or "*.tmpl" something like that. I think such a configuration is the *only* -risk, and it's unlikely enough that a NEWS warning should suffice. +The risk is that a site might have `allowed_attachments` set to +`templates/*` or `*.tmpl` something like that. I think such a configuration +is the *only* risk, and it's unlikely enough that a NEWS warning should +suffice. (This would also help to clear up the tricky disctinction between wikitemplates and in-wiki templates.) > But would this require that templates be parseable as wiki pages? Because that would be a nuisance. --[[KathrynAndersen]] + +>> It would be better for them not to be rendered separately at all. +>> --[[Joey]] -- cgit v1.2.3 From 16afa9e8446771fabe45ab45d8a36d09034d0319 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Tue, 20 Apr 2010 02:41:13 +0000 Subject: further clarification --- doc/todo/Multiple_categorization_namespaces.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/todo/Multiple_categorization_namespaces.mdwn b/doc/todo/Multiple_categorization_namespaces.mdwn index ae35e8dfe..190070816 100644 --- a/doc/todo/Multiple_categorization_namespaces.mdwn +++ b/doc/todo/Multiple_categorization_namespaces.mdwn @@ -79,8 +79,10 @@ Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would t * `linkbase` : akin to the tagbase parameter * Is this a field-name -> directory mapping? -- K.A. * yes, with each directory having one page per value. It might not make sense for all fields, of course -- G.B. + * (nods) I've been working on something similar with my unreleased `tagger` module. In that, by default, the field-name maps to the closest wiki-page of the same name. Thus, if one had the field "genre=poetry" on the page fiction/stories/mary/lamb, then that would map to fiction/genre/poetry if fiction/genre existed. --K.A. * `queries` : list of template queries this type/attribute/field/whatever is exposed to * I'm not sure what you mean here. -- K.A. * as mentioned before, some fields may be made accessible through different template queries, in different form. This is the case already for tags, that also come up in the `categories` query (used by Atom and RSS feeds). -- G.B. + * Ah, do you mean that the input value is the same, but the output format is different? Like the difference between TMPL_VAR NAME="FOO" and TMPL_VAR NAME="raw_FOO"; one is htmlized, and the other is not. -- K.A. Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries, or also see what is done with the fields in the current `meta` plugin). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. -- cgit v1.2.3 From fda191cbbbfa76114a27a53bfc5b90289f26f72b Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Tue, 20 Apr 2010 02:43:44 +0000 Subject: formatting --- doc/todo/Multiple_categorization_namespaces.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/todo/Multiple_categorization_namespaces.mdwn b/doc/todo/Multiple_categorization_namespaces.mdwn index 190070816..74e5bc812 100644 --- a/doc/todo/Multiple_categorization_namespaces.mdwn +++ b/doc/todo/Multiple_categorization_namespaces.mdwn @@ -79,10 +79,10 @@ Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would t * `linkbase` : akin to the tagbase parameter * Is this a field-name -> directory mapping? -- K.A. * yes, with each directory having one page per value. It might not make sense for all fields, of course -- G.B. - * (nods) I've been working on something similar with my unreleased `tagger` module. In that, by default, the field-name maps to the closest wiki-page of the same name. Thus, if one had the field "genre=poetry" on the page fiction/stories/mary/lamb, then that would map to fiction/genre/poetry if fiction/genre existed. --K.A. + * (nods) I've been working on something similar with my unreleased `tagger` module. In that, by default, the field-name maps to the closest wiki-page of the same name. Thus, if one had the field "genre=poetry" on the page fiction/stories/mary/lamb, then that would map to fiction/genre/poetry if fiction/genre existed. --K.A. * `queries` : list of template queries this type/attribute/field/whatever is exposed to * I'm not sure what you mean here. -- K.A. * as mentioned before, some fields may be made accessible through different template queries, in different form. This is the case already for tags, that also come up in the `categories` query (used by Atom and RSS feeds). -- G.B. - * Ah, do you mean that the input value is the same, but the output format is different? Like the difference between TMPL_VAR NAME="FOO" and TMPL_VAR NAME="raw_FOO"; one is htmlized, and the other is not. -- K.A. + * Ah, do you mean that the input value is the same, but the output format is different? Like the difference between TMPL_VAR NAME="FOO" and TMPL_VAR NAME="raw_FOO"; one is htmlized, and the other is not. -- K.A. Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries, or also see what is done with the fields in the current `meta` plugin). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. -- cgit v1.2.3 From 529929e732e1c6604d31b68e81898780de06e640 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Tue, 20 Apr 2010 02:45:14 +0000 Subject: non comprend --- doc/todo/auto_rebuild_on_template_change.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index cde19700c..6a1013f8d 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -37,3 +37,5 @@ wikitemplates and in-wiki templates.) >> It would be better for them not to be rendered separately at all. >> --[[Joey]] + +>>> I don't follow you. --[[KathrynAndersen]] -- cgit v1.2.3 From de6167a3b03389c0ec8223e7ee101707b6c73953 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Apr 2010 23:45:42 -0400 Subject: change wording This is more accurate when a file that is not a page is what is removed. --- IkiWiki/Render.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 1114e05c8..172b08b1e 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -431,7 +431,7 @@ sub remove_del (@) { foreach my $file (@_) { my $page=pagename($file); if (! isinternal($page)) { - debug(sprintf(gettext("removing old page %s"), $page)); + debug(sprintf(gettext("removing obsolete %s"), $page)); } foreach my $old (@{$oldrenderedfiles{$page}}) { -- cgit v1.2.3 From 563428ebd2a75cfabccf1974da0c1cbbe07eb369 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 19 Apr 2010 23:52:16 -0400 Subject: response --- doc/todo/auto_rebuild_on_template_change.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index 6a1013f8d..2558d5f3e 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -24,6 +24,7 @@ register dependencies on `page.tmpl`, `inlinepage.tmpl`, etc, as they're used. Although, having every page declare an explicit dep on `page.tmpl` is perhaps a bit much; might be better to implement a special case for that one. Also, having the templates be copied to `destdir` is not desirable. +(However, if they're not copied, wikilinks to them will be broken. Hmm.) The risk is that a site might have `allowed_attachments` set to `templates/*` or `*.tmpl` something like that. I think such a configuration @@ -39,3 +40,8 @@ wikitemplates and in-wiki templates.) >> --[[Joey]] >>> I don't follow you. --[[KathrynAndersen]] + +>>>> If they don't render to output files, they clearly don't +>>>> need to be treated as wiki pages. (They need to be treated +>>>> as raw files anyway, because you don't want random users editing them +>>>> in the online editor.) --[[Joey]] -- cgit v1.2.3 From 1239fa55d5d5b9ca81dbde0874f4ff8d1980429d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 00:07:41 -0400 Subject: no need to return content from postscan hook --- IkiWiki/Plugin/search.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index c0e8703d8..a1e7026ca 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -70,7 +70,7 @@ sub index (@) { # A unique pageterm is used to identify the document for a page. my $pageterm=pageterm($params{page}); - return $params{content} unless defined $pageterm; + return unless defined $pageterm; my $db=xapiandb(); my $doc=Search::Xapian::Document->new(); -- cgit v1.2.3 From 11718519348382892d5c6fdb21b8e721c2413eb0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 01:32:19 -0400 Subject: similarity to internal pages --- doc/todo/auto_rebuild_on_template_change.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index 2558d5f3e..2e4ba8e9a 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -24,7 +24,8 @@ register dependencies on `page.tmpl`, `inlinepage.tmpl`, etc, as they're used. Although, having every page declare an explicit dep on `page.tmpl` is perhaps a bit much; might be better to implement a special case for that one. Also, having the templates be copied to `destdir` is not desirable. -(However, if they're not copied, wikilinks to them will be broken. Hmm.) +In a sense, these template would be like internal pages, except not wiki +pages, but raw files. The risk is that a site might have `allowed_attachments` set to `templates/*` or `*.tmpl` something like that. I think such a configuration -- cgit v1.2.3 From d1a1f3ad21e9e58d1232fc3d997028a463ccad4a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 01:54:42 -0400 Subject: fix minor bug if a page's name is "0" --- IkiWiki/Render.pm | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 172b08b1e..bbf8f915e 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -634,34 +634,35 @@ sub render_dependent ($$$$$$$) { if ($type == $IkiWiki::DEPEND_LINKS) { next unless $linkchangers->{lc($page)}; } - return $page; + $reason=$page; + return 1; } } return undef; }; if ($depends{$p}{$dep} & $IkiWiki::DEPEND_CONTENT) { - last if $reason = - $in->(\@changed, $IkiWiki::DEPEND_CONTENT); - last if $internal_dep && ($reason = + last if $in->(\@changed, $IkiWiki::DEPEND_CONTENT); + last if $internal_dep && ( $in->($internal_new, $IkiWiki::DEPEND_CONTENT) || $in->($internal_del, $IkiWiki::DEPEND_CONTENT) || - $in->($internal_changed, $IkiWiki::DEPEND_CONTENT)); + $in->($internal_changed, $IkiWiki::DEPEND_CONTENT) + ); } if ($depends{$p}{$dep} & $IkiWiki::DEPEND_PRESENCE) { - last if $reason = - $in->(\@exists_changed, $IkiWiki::DEPEND_PRESENCE); - last if $internal_dep && ($reason = + last if $in->(\@exists_changed, $IkiWiki::DEPEND_PRESENCE); + last if $internal_dep && ( $in->($internal_new, $IkiWiki::DEPEND_PRESENCE) || - $in->($internal_del, $IkiWiki::DEPEND_PRESENCE)); + $in->($internal_del, $IkiWiki::DEPEND_PRESENCE) + ); } if ($depends{$p}{$dep} & $IkiWiki::DEPEND_LINKS) { - last if $reason = - $in->(\@changed, $IkiWiki::DEPEND_LINKS); - last if $internal_dep && ($reason = + last if $in->(\@changed, $IkiWiki::DEPEND_LINKS); + last if $internal_dep && ( $in->($internal_new, $IkiWiki::DEPEND_LINKS) || $in->($internal_del, $IkiWiki::DEPEND_LINKS) || - $in->($internal_changed, $IkiWiki::DEPEND_LINKS)); + $in->($internal_changed, $IkiWiki::DEPEND_LINKS) + ); } } } -- cgit v1.2.3 From 52ccc03d10c532b3cf6335b00a9b60057061596b Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Tue, 20 Apr 2010 15:40:10 +0100 Subject: clarify whether the raw files would be put in destdir --- doc/todo/auto_rebuild_on_template_change.mdwn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index 2e4ba8e9a..09a623427 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -46,3 +46,6 @@ wikitemplates and in-wiki templates.) >>>> need to be treated as wiki pages. (They need to be treated >>>> as raw files anyway, because you don't want random users editing them >>>> in the online editor.) --[[Joey]] + +>>>>> Just to be clear, the raw files would not be copied across to the output +>>>>> directory? -- [[Jon]] -- cgit v1.2.3 From 3b8f4f59d6720e5a77cae30eacc4c46582b1603b Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 20 Apr 2010 15:01:39 +0000 Subject: internal pages: the revenge? --- doc/todo/auto_rebuild_on_template_change.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/todo/auto_rebuild_on_template_change.mdwn b/doc/todo/auto_rebuild_on_template_change.mdwn index 09a623427..b5c107915 100644 --- a/doc/todo/auto_rebuild_on_template_change.mdwn +++ b/doc/todo/auto_rebuild_on_template_change.mdwn @@ -49,3 +49,9 @@ wikitemplates and in-wiki templates.) >>>>> Just to be clear, the raw files would not be copied across to the output >>>>> directory? -- [[Jon]] + +>>>>>> Without modifying ikiwiki, they'd be copied to the output directory as +>>>>>> (e.g.) http://ikiwiki.info/templates/inlinepage.tmpl; to not copy them, +>>>>>> it'd either be necessary to make them be internal pages +>>>>>> (templates/inlinepage._tmpl) or special-case them in some other way. +>>>>>> --[[smcv]] -- cgit v1.2.3 From 7a92c0aa4aea1bffc9090d982c4b55af9e0b0c02 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 13:49:46 -0400 Subject: clarify why absolute is tested & stripped here file_prune also fails on absolute filenames now --- IkiWiki/Plugin/editpage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index ee1de8eaa..dff777138 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -92,7 +92,7 @@ sub cgi_editpage ($$) { # wiki_file_regexp. my ($page)=$form->field('page')=~/$config{wiki_file_regexp}/; $page=possibly_foolish_untaint($page); - my $absolute=($page =~ s#^/+##); + my $absolute=($page =~ s#^/+##); # absolute name used for force location if (! defined $page || ! length $page || file_pruned($page)) { error(gettext("bad page name")); -- cgit v1.2.3 From 5d3f7877299942cbec4fde6054761635d90a089a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 13:54:24 -0400 Subject: use one parameter form of file_pruned here too In File::Find, $_ is relative to the current directory, so that is ok. Also, the directory name doesn't need to be stripped from $_. --- IkiWiki/Plugin/comments.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 1c219b6c6..32e4d0937 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -645,7 +645,7 @@ sub comments_pending () { no_chdir => 1, wanted => sub { $_=decode_utf8($_); - if (IkiWiki::file_pruned($_, $dir)) { + if (IkiWiki::file_pruned($_)) { $File::Find::prune=1; } elsif (! -l $_ && ! -d _) { @@ -653,7 +653,6 @@ sub comments_pending () { my ($f)=/$config{wiki_file_regexp}/; # untaint if (defined $f && $f =~ /\Q._comment\E$/) { my $ctime=(stat($f))[10]; - $f=~s/^\Q$dir\E\/?//; push @ret, [$f, $ctime]; } } -- cgit v1.2.3 From 230a8b22a471c018c8ec48cd07427c42238a4970 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 13:59:17 -0400 Subject: remove explicit absolute test file_pruned now tests for that --- IkiWiki/Plugin/editpage.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index dff777138..2130a8402 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -221,7 +221,6 @@ sub cgi_editpage ($$) { if (! defined $from || ! length $from || $from ne $form->field('from') || file_pruned($from) || - $from=~/^\// || $absolute || $form->submitted) { @page_locs=$best_loc=$page; -- cgit v1.2.3 From 6d063a6698ad72476d9243956b0f13ec33a09dbd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 14:06:00 -0400 Subject: switch to 1 parameter version of file_pruned Another bit of code that didn't realize that File::Find sets $_ to the relative filename. --- IkiWiki/Plugin/autoindex.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index c71d73349..1d0612e84 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -40,14 +40,12 @@ sub refresh () { no_chdir => 1, wanted => sub { $_=decode_utf8($_); - if (IkiWiki::file_pruned($_, $dir)) { + if (IkiWiki::file_pruned($_)) { $File::Find::prune=1; } elsif (! -l $_) { my ($f)=/$config{wiki_file_regexp}/; # untaint return unless defined $f; - $f=~s/^\Q$dir\E\/?//; - return unless length $f; return if $f =~ /\._([^.]+)$/; # skip internal page if (! -d _) { $pages{pagename($f)}=1; -- cgit v1.2.3 From cff3937b681a6c2505eb52b43b2e3e7086f99c45 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 14:08:29 -0400 Subject: remove 2 argument form of file_pruned --- IkiWiki.pm | 9 +-------- t/file_pruned.t | 39 ++------------------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index a5f83ac7a..6d3b6c606 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1843,15 +1843,8 @@ sub deptype (@) { } my $file_prune_regexp; -sub file_pruned ($;$) { +sub file_pruned ($) { my $file=shift; - if (@_) { - require File::Spec; - $file=File::Spec->canonpath($file); - my $base=File::Spec->canonpath(shift); - return if $file eq $base; - $file =~ s#^\Q$base\E/+##; - } if (defined $config{include} && length $config{include}) { return 0 if $file =~ m/$config{include}/; diff --git a/t/file_pruned.t b/t/file_pruned.t index 4335ed917..34f366610 100755 --- a/t/file_pruned.t +++ b/t/file_pruned.t @@ -1,52 +1,31 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 54; +use Test::More tests => 27; BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); -ok(IkiWiki::file_pruned("src/.htaccess", "src")); ok(IkiWiki::file_pruned(".htaccess")); -ok(IkiWiki::file_pruned("src/.ikiwiki/", "src")); ok(IkiWiki::file_pruned(".ikiwiki/")); -ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src")); ok(IkiWiki::file_pruned(".ikiwiki/index")); -ok(IkiWiki::file_pruned("src/CVS/foo", "src")); ok(IkiWiki::file_pruned("CVS/foo")); -ok(IkiWiki::file_pruned("src/subdir/CVS/foo", "src")); ok(IkiWiki::file_pruned("subdir/CVS/foo")); -ok(IkiWiki::file_pruned("src/.svn", "src")); ok(IkiWiki::file_pruned(".svn")); -ok(IkiWiki::file_pruned("src/subdir/.svn", "src")); ok(IkiWiki::file_pruned("subdir/.svn")); -ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src")); ok(IkiWiki::file_pruned("subdir/.svn/foo")); -ok(IkiWiki::file_pruned("src/.git", "src")); ok(IkiWiki::file_pruned(".git")); -ok(IkiWiki::file_pruned("src/subdir/.git", "src")); ok(IkiWiki::file_pruned("subdir/.git")); -ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src")); ok(IkiWiki::file_pruned("subdir/.git/foo")); -ok(! IkiWiki::file_pruned("src/svn/fo", "src")); ok(! IkiWiki::file_pruned("svn/fo")); -ok(! IkiWiki::file_pruned("src/git", "src")); ok(! IkiWiki::file_pruned("git")); -ok(! IkiWiki::file_pruned("src/index.mdwn", "src")); ok(! IkiWiki::file_pruned("index.mdwn")); -ok(! IkiWiki::file_pruned("src/index.", "src")); ok(! IkiWiki::file_pruned("index.")); - -# these are ok because while the filename starts with ".", the canonpathed -# version does not -ok(! IkiWiki::file_pruned("src/.", "src")); -ok(! IkiWiki::file_pruned("src/./", "src")); -# OTOH, without a srcdir, no canonpath, so they're not allowed. ok(IkiWiki::file_pruned(".")); ok(IkiWiki::file_pruned("./")); -# Without a srcdir, absolute filenames are not allowed. +# absolute filenames are not allowed. ok(IkiWiki::file_pruned("/etc/passwd")); ok(IkiWiki::file_pruned("//etc/passwd")); ok(IkiWiki::file_pruned("/")); @@ -54,22 +33,8 @@ ok(IkiWiki::file_pruned("//")); ok(IkiWiki::file_pruned("///")); -ok(IkiWiki::file_pruned("src/..", "src")); ok(IkiWiki::file_pruned("..")); -ok(IkiWiki::file_pruned("src/../", "src")); -ok(IkiWiki::file_pruned("../")); -ok(IkiWiki::file_pruned("src/../", "src")); ok(IkiWiki::file_pruned("../")); -# This is perhaps counterintuitive. -ok(! IkiWiki::file_pruned("src", "src")); - -# Dots, etc, in the srcdir are ok. -ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src")); -ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src")); -ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn")); - -ok(IkiWiki::file_pruned("src/y/foo.dpkg-tmp", "src")); ok(IkiWiki::file_pruned("y/foo.dpkg-tmp")); -ok(IkiWiki::file_pruned("src/y/foo.ikiwiki-new", "src")); ok(IkiWiki::file_pruned("y/foo.ikiwiki-new")); -- cgit v1.2.3 From 1f56dead00ee1188d9ed9650b9b2483b69c4d525 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 14:13:46 -0400 Subject: oops, fix for no_chdir mode $_ will be absolute then --- IkiWiki/Plugin/autoindex.pm | 6 ++++-- IkiWiki/Plugin/comments.pm | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 1d0612e84..23a17d4e9 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -39,12 +39,14 @@ sub refresh () { find({ no_chdir => 1, wanted => sub { - $_=decode_utf8($_); + my $file=decode_utf8($_); + $file=~s/^\Q$dir\E\/?//; + return unless length $file; if (IkiWiki::file_pruned($_)) { $File::Find::prune=1; } elsif (! -l $_) { - my ($f)=/$config{wiki_file_regexp}/; # untaint + my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint return unless defined $f; return if $f =~ /\._([^.]+)$/; # skip internal page if (! -d _) { diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 32e4d0937..03ca19c98 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -644,13 +644,14 @@ sub comments_pending () { find({ no_chdir => 1, wanted => sub { - $_=decode_utf8($_); + my $file=decode_utf8($_); + $file=~s/^\Q$dir\E\/?//; + return unless length $file; if (IkiWiki::file_pruned($_)) { $File::Find::prune=1; } elsif (! -l $_ && ! -d _) { - $File::Find::prune=0; - my ($f)=/$config{wiki_file_regexp}/; # untaint + my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint if (defined $f && $f =~ /\Q._comment\E$/) { my $ctime=(stat($f))[10]; push @ret, [$f, $ctime]; -- cgit v1.2.3 From 59bb1f1db37d8b8170e5dd8e5a857df7742bffb9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 14:23:48 -0400 Subject: fix stat to use unmunged filename --- IkiWiki/Plugin/comments.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 03ca19c98..ccc9e1068 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -653,7 +653,7 @@ sub comments_pending () { elsif (! -l $_ && ! -d _) { my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint if (defined $f && $f =~ /\Q._comment\E$/) { - my $ctime=(stat($f))[10]; + my $ctime=(stat($_))[10]; push @ret, [$f, $ctime]; } } -- cgit v1.2.3 From 81eae1a531ab6e538985a8531b39ef3c5f865bdc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 14:25:17 -0400 Subject: typo --- IkiWiki/Plugin/editpage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 2130a8402..26e38abc1 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -92,7 +92,7 @@ sub cgi_editpage ($$) { # wiki_file_regexp. my ($page)=$form->field('page')=~/$config{wiki_file_regexp}/; $page=possibly_foolish_untaint($page); - my $absolute=($page =~ s#^/+##); # absolute name used for force location + my $absolute=($page =~ s#^/+##); # absolute name used to force location if (! defined $page || ! length $page || file_pruned($page)) { error(gettext("bad page name")); -- cgit v1.2.3 From 4b4fdc85abba7200eed78eb473341e44fecc6087 Mon Sep 17 00:00:00 2001 From: "http://oblomov.myopenid.com/" Date: Tue, 20 Apr 2010 20:18:29 +0000 Subject: Clarifications --- doc/todo/Multiple_categorization_namespaces.mdwn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/todo/Multiple_categorization_namespaces.mdwn b/doc/todo/Multiple_categorization_namespaces.mdwn index 74e5bc812..a8ee6755c 100644 --- a/doc/todo/Multiple_categorization_namespaces.mdwn +++ b/doc/todo/Multiple_categorization_namespaces.mdwn @@ -80,9 +80,14 @@ Each type/attribute/field/whatever (predefined, user-defined, arbitrary) would t * Is this a field-name -> directory mapping? -- K.A. * yes, with each directory having one page per value. It might not make sense for all fields, of course -- G.B. * (nods) I've been working on something similar with my unreleased `tagger` module. In that, by default, the field-name maps to the closest wiki-page of the same name. Thus, if one had the field "genre=poetry" on the page fiction/stories/mary/lamb, then that would map to fiction/genre/poetry if fiction/genre existed. --K.A. + * that's the idea. In your case you could have the linkbase of genre be fiction/genre, and it would be created if it was missing. -- G.B. * `queries` : list of template queries this type/attribute/field/whatever is exposed to * I'm not sure what you mean here. -- K.A. * as mentioned before, some fields may be made accessible through different template queries, in different form. This is the case already for tags, that also come up in the `categories` query (used by Atom and RSS feeds). -- G.B. * Ah, do you mean that the input value is the same, but the output format is different? Like the difference between TMPL_VAR NAME="FOO" and TMPL_VAR NAME="raw_FOO"; one is htmlized, and the other is not. -- K.A. + * Actually this is about the same information appearing in different queries (e.g. NAME="FOO" and NAME="BAR"). Example: say that I defined a "Rubrica" field. I would want both tags and categories to appear in `categories` template query, but only tags would appear in the `tags` query, and only Rubrica values to appear in `rubrica` queries. The issue of different output formats was presented in the next paragraph instead. -- G.B. Where this approach is limiting is on the kind of data that is passed to (template) queries. The value of the metadata fields might need some massaging (e.g. compare how tags are passed to tags queries vs cateogires queries, or also see what is done with the fields in the current `meta` plugin). I have problems on picturing an easy way to make this possible user-side (i.e. via templates and not in Perl modules). Suggestions welcome. + +One possibility could be to have the `queries` configuration allow a hash mapping query names to functions that would transform the data. Lacking that possibility, we might have to leave some predefined fields to have custom Perl-side treatment and leave custom fields to be untransformable. + -- cgit v1.2.3 From 93cf1db7b9655a64aec6ab17b7192e5e7429f12e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 17:21:50 -0400 Subject: fix uninitialized value warning $cgi->params('do') may not be defined. The CSRF code may delete all cgi params. This uninitalized value was introduced when do=register support was added recently. --- IkiWiki/Plugin/passwordauth.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index 4848b47bb..baddca093 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -105,11 +105,13 @@ sub formbuilder_setup (@) { my $session=$params{session}; my $cgi=$params{cgi}; - if ($form->title eq "signin" || $form->title eq "register" || $cgi->param("do") eq "register") { + my $do_register=defined $cgi->param("do") && $cgi->param("do") eq "register"; + + if ($form->title eq "signin" || $form->title eq "register" || $do_register) { $form->field(name => "name", required => 0); $form->field(name => "password", type => "password", required => 0); - if ($form->submitted eq "Register" || $form->submitted eq "Create Account" || $cgi->param("do") eq "register") { + if ($form->submitted eq "Register" || $form->submitted eq "Create Account" || $do_register) { $form->field(name => "confirm_password", type => "password"); $form->field(name => "account_creation_password", type => "password") if (defined $config{account_creation_password} && @@ -247,8 +249,10 @@ sub formbuilder (@) { my $cgi=$params{cgi}; my $buttons=$params{buttons}; + my $do_register=defined $cgi->param("do") && $cgi->param("do") eq "register"; + if ($form->title eq "signin" || $form->title eq "register") { - if (($form->submitted && $form->validate) || $cgi->param("do") eq "register") { + if (($form->submitted && $form->validate) || $do_register) { if ($form->submitted eq 'Login') { $session->param("name", $form->field("name")); IkiWiki::cgi_postsignin($cgi, $session); @@ -311,7 +315,7 @@ sub formbuilder (@) { $form->field(name => "name", required => 0); push @$buttons, "Reset Password"; } - elsif ($form->submitted eq "Register" || $cgi->param("do") eq "register") { + elsif ($form->submitted eq "Register" || $do_register) { @$buttons="Create Account"; } } -- cgit v1.2.3 From bfca8345ea7d49df6a4f6521f1db416d28671f35 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 17:42:36 -0400 Subject: bugfix Avoid file_pruned triggering on absolute paths causing the whole comments_pending directory being pruned. Simplify code. --- IkiWiki/Plugin/comments.pm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index ccc9e1068..58bd4b851 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -646,16 +646,12 @@ sub comments_pending () { wanted => sub { my $file=decode_utf8($_); $file=~s/^\Q$dir\E\/?//; - return unless length $file; - if (IkiWiki::file_pruned($_)) { - $File::Find::prune=1; - } - elsif (! -l $_ && ! -d _) { - my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint - if (defined $f && $f =~ /\Q._comment\E$/) { - my $ctime=(stat($_))[10]; - push @ret, [$f, $ctime]; - } + return if ! length $file || IkiWiki::file_pruned($file) + || -l $_ || -d _ || $file !~ /\Q._comment\E$/; + my ($f) = $file =~ /$config{wiki_file_regexp}/; # untaint + if (defined $f) { + my $ctime=(stat($_))[10]; + push @ret, [$f, $ctime]; } } }, $dir); -- cgit v1.2.3 From d578f3ff78190f816c74f6935e1e0024b25dc090 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 17:49:00 -0400 Subject: darcs: ensure whole darcs query manifest output is consumed By a stroke of luck, after a long & full day, I happened to remember that in the morning, I had seen someone on irc mention that darcs query manifest doesn't like it if its full output is not consumed. So contrary to the usual case where bug reports sent via irc are like messages written in sand before the new tide, this one was seen and fixed. (But use http://ikiwiki.info/bugs/ next time!) --- IkiWiki/Plugin/darcs.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/darcs.pm b/IkiWiki/Plugin/darcs.pm index c1d6661d3..f17fadcb1 100644 --- a/IkiWiki/Plugin/darcs.pm +++ b/IkiWiki/Plugin/darcs.pm @@ -63,7 +63,7 @@ sub file_in_vc ($$) { } my $found=0; while () { - $found = 1, last if /^(\.\/)?$file$/; + $found = 1 if /^(\.\/)?$file$/; } close(DARCS_MANIFEST) or error("'darcs query manifest' exited " . $?); -- cgit v1.2.3 From 511f7f9cb94ebdd8ea33973a0ca74d2f8249aa3f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 20 Apr 2010 18:16:40 -0400 Subject: bugfix So this is the one place that does need to canonpath and compare, as two argument file_pruned used to. --- IkiWiki/Plugin/autoindex.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 23a17d4e9..0dd76259e 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -36,13 +36,17 @@ sub refresh () { my (%pages, %dirs); foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) { + require File::Spec; + $dir=File::Spec->canonpath($dir); + find({ no_chdir => 1, wanted => sub { - my $file=decode_utf8($_); + my $file=File::Spec->canonpath(decode_utf8($_)); + return if $file eq $dir; $file=~s/^\Q$dir\E\/?//; return unless length $file; - if (IkiWiki::file_pruned($_)) { + if (IkiWiki::file_pruned($file)) { $File::Find::prune=1; } elsif (! -l $_) { -- cgit v1.2.3