summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-09-27 14:14:36 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-09-27 14:27:42 -0400
commit9ec9d6901d444af48555abf7b4c26d1965c46017 (patch)
tree3139a86f4dcffaea5d90c6120b8b1d25edbc07e6 /IkiWiki/Plugin
parentbfab23ce33c86f03bff6fb5c36f7bf082fe2cbcf (diff)
Export pagetitle, titlepage, linkpage.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm4
-rw-r--r--IkiWiki/Plugin/attachment.pm3
-rw-r--r--IkiWiki/Plugin/camelcase.pm4
-rw-r--r--IkiWiki/Plugin/edittemplate.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm2
-rw-r--r--IkiWiki/Plugin/link.pm12
-rw-r--r--IkiWiki/Plugin/listdirectives.pm2
-rw-r--r--IkiWiki/Plugin/meta.pm2
-rw-r--r--IkiWiki/Plugin/parentlinks.pm2
-rw-r--r--IkiWiki/Plugin/recentchanges.pm6
-rw-r--r--IkiWiki/Plugin/remove.pm2
-rw-r--r--IkiWiki/Plugin/rename.pm6
-rw-r--r--IkiWiki/Plugin/search.pm2
-rw-r--r--IkiWiki/Plugin/tag.pm8
14 files changed, 28 insertions, 29 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 8044f1ed4..c7bd1875a 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -228,7 +228,7 @@ sub preprocess (@) { #{{{
$feed->{name}=$name;
$feed->{sourcepage}=$params{page};
$feed->{url}=$params{url};
- my $dir=exists $params{dir} ? $params{dir} : $params{page}."/".IkiWiki::titlepage($params{name});
+ my $dir=exists $params{dir} ? $params{dir} : $params{page}."/".titlepage($params{name});
$dir=~s/^\/+//;
($dir)=$dir=~/$config{wiki_file_regexp}/;
$feed->{dir}=$dir;
@@ -559,7 +559,7 @@ sub add_page (@) { #{{{
$feed->{newposts}++;
# assign it an unused page
- my $page=IkiWiki::titlepage($params{title});
+ my $page=titlepage($params{title});
# escape slashes and periods in title so it doesn't specify
# directory name or trigger ".." disallowing code.
$page=~s!([/.])!"__".ord($1)."__"!eg;
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index 6214df7f3..837992841 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -181,8 +181,7 @@ sub formbuilder (@) { #{{{
}
}
- $filename=IkiWiki::linkpage(
- IkiWiki::possibly_foolish_untaint(
+ $filename=linkpage(IkiWiki::possibly_foolish_untaint(
attachment_location($form->field('page')).
IkiWiki::basename($filename)));
if (IkiWiki::file_pruned($filename, $config{srcdir})) {
diff --git a/IkiWiki/Plugin/camelcase.pm b/IkiWiki/Plugin/camelcase.pm
index 3f17df4a3..7881becd5 100644
--- a/IkiWiki/Plugin/camelcase.pm
+++ b/IkiWiki/Plugin/camelcase.pm
@@ -42,7 +42,7 @@ sub linkify (@) { #{{{
my $destpage=$params{destpage};
$params{content}=~s{$link_regexp}{
- htmllink($page, $destpage, IkiWiki::linkpage($1))
+ htmllink($page, $destpage, linkpage($1))
}eg;
return $params{content};
@@ -54,7 +54,7 @@ sub scan (@) { #{{{
my $content=$params{content};
while ($content =~ /$link_regexp/g) {
- push @{$links{$page}}, IkiWiki::linkpage($1);
+ push @{$links{$page}}, linkpage($1);
}
}
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm
index 84c28a9d0..846b4e7c8 100644
--- a/IkiWiki/Plugin/edittemplate.pm
+++ b/IkiWiki/Plugin/edittemplate.pm
@@ -54,7 +54,7 @@ sub preprocess (@) { #{{{
error gettext("match not specified")
}
- my $link=IkiWiki::linkpage($params{template});
+ my $link=linkpage($params{template});
$pagestate{$params{page}}{edittemplate}{$params{match}}=$link;
return "" if ($params{silent} && IkiWiki::yesno($params{silent}));
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 8efef3fc8..e0f33ef31 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -119,7 +119,7 @@ sub sessioncgi () { #{{{
my $session=shift;
if ($q->param('do') eq 'blog') {
- my $page=IkiWiki::titlepage(decode_utf8($q->param('title')));
+ my $page=titlepage(decode_utf8($q->param('title')));
$page=~s/(\/)/"__".ord($1)."__"/eg; # don't create subdirs
# if the page already exists, munge it to be unique
my $from=$q->param('from');
diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm
index 957355643..0638d4bdd 100644
--- a/IkiWiki/Plugin/link.pm
+++ b/IkiWiki/Plugin/link.pm
@@ -69,11 +69,11 @@ sub linkify (@) { #{{{
defined $2
? ( $1
? "[[$2|$3".($4 ? "#$4" : "")."]]"
- : htmllink($page, $destpage, IkiWiki::linkpage($3),
- anchor => $4, linktext => IkiWiki::pagetitle($2)))
+ : htmllink($page, $destpage, linkpage($3),
+ anchor => $4, linktext => pagetitle($2)))
: ( $1
? "[[$3".($4 ? "#$4" : "")."]]"
- : htmllink($page, $destpage, IkiWiki::linkpage($3),
+ : htmllink($page, $destpage, linkpage($3),
anchor => $4))
}eg;
@@ -86,7 +86,7 @@ sub scan (@) { #{{{
my $content=$params{content};
while ($content =~ /(?<!\\)$link_regexp/g) {
- push @{$links{$page}}, IkiWiki::linkpage($2);
+ push @{$links{$page}}, linkpage($2);
}
} # }}}
@@ -99,8 +99,8 @@ sub renamepage (@) { #{{{
$params{content} =~ s{(?<!\\)$link_regexp}{
my $linktext=$2;
my $link=$linktext;
- if (bestlink($page, IkiWiki::linkpage($linktext)) eq $old) {
- $link=IkiWiki::pagetitle($new, 1);
+ if (bestlink($page, linkpage($linktext)) eq $old) {
+ $link=pagetitle($new, 1);
$link=~s/ /_/g;
if ($linktext =~ m/.*\/*?[A-Z]/) {
# preserve leading cap of last component
diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm
index 6f8ddb06a..fc8927ccb 100644
--- a/IkiWiki/Plugin/listdirectives.pm
+++ b/IkiWiki/Plugin/listdirectives.pm
@@ -84,7 +84,7 @@ sub preprocess (@) { #{{{
foreach my $plugin (@pluginlist) {
$result .= '<li class="listdirectives">';
- my $link=IkiWiki::linkpage($config{directive_description_dir}."/".$plugin);
+ my $link=linkpage($config{directive_description_dir}."/".$plugin);
add_depends($params{page}, $link);
$result .= htmllink($params{page}, $params{destpage}, $link);
$result .= '</li>';
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index b2c85c892..8d444109f 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -273,7 +273,7 @@ sub match { #{{{
$val=$pagestate{$page}{meta}{$field};
}
elsif ($field eq 'title') {
- $val = IkiWiki::pagetitle($page);
+ $val = pagetitle($page);
}
if (defined $val) {
diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm
index 4525145d6..a8b3641e9 100644
--- a/IkiWiki/Plugin/parentlinks.pm
+++ b/IkiWiki/Plugin/parentlinks.pm
@@ -44,7 +44,7 @@ sub parentlinks ($) { #{{{
"height_$height" => 1,
};
$path.="/".$dir;
- $title=IkiWiki::pagetitle($dir);
+ $title=pagetitle($dir);
$i++;
}
return @ret;
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index bef0e7085..eb23b184b 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -114,7 +114,7 @@ sub cgi ($) { #{{{
sub store ($$$) { #{{{
my $change=shift;
- my $page="$config{recentchangespage}/change_".IkiWiki::titlepage($change->{rev});
+ my $page="$config{recentchangespage}/change_".titlepage($change->{rev});
# Optimisation to avoid re-writing pages. Assumes commits never
# change (or that any changes are not important).
@@ -132,11 +132,11 @@ sub store ($$$) { #{{{
page => $_->{page}
).
"\">".
- IkiWiki::pagetitle($_->{page}).
+ pagetitle($_->{page}).
"</a>"
}
else {
- $_->{link} = IkiWiki::pagetitle($_->{page});
+ $_->{link} = pagetitle($_->{page});
}
$_->{baseurl}="$config{url}/" if length $config{url};
diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm
index 91a66cb6e..c8d76368e 100644
--- a/IkiWiki/Plugin/remove.pm
+++ b/IkiWiki/Plugin/remove.pm
@@ -110,7 +110,7 @@ sub removal_confirm ($$@) { #{{{
my ($f, $buttons)=confirmation_form($q, $session);
$f->title(sprintf(gettext("confirm removal of %s"),
- join(", ", map { IkiWiki::pagetitle($_) } @pages)));
+ join(", ", map { pagetitle($_) } @pages)));
$f->field(name => "page", type => "hidden", value => \@pages, force => 1);
if (defined $attachment) {
$f->field(name => "attachment", type => "hidden",
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 0ea77ec64..3ee457ff0 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -98,7 +98,7 @@ sub rename_form ($$$) { #{{{
error($@) if $@;
my $f = CGI::FormBuilder->new(
name => "rename",
- title => sprintf(gettext("rename %s"), IkiWiki::pagetitle($page)),
+ title => sprintf(gettext("rename %s"), pagetitle($page)),
header => 0,
charset => "utf-8",
method => 'POST',
@@ -111,7 +111,7 @@ sub rename_form ($$$) { #{{{
$f->field(name => "do", type => "hidden", value => "rename", force => 1);
$f->field(name => "page", type => "hidden", value => $page, force => 1);
- $f->field(name => "new_name", value => IkiWiki::pagetitle($page), size => 60);
+ $f->field(name => "new_name", value => pagetitle($page), size => 60);
if (!$q->param("attachment")) {
# insert the standard extensions
my @page_types;
@@ -267,7 +267,7 @@ sub sessioncgi ($$) { #{{{
# performed in check_canrename later.
my $src=$q->param("page");
my $srcfile=IkiWiki::possibly_foolish_untaint($pagesources{$src});
- my $dest=IkiWiki::possibly_foolish_untaint(IkiWiki::titlepage($q->param("new_name")));
+ my $dest=IkiWiki::possibly_foolish_untaint(titlepage($q->param("new_name")));
my $destfile=$dest;
if (! $q->param("attachment")) {
my $type=$q->param('type');
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index aeef54ab3..e40f4888c 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -73,7 +73,7 @@ sub index (@) { #{{{
my $db=xapiandb();
my $doc=Search::Xapian::Document->new();
- my $caption=IkiWiki::pagetitle($params{page});
+ my $caption=pagetitle($params{page});
my $title;
if (exists $pagestate{$params{page}}{meta} &&
exists $pagestate{$params{page}}{meta}{title}) {
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index bf53209fc..158657507 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -75,7 +75,7 @@ sub preprocess_tag (@) { #{{{
delete $params{preview};
foreach my $tag (keys %params) {
- $tag=IkiWiki::linkpage($tag);
+ $tag=linkpage($tag);
$tags{$page}{$tag}=1;
# hidden WikiLink
push @{$links{$page}}, tagpage($tag);
@@ -91,14 +91,14 @@ sub preprocess_taglink (@) { #{{{
my %params=@_;
return join(" ", map {
if (/(.*)\|(.*)/) {
- my $tag=IkiWiki::linkpage($2);
+ my $tag=linkpage($2);
$tags{$params{page}}{$tag}=1;
push @{$links{$params{page}}}, tagpage($tag);
return taglink($params{page}, $params{destpage}, $tag,
- linktext => IkiWiki::pagetitle($1));
+ linktext => pagetitle($1));
}
else {
- my $tag=IkiWiki::linkpage($_);
+ my $tag=linkpage($_);
$tags{$params{page}}{$tag}=1;
push @{$links{$params{page}}}, tagpage($tag);
return taglink($params{page}, $params{destpage}, $tag);