summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/more.pm
blob: f1216ad3dfe8b4bf61b8296cb693150bbc81216d (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::more;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 2.00;
  6. my $linktext = gettext("more");
  7. sub import {
  8. hook(type => "getsetup", id => "more", call => \&getsetup);
  9. hook(type => "preprocess", id => "more", call => \&preprocess);
  10. }
  11. sub getsetup () {
  12. return
  13. plugin => {
  14. safe => 1,
  15. rebuild => undef,
  16. },
  17. }
  18. sub preprocess (@) {
  19. my %params=@_;
  20. $params{linktext} = $linktext unless defined $params{linktext};
  21. if ($params{page} ne $params{destpage}) {
  22. return "\n".
  23. htmllink($params{page}, $params{destpage}, $params{page},
  24. linktext => $params{linktext},
  25. anchor => "more");
  26. }
  27. else {
  28. $params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
  29. IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
  30. return "<a name=\"more\"></a>\n\n".$params{text};
  31. }
  32. }
  33. 1