summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-11-11 17:52:32 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-11-11 17:52:32 -0500
commit2a56ec664402e21625e9251dcbb3b53490e7ed0d (patch)
treea3b8ca059cd5b671721b071f4d30786a389d7196 /IkiWiki
parentf6db9205369d1197bbd05f3e07ed79393b5fe220 (diff)
parentd1b22b252481134815b1d02d564b6b9622fe7b4b (diff)
Merge branch 'master' into po
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/aggregate.pm12
-rw-r--r--IkiWiki/Plugin/bzr.pm2
-rw-r--r--IkiWiki/Plugin/goodstuff.pm1
-rw-r--r--IkiWiki/Plugin/recentchanges.pm2
-rw-r--r--IkiWiki/Plugin/tag.pm9
-rw-r--r--IkiWiki/Plugin/txt.pm2
-rw-r--r--IkiWiki/Wrapper.pm17
7 files changed, 28 insertions, 17 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 2e4c86f24..c9c2880c5 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -520,10 +520,10 @@ sub aggregate (@) { #{{{
}
foreach my $entry ($f->entries) {
- my $content=$content=$entry->content->body;
+ my $c=$entry->content;
# atom feeds may have no content, only a summary
- if (! defined $content && ref $entry->summary) {
- $content=$entry->summary->body;
+ if (! defined $c && ref $entry->summary) {
+ $c=$entry->summary;
}
add_page(
@@ -531,9 +531,10 @@ sub aggregate (@) { #{{{
copyright => $f->copyright,
title => defined $entry->title ? decode_entities($entry->title) : "untitled",
link => $entry->link,
- content => defined $content ? $content : "",
+ content => defined $c ? $c->body : "",
guid => defined $entry->id ? $entry->id : time."_".$feed->{name},
ctime => $entry->issued ? ($entry->issued->epoch || time) : time,
+ base => (defined $c && $c->can("base")) ? $c->base : undef,
);
}
}
@@ -605,7 +606,8 @@ sub add_page (@) { #{{{
my $template=template($feed->{template}, blind_cache => 1);
$template->param(title => $params{title})
if defined $params{title} && length($params{title});
- $template->param(content => htmlescape(htmlabs($params{content}, $feed->{feedurl})));
+ $template->param(content => htmlescape(htmlabs($params{content},
+ defined $params{base} ? $params{base} : $feed->{feedurl})));
$template->param(name => $feed->{name});
$template->param(url => $feed->{url});
$template->param(copyright => $params{copyright})
diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
index 101e91b93..1054f5b3e 100644
--- a/IkiWiki/Plugin/bzr.pm
+++ b/IkiWiki/Plugin/bzr.pm
@@ -246,7 +246,7 @@ sub rcs_recentchanges ($) { #{{{
rev => $info->{"revno"},
user => $user,
committype => "bzr",
- when => time - str2time($info->{"timestamp"}),
+ when => str2time($info->{"timestamp"}),
message => [@message],
pages => [@pages],
};
diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm
index ed1f4ddfc..a18e626d4 100644
--- a/IkiWiki/Plugin/goodstuff.pm
+++ b/IkiWiki/Plugin/goodstuff.pm
@@ -10,7 +10,6 @@ my @bundle=qw{
brokenlinks
img
map
- meta
more
orphans
pagecount
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index a73ff37b9..3f70664ac 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -131,7 +131,7 @@ sub store ($$$) { #{{{
do => "recentchanges_link",
page => $_->{page}
).
- "\">".
+ "\" rel=\"nofollow\">".
pagetitle($_->{page}).
"</a>"
}
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index c4a175677..d725ef9b3 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -44,6 +44,7 @@ sub tagpage ($) { #{{{
if ($tag !~ m{^\.?/} &&
defined $config{tagbase}) {
$tag="/".$config{tagbase}."/".$tag;
+ $tag=~y#/#/#s; # squash dups
}
return $tag;
@@ -55,13 +56,7 @@ sub taglink ($$$;@) { #{{{
my $tag=shift;
my %opts=@_;
- my $link=tagpage($tag);
-
- # Force tag creation links to create the tag under /tagbase,
- # if there is a tagbase and this tag used it.
- $link="/".$link if $tag ne $link;
-
- return htmllink($page, $destpage, $link, %opts);
+ return htmllink($page, $destpage, tagpage($tag), %opts);
} #}}}
sub preprocess_tag (@) { #{{{
diff --git a/IkiWiki/Plugin/txt.pm b/IkiWiki/Plugin/txt.pm
index e4c9e5d6a..e157bf07e 100644
--- a/IkiWiki/Plugin/txt.pm
+++ b/IkiWiki/Plugin/txt.pm
@@ -39,7 +39,7 @@ sub filter (@) {
my $content = $params{content};
if (defined $pagesources{$params{page}} && $pagesources{$params{page}} =~ /\.txt$/) {
- encode_entities($content);
+ encode_entities($content, "<>&");
if ($findurl) {
my $finder = URI::Find->new(sub {
my ($uri, $orig_uri) = @_;
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index 99237d3b5..7a2d4381a 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -44,6 +44,7 @@ EOF
}
my $check_commit_hook="";
+ my $pre_exec="";
if ($config{post_commit}) {
# Optimise checking !commit_hook_enabled() ,
# so that ikiwiki does not have to be started if the
@@ -58,7 +59,7 @@ EOF
# the benefit of this optimisation.
$check_commit_hook=<<"EOF";
{
- int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR);
+ int fd=open("$config{wikistatedir}/commitlock", O_CREAT | O_RDWR, 0666);
if (fd != -1) {
if (flock(fd, LOCK_SH | LOCK_NB) != 0)
exit(0);
@@ -67,6 +68,19 @@ EOF
}
EOF
}
+ elsif ($config{cgi}) {
+ # Avoid more than one ikiwiki cgi running at a time by
+ # taking a cgi lock. Since ikiwiki uses several MB of
+ # memory, a pile up of processes could cause thrashing
+ # otherwise.
+ $pre_exec=<<"EOF";
+ {
+ int fd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
+ if (fd != -1)
+ flock(fd, LOCK_EX);
+ }
+EOF
+ }
$Data::Dumper::Indent=0; # no newlines
my $configstring=Data::Dumper->Dump([\%config], ['*config']);
@@ -122,6 +136,7 @@ $envsave
exit(1);
}
+$pre_exec
execl("$this", "$this", NULL);
perror("exec $this");
exit(1);