]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/meta.pm
make revert hooks optional
[git.ikiwiki.info.git] / IkiWiki / Plugin / meta.pm
index 1590086141a7306f570799387a12017fcbaeb716..5cfa7283350885181b9e8e194e87a4448c235c10 100644 (file)
@@ -37,6 +37,7 @@ sub needsbuild (@) {
                        }
                }
        }
+       return $needsbuild;
 }
 
 sub scrub ($$) {
@@ -197,8 +198,12 @@ sub preprocess (@) {
                                '" rel="openid2.local_id" />' if $delegate ne 1;
                }
                if (exists $params{"xrds-location"} && safeurl($params{"xrds-location"})) {
-                       push @{$metaheaders{$page}}, '<meta http-equiv="X-XRDS-Location"'.
-                               'content="'.encode_entities($params{"xrds-location"}).'" />';
+                       # force url absolute
+                       eval q{use URI};
+                       error($@) if $@;
+                       my $url=URI->new_abs($params{"xrds-location"}, $config{url});
+                       push @{$metaheaders{$page}}, '<meta http-equiv="X-XRDS-Location" '.
+                               'content="'.encode_entities($url).'" />';
                }
        }
        elsif ($key eq 'redir') {
@@ -253,12 +258,20 @@ sub preprocess (@) {
                        ' content="'.encode_entities($value).'" />';
        }
        elsif ($key eq 'description') {
-               push @{$metaheaders{$page}}, '<meta name="'.encode_entities($key).
+               push @{$metaheaders{$page}}, '<meta name="'.
+                       encode_entities($key).
                        '" content="'.encode_entities($value).'" />';
        }
+       elsif ($key eq 'name') {
+               push @{$metaheaders{$page}}, scrub('<meta '.$key.'="'.
+                       encode_entities($value).
+                       join(' ', map { "$_=\"$params{$_}\"" } keys %params).
+                       ' />', $destpage);
+       }
        else {
-               push @{$metaheaders{$page}}, scrub('<meta name="'.encode_entities($key).
-                       '" content="'.encode_entities($value).'" />', $destpage);
+               push @{$metaheaders{$page}}, scrub('<meta name="'.
+                       encode_entities($key).'" content="'.
+                       encode_entities($value).'" />', $destpage);
        }
 
        return "";
@@ -376,6 +389,10 @@ sub match_copyright ($$;@) {
        IkiWiki::Plugin::meta::match("copyright", @_);
 }
 
+sub match_guid ($$;@) {
+       IkiWiki::Plugin::meta::match("guid", @_);
+}
+
 package IkiWiki::SortSpec;
 
 sub cmp_meta {