From bc66a00b90e00971156f1aea5678ce88d006e84d Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Sun, 21 Dec 2008 15:07:36 +0000
Subject: comments: linkify and preprocess preview with correct 'page' param
---
IkiWiki/Plugin/comments.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'IkiWiki')
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 644ef1be8..34bbafeed 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -432,8 +432,8 @@ sub sessioncgi ($$) {
if ($form->submitted eq PREVIEW) {
my $preview = IkiWiki::htmlize($location, $page, '_comment',
- IkiWiki::linkify($page, $page,
- IkiWiki::preprocess($page, $page,
+ IkiWiki::linkify($location, $page,
+ IkiWiki::preprocess($location, $page,
IkiWiki::filter($location,
$page, $content),
0, 1)));
--
cgit v1.2.3
From 95b3bbbf7c786cc9e1dd7d7925ac75a0f525affd Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Sun, 21 Dec 2008 15:08:14 +0000
Subject: comments: run pagetemplate hooks
This fixes the bug that comments are always said to be from an anonymous
user at an unknown IP address.
---
IkiWiki/Plugin/comments.pm | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'IkiWiki')
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 34bbafeed..23e089761 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -447,6 +447,12 @@ sub sessioncgi ($$) {
$template->param(title => $form->field('subject'));
$template->param(ctime => displaytime(time));
+ IkiWiki::run_hooks(pagetemplate => sub {
+ shift->(page => $location,
+ destpage => $page,
+ template => $template);
+ });
+
$form->tmpl_param(page_preview => $template->output);
}
else {
--
cgit v1.2.3
From d0d598e429313756192927418757e2869004049e Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Sun, 21 Dec 2008 17:15:49 +0000
Subject: comments: substitute commentsurl and atomcommentsurl for use in feeds
---
IkiWiki/Plugin/comments.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'IkiWiki')
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 23e089761..0ae9eefe3 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -531,6 +531,8 @@ sub pagetemplate (@) {
my $page = $params{page};
my $template = $params{template};
my $shown = ($template->query(name => 'commentslink') ||
+ $template->query(name => 'commentsurl') ||
+ $template->query(name => 'atomcommentsurl') ||
$template->query(name => 'comments')) &&
commentsshown($page);
@@ -560,6 +562,22 @@ sub pagetemplate (@) {
}
}
+ if ($template->query(name => 'commentsurl')) {
+ if ($shown) {
+ $template->param(commentsurl =>
+ urlto($page, undef, 1).'#comments');
+ }
+ }
+
+ if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) {
+ if ($shown) {
+ # This will 404 until there are some comments, but I
+ # think that's probably OK...
+ $template->param(atomcommentsurl =>
+ urlto($page, undef, 1).'comments.atom');
+ }
+ }
+
if ($template->query(name => 'commentslink')) {
# XXX Would be nice to say how many comments there are in
# the link. But, to update the number, blog pages
--
cgit v1.2.3