X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/18b0f2737b3f1478deff6e9c48217c6f22a576ea..4a108fa36b4c6a7d8436c37be55ed35675211997:/IkiWiki/Plugin/meta.pm diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 421f1dc86..f5b9bb521 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -121,6 +121,17 @@ sub preprocess (@) { add_link($page, $value); return ""; } + elsif ($key eq 'enclosure') { + my $link=bestlink($page, $value); + if (! length $link) { + error gettext("enclosure not found") + } + add_depends($page, $link, deptype("presence")); + + $value=urlto($link, $page, 1); + $pagestate{$page}{meta}{enclosure}=$value; + # fallthrough + } elsif ($key eq 'author') { $pagestate{$page}{meta}{author}=$value; if (exists $params{sortas}) { @@ -318,6 +329,10 @@ sub pagetemplate (@) { $template->param(title_overridden => 1); } + if (exists $pagestate{$page}{meta}{enclosure}) { + $template->param(enclosure => HTML::Entities::encode_entities(IkiWiki::urlabs($pagestate{$page}{meta}{enclosure}, $config{url}))); + } + foreach my $field (qw{authorurl}) { eval q{use HTML::Entities}; $template->param($field => HTML::Entities::encode_entities($pagestate{$page}{meta}{$field}))