]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge commit 'upstream/master' into prv/po
authorintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 12:34:00 +0000 (13:34 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 1 Jan 2009 12:34:00 +0000 (13:34 +0100)
1  2 
IkiWiki/Plugin/link.pm
IkiWiki/Plugin/parentlinks.pm
IkiWiki/Plugin/rename.pm
doc/plugins/write.mdwn

diff --combined IkiWiki/Plugin/link.pm
index e9623035b92f7fea8d1a33b40cd20d26505a83cf,b79273f96240dcfc0a66308bb3a942f6198945f0..48691d97363881d2a70e210364e8fd76abb2eede
@@@ -3,7 -3,7 +3,7 @@@ package IkiWiki::Plugin::link
  
  use warnings;
  use strict;
- use IkiWiki 2.00;
+ use IkiWiki 3.00;
  
  my $link_regexp;
  
@@@ -12,7 -12,7 +12,7 @@@ sub import 
        hook(type => "checkconfig", id => "link", call => \&checkconfig);
        hook(type => "linkify", id => "link", call => \&linkify);
        hook(type => "scan", id => "link", call => \&scan);
 -      hook(type => "renamepage", id => "link", call => \&renamepage);
 +      hook(type => "renamelink", id => "link", call => \&renamelink);
  }
  
  sub getsetup () {
@@@ -90,7 -90,7 +90,7 @@@ sub scan (@) 
        }
  }
  
 -sub renamepage (@) {
 +sub renamelink (@) {
        my %params=@_;
        my $page=$params{page};
        my $old=$params{oldpage};
index 866201e5ee1e3eace05d68d17af1ca28fd469543,ebf1d449ae50522dac1174176810c4bd3db99799..1ee69cbff4901695117e1d335f106d1dcb044367
@@@ -4,7 -4,7 +4,7 @@@ package IkiWiki::Plugin::parentlinks
  
  use warnings;
  use strict;
- use IkiWiki 2.00;
+ use IkiWiki 3.00;
  
  sub import {
        hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks);
@@@ -36,7 -36,7 +36,7 @@@ sub parentlinks ($) 
                $depth=$i;
                $height=($pagedepth - $depth);
                push @ret, {
 -                      url => urlto($path, $page),
 +                      url => urlto(bestlink($page, $path), $page),
                        page => $title,
                        depth => $depth,
                        height => $height,
diff --combined IkiWiki/Plugin/rename.pm
index 227f59bfa45baf719e93cf8163f59659d74df004,54c7faf137c1c87d5e90156b74be3e1139ef04d3..25ddd2d65870fea21fda94930fa90031ec9e4342
@@@ -3,7 -3,7 +3,7 @@@ package IkiWiki::Plugin::rename
  
  use warnings;
  use strict;
- use IkiWiki 2.00;
+ use IkiWiki 3.00;
  
  sub import {
        hook(type => "getsetup", id => "rename", call => \&getsetup);
@@@ -195,7 -195,7 +195,7 @@@ sub postrename ($;$$$) 
                # Update edit form content to fix any links present
                # on it.
                $postrename->param("editcontent",
 -                      renamepage_hook($dest, $src, $dest,
 +                      renamelink_hook($dest, $src, $dest,
                                 $postrename->param("editcontent")));
  
                # Get a new edit token; old was likely invalidated.
@@@ -291,8 -291,6 +291,8 @@@ sub sessioncgi ($$) 
                                required => 1,
                        };
  
 +                      IkiWiki::run_hooks(rename => sub { shift->(\@torename); });
 +
                        # See if any subpages need to be renamed.
                        if ($q->param("subpages") && $src ne $dest) {
                                foreach my $p (keys %pagesources) {
        }
  }
  
 -sub renamepage_hook ($$$$) {
 +sub renamelink_hook ($$$$) {
        my ($page, $src, $dest, $content)=@_;
  
 -      IkiWiki::run_hooks(renamepage => sub {
 +      IkiWiki::run_hooks(renamelink => sub {
                $content=shift->(
                        page => $page,
                        oldpage => $src,
@@@ -482,7 -480,7 +482,7 @@@ sub fixlinks ($$$) 
                if ($needfix) {
                        my $file=$pagesources{$page};
                        my $oldcontent=readfile($config{srcdir}."/".$file);
 -                      my $content=renamepage_hook($page, $rename->{src}, $rename->{dest}, $oldcontent);
 +                      my $content=renamelink_hook($page, $rename->{src}, $rename->{dest}, $oldcontent);
                        if ($oldcontent ne $content) {
                                my $token=IkiWiki::rcs_prepedit($file);
                                eval { writefile($file, $config{srcdir}, $content) };
diff --combined doc/plugins/write.mdwn
index d024a5dd47b6fe9066ece1413ad97e241536ba11,405876d58a9a7200e01d2d77ed91cb9892523ed4..eb50ca4ef546765d61edd715fb207bfda93026f7
@@@ -19,7 -19,7 +19,7 @@@ that can be fleshed out to make a usefu
  `IkiWiki::Plugin::pagecount` is another simple example. All perl plugins
  should `use IkiWiki` to import the ikiwiki plugin interface. It's a good
  idea to include the version number of the plugin interface that your plugin
- expects: `use IkiWiki 2.00`.
+ expects: `use IkiWiki 3.00`.
  
  An external plugin is an executable program. It can be written in any
  language. Its interface to ikiwiki is via XML RPC, which it reads from
@@@ -360,25 -360,14 +360,25 @@@ This hook is called whenever ikiwiki no
  the state is saved. The function can save other state, modify values before
  they're saved, etc.
  
 -### renamepage
 +### renamelink
  
 -      hook(type => "renamepage", id => "foo", call => \&renamepage);
 +      hook(type => "renamelink", id => "foo", call => \&renamelink);
  
  This hook is called by the [[plugins/rename]] plugin when it renames
 -something. The hook is passed named parameters: `page`, `oldpage`,
 -`newpage`, and `content`, and should try to modify the content to reflect
 -the name change. For example, by converting links to point to the new page.
 +something, once per page linking to the renamed page's old location.
 +The hook is passed named parameters: `page`, `oldpage`, `newpage`, and
 +`content`, and should try to modify the content of `page` to reflect
 +the name change. For example, by converting links to point to the
 +new page.
 +
 +### rename
 +
 +      hook(type => "rename", id => "foo", call => \&renamepages);
 +
 +When a page or set of pages is renamed, the referenced function is
 +called, and passed a reference to an array of hashes with keys:
 +`src`, `srcfile`, `dest`, `destfile`, `required`. It can modify
 +the array.
  
  ### getsetup
  
@@@ -442,7 -431,7 +442,7 @@@ describes the plugin as a whole. For ex
  
  To import the ikiwiki plugin interface:
  
-       use IkiWiki '2.00';
+       use IkiWiki '3.00';
  
  This will import several variables and functions into your plugin's
  namespace. These variables and functions are the ones most plugins need,
@@@ -497,7 -486,7 +497,7 @@@ use the following hashes, using a page 
    destination file.
  * `%pagesources` contains the name of the source file for each page.
  
- Also, the %IkiWiki::version variable contains the version number for the
+ Also, the `%IkiWiki::version` variable contains the version number for the
  ikiwiki program.
  
  ### Library functions