summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-21 16:42:25 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-21 16:42:25 -0400
commitb9071082717cd7fd56e66963b47a6d589848e062 (patch)
treebba6504403d5dd8aa80be186934f5369d5f18f2e
parent7ae0f754f3d82273948f8c5f1426fda91420aeb1 (diff)
meta: Gather permalink info on scan pass so it is available to inline when using a template that does not include page content.
-rw-r--r--IkiWiki/Plugin/meta.pm7
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/inline_breaks_PERMALINK_variable.mdwn16
3 files changed, 23 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 8dcd73a1a..6fe9cda34 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -121,6 +121,10 @@ sub preprocess (@) {
$pagestate{$page}{meta}{authorurl}=$value if safeurl($value);
# fallthrough
}
+ elsif ($key eq 'permalink') {
+ $pagestate{$page}{meta}{permalink}=$value if safeurl($value);
+ # fallthrough
+ }
elsif ($key eq 'date') {
eval q{use Date::Parse};
if (! $@) {
@@ -141,10 +145,9 @@ sub preprocess (@) {
return;
}
- # Metadata collection that happens only during preprocessing pass.
+ # Metadata handling that happens only during preprocessing pass.
if ($key eq 'permalink') {
if (safeurl($value)) {
- $pagestate{$page}{meta}{permalink}=$value;
push @{$metaheaders{$page}}, scrub('<link rel="bookmark" href="'.encode_entities($value).'" />', $destpage);
}
}
diff --git a/debian/changelog b/debian/changelog
index 0ff7a0d13..be30b498c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ ikiwiki (3.20091018) UNRELEASED; urgency=low
* Fix a bug introduced in the last version that caused ikiwiki
to skip all files if a sourcedir of "./" was specified.
* Support CFLAGS when building wrapper.
+ * meta: Gather permalink info on scan pass so it is available
+ to inline when using a template that does not include page content.
-- Joey Hess <joeyh@debian.org> Sun, 18 Oct 2009 13:44:09 -0400
diff --git a/doc/bugs/inline_breaks_PERMALINK_variable.mdwn b/doc/bugs/inline_breaks_PERMALINK_variable.mdwn
index 8a50b1262..fc891bb25 100644
--- a/doc/bugs/inline_breaks_PERMALINK_variable.mdwn
+++ b/doc/bugs/inline_breaks_PERMALINK_variable.mdwn
@@ -7,3 +7,19 @@ with sometemplate being
> `<p><a href="<TMPL_VAR PERMALINK>"><TMPL_VAR TITLE></a> (<TMPL_VAR CTIME>)</p>`
produced output that links nowhere (`<a href="">`) while the other variables do fine. This problem does not occur in 3.1415926.
+
+> This must be caused by an optimisation that avoids reading the page
+> content when using a template that does not use CONTENT.
+>
+> I guess that it needs to instead check all the variables the template
+> uses, and read content if PERMALINK, or probably any other unknown
+> variable is used. Unfortunatly, that will lose the optimisation
+> for the archivepage template as well -- it also uses PERMALINK.
+>
+> So, revert the optimisation? Or, make meta gather the permalink
+> data on scan? That seems doable, but is not a general fix for
+> other stuff that might be a) used in a template and b) gathered
+> at preprocess time.
+>
+> For now, I am going with the special case fix of fixing meta. I may need
+> to go for a more general fix later. --[[Joey]] [[!tag done]]