meta plugin: if uuid looks like it is in fact a UUID, prepend "urn:uuid" (otherwise...
authorSimon McVittie <http://smcv.pseudorandom.co.uk/>
Fri, 11 Jul 2008 22:57:47 +0000 (23:57 +0100)
committerSimon McVittie <http://smcv.pseudorandom.co.uk/>
Fri, 11 Jul 2008 22:57:47 +0000 (23:57 +0100)
IkiWiki/Plugin/meta.pm

index 81355ef6d7a73d657be87eae768e0bfa206a77ba..02c99e9f67db1e62327d7a8108f6c570f5e17fb5 100644 (file)
@@ -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') {