aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/inline.pm
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-02-20 21:16:19 -0500
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-02-20 21:16:19 -0500
commitd77ee60b1506302ca6e2a5bd2023c380334167c0 (patch)
tree2e52a21303a4449826da703ac0032faeaf50a243 /IkiWiki/Plugin/inline.pm
parenta629b276b27bb900ec9e544820cd42aa140e8bdc (diff)
downloadikiwiki-d77ee60b1506302ca6e2a5bd2023c380334167c0.tar
ikiwiki-d77ee60b1506302ca6e2a5bd2023c380334167c0.tar.gz
Render fancy podcast enclosures.
Simple podcast feeds didn't have content tags and I made sure to keep it that way. This may be unnecessarily conservative. Changing the behavior to include empty content tags might be fine, but I don't want to think about it right now, I just want my tests to keep passing! The new fancy-podcast tests are copy-pasted-edited from the simple-podcast tests. These tests shall be refactored.
Diffstat (limited to 'IkiWiki/Plugin/inline.pm')
-rw-r--r--IkiWiki/Plugin/inline.pm21
1 files changed, 16 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 20cb8a27c..9b4cee4e4 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -647,6 +647,7 @@ sub genfeed ($$$$$@) {
foreach my $p (@pages) {
my $u=URI->new(encode_utf8(urlto($p, "", 1)));
my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
+ my $fancy_enclosure_seen = 0;
$itemtemplate->param(
title => pagetitle(basename($p)),
@@ -668,17 +669,27 @@ sub genfeed ($$$$$@) {
$itemtemplate->param(mdate_822 => date_822($pagestate{$p}{meta}{updated}));
$itemtemplate->param(mdate_3339 => date_3339($pagestate{$p}{meta}{updated}));
}
+
+ if (exists $pagestate{$p}{meta}{enclosure}) {
+ my $absurl = $pagestate{$p}{meta}{enclosure};
+
+ # XXX better way to compute relative to srcdir?
+ my $file = $absurl;
+ $file =~ s|^$config{url}/||;
+
+ genenclosure($itemtemplate, $absurl, $file);
+ $fancy_enclosure_seen = 1;
+ }
}
my $file=$pagesources{$p};
- my $type=pagetype($file);
- if (defined $type) {
- $itemtemplate->param(content => $pcontent);
- }
- else {
+ unless ($fancy_enclosure_seen || defined(pagetype($file))) {
genenclosure($itemtemplate, $u, $file);
+ $itemtemplate->param(simplepodcast => 1);
}
+ $itemtemplate->param(content => $pcontent);
+
run_hooks(pagetemplate => sub {
shift->(page => $p, destpage => $page,
template => $itemtemplate);