summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-19 18:14:02 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-19 18:14:02 +0000
commitdcfc0593d3aa0b464fe05d08939b5e52cb29412c (patch)
tree0b4e12b330d0ecee2719ca8c95bcec92ebd3d4df /doc
parentc297ceb50ca072058d04835c369c8c61561da0e4 (diff)
web commit by http://id.inelegant.org/: Enables _Read more_ links for use in blog posts. Adds a config option for customising the anchor text.
Diffstat (limited to 'doc')
-rw-r--r--doc/patchqueue/morelink-plugin.mdwn37
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/patchqueue/morelink-plugin.mdwn b/doc/patchqueue/morelink-plugin.mdwn
new file mode 100644
index 000000000..02d20329b
--- /dev/null
+++ b/doc/patchqueue/morelink-plugin.mdwn
@@ -0,0 +1,37 @@
+Enables _Read more_ links for use in blog posts. Adds a config option for customising the anchor text.
+
+ Index: IkiWiki/Plugin/morelink.pm
+ ===================================================================
+ --- IkiWiki/Plugin/morelink.pm (revision 0)
+ +++ IkiWiki/Plugin/morelink.pm (revision 0)
+ @@ -0,0 +1,30 @@
+ +#!/usr/bin/perl
+ +package IkiWiki::Plugin::morelink;
+ +
+ +use warnings;
+ +use strict;
+ +use IkiWiki;
+ +
+ +my $linktext = 'Read more';
+ +
+ +sub import { #{{{
+ + hook(type => "checkconfig", id => "more", call => \&checkconfig);
+ + hook(type => "preprocess", id => "more", call => \&preprocess);
+ +} # }}}
+ +
+ +sub checkconfig () { #{{{
+ + $linktext = $config{morelink_text} || $linktext;
+ +} #}}}
+ +
+ +sub preprocess (@) { #{{{
+ + my %args = @_;
+ +
+ + if ($args{page} ne $args{destpage}) {
+ + return "\n".htmllink($args{page}, $args{destpage}, $args{page}.'#more', 0, 0, $linktext);
+ + }
+ + else {
+ + return "<a name='more'></a>".$args{text};
+ + }
+ +}
+ +
+ +1