|
"[^"]+" # single-quoted value
|
- [^\s\]]+ # unquoted value
+ [^"\s\]]+ # unquoted value
)
\s* # whitespace or end
# of directive
|
"[^"]+" # single-quoted value
|
- [^\s\]]+ # unquoted value
+ [^"\s\]]+ # unquoted value
)
\s* # whitespace or end
# of directive
foreach my $line (split("\n", $params{content})) {
push @diff, $line if ! exists $old{$_};
}
- $params{content}=join("\n", @diff);
+ $params{diff}=join("\n", @diff);
}
my $ok;
hook(type => "formbuilder_setup", id => "rename", call => \&formbuilder_setup);
hook(type => "formbuilder", id => "rename", call => \&formbuilder);
hook(type => "sessioncgi", id => "rename", call => \&sessioncgi);
-
+ hook(type => "rename", id => "rename", call => \&rename_subpages);
}
sub getsetup () {
IkiWiki::Plugin::attachment::check_canattach($session, $dest, $srcfile);
}
}
+
+ my $canrename;
+ IkiWiki::run_hooks(canrename => sub {
+ return if defined $canrename;
+ my $ret=shift->(cgi => $q, session => $session,
+ src => $src, srcfile => $srcfile,
+ dest => $dest, destfile => $destfile);
+ if (defined $ret) {
+ if ($ret eq "") {
+ $canrename=1;
+ }
+ elsif (ref $ret eq 'CODE') {
+ $ret->();
+ $canrename=0;
+ }
+ elsif (defined $ret) {
+ error($ret);
+ $canrename=0;
+ }
+ }
+ });
}
sub rename_form ($$$) {
# insert the standard extensions
my @page_types;
if (exists $IkiWiki::hooks{htmlize}) {
- @page_types=grep { !/^_/ }
- keys %{$IkiWiki::hooks{htmlize}};
+ foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) {
+ push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key];
+ }
}
+ @page_types=sort @page_types;
# make sure the current extension is in the list
my ($ext) = $pagesources{$page}=~/\.([^.]+)$/;
if (! $IkiWiki::hooks{htmlize}{$ext}) {
- unshift(@page_types, $ext);
+ unshift(@page_types, [$ext, $ext]);
}
$f->field(name => "type", type => 'select',
required => 1,
};
- # See if any subpages need to be renamed.
- if ($q->param("subpages") && $src ne $dest) {
- foreach my $p (keys %pagesources) {
- next unless $pagesources{$p}=~m/^\Q$src\E\//;
- # If indexpages is enabled, the
- # srcfile should not be confused
- # with a subpage.
- next if $pagesources{$p} eq $srcfile;
-
- my $d=$pagesources{$p};
- $d=~s/^\Q$src\E\//$dest\//;
- push @torename, {
- src => $p,
- srcfile => $pagesources{$p},
- dest => pagename($d),
- destfile => $d,
- required => 0,
- };
- }
- }
-
+ @torename=rename_hook(
+ torename => \@torename,
+ done => {},
+ cgi => $q,
+ session => $session,
+ );
+
require IkiWiki::Render;
IkiWiki::disable_commit_hook() if $config{rcs};
my %origpagesources=%pagesources;
exit 0;
}
}
-
+
+# Add subpages to the list of pages to be renamed, if needed.
+sub rename_subpages (@) {
+ my %params = @_;
+
+ my %torename = %{$params{torename}};
+ my $q = $params{cgi};
+ my $src = $torename{src};
+ my $srcfile = $torename{src};
+ my $dest = $torename{dest};
+ my $destfile = $torename{dest};
+
+ return () unless ($q->param("subpages") && $src ne $dest);
+
+ my @ret;
+ foreach my $p (keys %pagesources) {
+ next unless $pagesources{$p}=~m/^\Q$src\E\//;
+ # If indexpages is enabled, the srcfile should not be confused
+ # with a subpage.
+ next if $pagesources{$p} eq $srcfile;
+
+ my $d=$pagesources{$p};
+ $d=~s/^\Q$src\E\//$dest\//;
+ push @ret, {
+ src => $p,
+ srcfile => $pagesources{$p},
+ dest => pagename($d),
+ destfile => $d,
+ required => 0,
+ };
+ }
+ return @ret;
+}
+
sub linklist {
# generates a list of links in a form suitable for FormBuilder
my $dest=shift;
return $content;
}
-
+
+sub rename_hook (@) {
+ my %params = @_;
+
+ my @torename=@{$params{torename}};
+ my %done=%{$params{done}};
+ my $q=$params{cgi};
+ my $session=$params{session};
+
+ return () unless @torename;
+
+ my @nextset;
+ foreach my $torename (@torename) {
+ unless (exists $done{$torename->{src}} && $done{$torename->{src}}) {
+ IkiWiki::run_hooks(rename => sub {
+ push @nextset, shift->(
+ torename => $torename,
+ cgi => $q,
+ session => $session,
+ );
+ });
+ $done{$torename->{src}}=1;
+ }
+ }
+
+ push @torename, rename_hook(
+ torename => \@nextset,
+ done => \%done,
+ cgi => $q,
+ session => $session,
+ );
+
+ # dedup
+ my %seen;
+ return grep { ! $seen{$_->{src}}++ } @torename;
+}
+
sub do_rename ($$$) {
my $rename=shift;
my $q=shift;
- ikiwiki (3.14) UNRELEASED; urgency=low
+ ikiwiki (3.15) UNRELEASED; urgency=low
+ * comment: Make comment directives no longer use the internal "_comment"
+ form, and document the comment directive syntax.
+ * Avoid relying on translators preserving the case when translating
+ "discussion", which caused Discussion pages to get unwanted Discussion
+ links.
+ * Tighten up matching of bare words inside directives; do not
+ allow an unterminated """ string to be treated as a series
+ of bare words. Fixes runaway regexp recursion/backtracking
+ in strange situations.
+ * Setup automator: Check that each plugin added to the generated
+ setup file can be loaded and that its config is ok. If a plugin
+ fails for any reason, disable it in the generated file.
+ Closes: 532001
+ * pagecount: Fix broken optimisation for * pagespec.
+ * goto: Support being passed a page title that is not a valid page
+ name, to support several cases including mercurial's long user
+ names on the RecentChanges page, and urls with spaces being handled
+ by the 404 plugin.
+ * Add new hooks: canremove, canrename, rename. (intrigeri)
+ * rename: Refactor subpage rename handling code into rename hook. (intrigeri)
+ * po: New plugin, suporting translation of wiki pages using po files.
+ (intrigeri)
- -- Joey Hess <joeyh@debian.org> Mon, 20 Apr 2009 19:40:25 -0400
+ -- Joey Hess <joeyh@debian.org> Tue, 02 Jun 2009 17:03:41 -0400
- ikiwiki (3.13) UNRELEASED; urgency=low
+ ikiwiki (3.14) unstable; urgency=low
+
+ * highlight: New plugin supporting syntax highlighting of pretty much
+ anything.
+ * debian/control: Add suggests for libhighlight-perl, although
+ that package is not yet created by Debian's highlight source package.
+ (See #529869)
+ * format: Provide a htmlizefallback hook that other plugins
+ can use to handle formats that are not suitable for general-purpose
+ htmlize hooks. Used by highlight.
+ * Fix test suite to not rely on an installed copy of ikiwiki after
+ underlaydir change. Closes: #530502
+ * Danish translation update. Closes: #530877
+
+ -- Joey Hess <joeyh@debian.org> Mon, 01 Jun 2009 13:05:34 -0400
+
+ ikiwiki (3.13) unstable; urgency=low
* ikiwiki-transition: If passed a nonexistant srcdir, or one not
containing .ikiwiki, abort with an error rather than creating it.
interpolation on user-supplied data when translating pagespecs.
* ikiwiki-transition: Allow setup files to be passed to all subcommands
that need a srcdir.
+ * ikiwiki-transition: deduplinks was broken and threw away all
+ metadata stored by plugins in the index. Fix this bug.
+ * listdirectives: Avoid listing _comment directives and generally
+ assume any directive starting with _ is likewise internal.
- -- Joey Hess <joeyh@debian.org> Wed, 06 May 2009 20:45:44 -0400
+ -- Joey Hess <joeyh@debian.org> Fri, 22 May 2009 14:10:56 -0400
ikiwiki (3.12) unstable; urgency=low
liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl,
libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl,
sparkline-php, texlive, dvipng, libtext-wikicreole-perl,
- libsort-naturally-perl, libtext-textile-perl, po4a (>= 0.35-1), gettext
- libsort-naturally-perl, libtext-textile-perl, libhighlight-perl
++ libsort-naturally-perl, libtext-textile-perl, libhighlight-perl,
++ po4a (>= 0.35-1), gettext
Conflicts: ikiwiki-plugin-table
Replaces: ikiwiki-plugin-table
Provides: ikiwiki-plugin-table
my @progs="ikiwiki.in";
my @libs="IkiWiki.pm";
# monotone, external, amazon_s3 skipped since they need perl modules
-push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v amazon_s3.pm`;
+push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v amazon_s3.pm | grep -v po.pm`;
push @libs, 'IkiWiki/Plugin/skeleton.pm.example';
plan(tests => (@progs + @libs));
foreach my $file (@progs) {
- ok(system("perl -T -c $file >/dev/null 2>&1") eq 0, $file);
+ ok(system("perl -c $file >/dev/null 2>&1") eq 0, $file);
}
foreach my $file (@libs) {
ok(system("perl -c $file >/dev/null 2>&1") eq 0, $file);