summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-12 10:43:22 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-12 10:43:22 -0400
commit0fe87efc348643e30405f2d50c8498c971b99af4 (patch)
tree022daf42e8750b7dd5e1eb7a3b4d7874530fed8d
parenta0f596b6ed4594011b07cf7af2d2d55aa78d8be1 (diff)
parent9c6444bf681ec48e3832282906d1d2cfad586cb5 (diff)
Merge commit 'smcv/force-uuids' into force-uuids
-rw-r--r--IkiWiki/Plugin/inline.pm7
-rw-r--r--IkiWiki/Plugin/meta.pm10
-rw-r--r--templates/atomitem.tmpl6
-rw-r--r--templates/rssitem.tmpl6
4 files changed, 27 insertions, 2 deletions
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);
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 671060fbf..02c99e9f6 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -84,6 +84,16 @@ sub preprocess (@) { #{{{
$pagestate{$page}{meta}{description}=HTML::Entities::encode_numeric($value);
# fallthrough
}
+ elsif ($key eq 'uuid') {
+ 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') {
push @{$metaheaders{$page}}, '<link rel="license" href="#page_license" />';
$pagestate{$page}{meta}{license}=$value;
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 @@
<entry>
<title><TMPL_VAR TITLE></title>
- <id><TMPL_VAR URL></id>
+ <TMPL_IF NAME="UUID">
+ <id><TMPL_VAR UUID></id>
+ <TMPL_ELSE>
+ <id><TMPL_VAR URL></id>
+ </TMPL_IF>
<link href="<TMPL_VAR PERMALINK>"/>
<TMPL_IF NAME="AUTHOR">
<author><name><TMPL_VAR AUTHOR ESCAPE=HTML></name></author>
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_ELSE>
<title><TMPL_VAR TITLE></title>
</TMPL_IF>
- <guid><TMPL_VAR URL></guid>
+ <TMPL_IF NAME="UUID">
+ <guid isPermaLink="no"><TMPL_VAR UUID></guid>
+ <TMPL_ELSE>
+ <guid><TMPL_VAR URL></guid>
+ </TMPL_IF>
<link><TMPL_VAR PERMALINK></link>
<TMPL_IF NAME="CATEGORIES">
<TMPL_LOOP NAME="CATEGORIES">