summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/more.pm
blob: 80e339a1be7c876e05820ba2da3e444d97770345 (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. return "<a name=\"more\"></a>\n\n".
  30. IkiWiki::preprocess($params{page}, $params{destpage},
  31. $params{text});
  32. }
  33. }
  34. 1