summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/more.pm
blob: 266c8e1d0937dc9aefc677d536cc26a8d18e66c7 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::more;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 3.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. section => "widget",
  17. },
  18. }
  19. sub preprocess (@) {
  20. my %params=@_;
  21. $params{linktext} = $linktext unless defined $params{linktext};
  22. if ($params{page} ne $params{destpage}) {
  23. return "\n".
  24. htmllink($params{page}, $params{destpage}, $params{page},
  25. linktext => $params{linktext},
  26. anchor => "more");
  27. }
  28. else {
  29. $params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
  30. IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
  31. return "<a name=\"more\"></a>\n\n".$params{text};
  32. }
  33. }
  34. 1