diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-20 03:05:47 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-20 03:05:47 +0000 |
commit | fa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5 (patch) | |
tree | 3a4eadd971ccd69bd4037ad3647b6cce64047833 /IkiWiki/Plugin | |
parent | 2ce6c23f9485d26d443fb5a1f8c5286a5e668625 (diff) | |
download | ikiwiki-fa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5.tar ikiwiki-fa52a730ff3b30c7d2cdd8cd5f9c8c25a0c0a2a5.tar.gz |
* Changed calling convention for httmllink slightly. The first three
parameters remain the same, but additional options are now passed in using
named parameters.
* Change plugin interface version to 1.02 to reflect this change.
* Add a new anchor option to htmllink. Thanks Ben for the idea.
* Support anchors in wikilinks.
* Add a "more" plugin based on one contributed by Ben to allow implementing
those dreaded "Read more" links in blogs.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/brokenlinks.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 7 | ||||
-rw-r--r-- | IkiWiki/Plugin/lockedit.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/map.pm | 3 | ||||
-rw-r--r-- | IkiWiki/Plugin/more.pm | 32 | ||||
-rw-r--r-- | IkiWiki/Plugin/openid.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/orphans.pm | 10 | ||||
-rw-r--r-- | IkiWiki/Plugin/otl.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/pagestats.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/smiley.pm | 2 |
10 files changed, 58 insertions, 12 deletions
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index af2418ff4..d9d50f75f 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm @@ -27,9 +27,9 @@ sub preprocess (@) { #{{{ my $bestlink=bestlink($page, $link); next if length $bestlink; push @broken, - htmllink($page, $params{destpage}, $link, 1). + htmllink($page, $params{destpage}, $link, noimageinline => 1). " from ". - htmllink($params{page}, $params{destpage}, $page, 1); + htmllink($params{page}, $params{destpage}, $page, noimageinline => 1); } } } diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 57b4057d7..ebfcee9ed 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -166,7 +166,12 @@ sub preprocess_inline (@) { #{{{ (length $config{cgiurl} || exists $links{$page."/".$discussionlink})) { $template->param(have_actions => 1); - $template->param(discussionlink => htmllink($page, $params{page}, gettext("Discussion"), 1, 1)); + $template->param(discussionlink => + htmllink($page, + $params{page}, + gettext("Discussion"), + noimageinline => 1, + forcesubpage => 1)); } } if (length $config{cgiurl} && defined $type) { diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index 2b72fabe5..f204e72c0 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -22,7 +22,7 @@ sub canedit ($$) { #{{{ foreach my $admin (@{$config{adminuser}}) { if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"), "")) { return sprintf(gettext("%s is locked by %s and cannot be edited"), - htmllink("", "", $page, 1), + htmllink("", "", $page, noimageinline => 1), IkiWiki::userlink($admin)); } } @@ -40,7 +40,7 @@ sub formbuilder_setup (@) { #{{{ if ($form->title eq "preferences") { $form->field(name => "locked_pages", size => 50, - comment => "(".htmllink("", "", "PageSpec", 1).")"); + comment => "(".htmllink("", "", "PageSpec", noimageinline => 1).")"); if (! IkiWiki::is_admin($user_name)) { $form->field(name => "locked_pages", type => "hidden"); } diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 3c41194f4..07b63cb70 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -49,7 +49,8 @@ sub preprocess (@) { #{{{ } $map .= "</li>\n" if $openli; $map .= "<li>" - .htmllink($params{page}, $params{destpage}, $item) ."\n"; + .htmllink($params{page}, $params{destpage}, $item) + ."\n"; $openli=1; } while ($indent > 0) { diff --git a/IkiWiki/Plugin/more.pm b/IkiWiki/Plugin/more.pm new file mode 100644 index 000000000..dae3728ba --- /dev/null +++ b/IkiWiki/Plugin/more.pm @@ -0,0 +1,32 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::more; + +use warnings; +use strict; +use IkiWiki; + +my $linktext = gettext("more"); + +sub import { #{{{ + hook(type => "preprocess", id => "more", call => \&preprocess); +} # }}} + +sub preprocess (@) { #{{{ + my %params=@_; + + $params{linktext} = $linktext unless defined $params{linktext}; + + if ($params{page} ne $params{destpage}) { + return "\n". + htmllink($params{page}, $params{destpage}, $params{page}, + linktext => $params{linktext}, + anchor => "more"); + } + else { + $params{text}=IkiWiki::preprocess($params{page}, $params{destpage}, + IkiWiki::filter($params{page}, $params{text})); + return "<a name=\"more\"></a>\n\n".$params{text}; + } +} + +1 diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 5d387fbc6..65b884814 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -33,7 +33,7 @@ sub formbuilder_setup (@) { #{{{ label => "OpenID", size => 30, comment => '('. - htmllink("", "", "OpenID", 1, 0, gettext("What's this?")) + htmllink("", "", "OpenID", noimageinline => 1, linktext => gettext("What's this?")) .($config{openidsignup} ? " | <a href=\"$config{openidsignup}\">".gettext("Get an OpenID")."</a>" : "") .')' ); diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 39d836a01..f221954b8 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -40,7 +40,15 @@ sub preprocess (@) { #{{{ } return gettext("All pages are linked to by other pages.") unless @orphans; - return "<ul>\n".join("\n", map { "<li>".htmllink($params{page}, $params{destpage}, $_, 1)."</li>" } sort @orphans)."</ul>\n"; + return "<ul>\n". + join("\n", + map { + "<li>". + htmllink($params{page}, $params{destpage}, $_, + noimageinline => 1). + "</li>" + } sort @orphans). + "</ul>\n"; } # }}} 1 diff --git a/IkiWiki/Plugin/otl.pm b/IkiWiki/Plugin/otl.pm index 3f3413390..94a2b80f6 100644 --- a/IkiWiki/Plugin/otl.pm +++ b/IkiWiki/Plugin/otl.pm @@ -17,9 +17,9 @@ sub filter (@) { #{{{ # Munge up check boxes to look a little bit better. This is a hack. my $checked=htmllink($params{page}, $params{page}, - "smileys/star_on.png", 0, 0, "[X]"); + "smileys/star_on.png", linktext => "[X]"); my $unchecked=htmllink($params{page}, $params{page}, - "smileys/star_off.png", 0, 0, "[_]"); + "smileys/star_off.png", linktext => "[_]"); $params{content}=~s/^(\s*)\[X\]\s/${1}$checked /mg; $params{content}=~s/^(\s*)\[_\]\s/${1}$unchecked /mg; diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index f9a54ab56..1edb39455 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -45,7 +45,7 @@ sub preprocess (@) { #{{{ return "<table class='pageStats'>\n". join("\n", map { "<tr><td>". - htmllink($params{page}, $params{destpage}, $_, 1). + htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). "</td><td>".$counts{$_}."</td></tr>" } sort { $counts{$b} <=> $counts{$a} } keys %counts). diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 45d00abea..14b8cacf8 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -35,7 +35,7 @@ sub filter (@) { #{{{ my %params=@_; $params{content} =~ s{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}{ - $1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, 0, 0, $2) + $1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, linktext => $2) }egs; return $params{content}; |