From 9b34b879e2825a1d8d0d930a01c35306891b823b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 11 Jul 2008 23:42:38 +0100 Subject: meta plugin: also collect [[!meta uuid="..."]] --- IkiWiki/Plugin/meta.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 671060fbf..81355ef6d 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -84,6 +84,10 @@ sub preprocess (@) { #{{{ $pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value); # fallthrough } + elsif ($key eq 'uuid') { + $pagestate{$page}{meta}{uuid}=HTML::Entities::encode_numeric($value); + # fallthrough + } elsif ($key eq 'license') { push @{$metaheaders{$page}}, ''; $pagestate{$page}{meta}{license}=$value; -- cgit v1.2.3 From e767f18867bbddb252bd53589676f29dfc75837e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 11 Jul 2008 23:44:12 +0100 Subject: inline plugin: if meta plugin is also enabled, and has collected a uuid for a page, then pass it into the rssitem/atomitem templates --- IkiWiki/Plugin/inline.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 8890e5ed0..9a63ea1c9 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -442,6 +442,13 @@ sub genfeed ($$$$@) { #{{{ mdate_3339 => date_3339($pagemtime{$p}), ); + if (exists $pagestate{$p} && + exists $pagestate{$p}{meta}{uuid}) { + my $atom_id = $pagestate{$p}{meta}{uuid}; + + $itemtemplate->param(uuid => $atom_id); + } + if ($itemtemplate->query(name => "enclosure")) { my $file=$pagesources{$p}; my $type=pagetype($file); -- cgit v1.2.3 From 9f479a83a78cc199d7e7854e4beecd5594e87629 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 11 Jul 2008 23:46:48 +0100 Subject: atomitem.tmpl: use UUID as if supplied --- templates/atomitem.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/atomitem.tmpl b/templates/atomitem.tmpl index 1b1d686dd..fdc629e39 100644 --- a/templates/atomitem.tmpl +++ b/templates/atomitem.tmpl @@ -1,6 +1,10 @@ <TMPL_VAR TITLE> - + + + + + -- cgit v1.2.3 From fc917fa3831bbea5305e50a8fde4457ff480ad64 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 11 Jul 2008 23:47:00 +0100 Subject: rssitem.tmpl: use UUID as if supplied --- templates/rssitem.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/rssitem.tmpl b/templates/rssitem.tmpl index f22e5e3fb..4e2020269 100644 --- a/templates/rssitem.tmpl +++ b/templates/rssitem.tmpl @@ -5,7 +5,11 @@ <TMPL_VAR TITLE> - + + + + + -- cgit v1.2.3 From 9c6444bf681ec48e3832282906d1d2cfad586cb5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 11 Jul 2008 23:57:47 +0100 Subject: meta plugin: if uuid looks like it is in fact a UUID, prepend "urn:uuid" (otherwise leave it alone, so we can assign non-UUID s to Atom items to avoid planet-flooding) --- IkiWiki/Plugin/meta.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 81355ef6d..02c99e9f6 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -85,7 +85,13 @@ sub preprocess (@) { #{{{ # fallthrough } elsif ($key eq 'uuid') { - $pagestate{$page}{meta}{uuid}=HTML::Entities::encode_numeric($value); + my $abs = $value; + + if ($abs =~ m/^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$/) { + $abs = lc "urn:uuid:$abs"; + } + + $pagestate{$page}{meta}{uuid}=HTML::Entities::encode_numeric($abs); # fallthrough } elsif ($key eq 'license') { -- cgit v1.2.3