summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-01 06:45:59 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-11-01 06:45:59 +0000
commit369cf45ace663f42960cea72f87e669ea81979cd (patch)
tree45cd7a205266435dae8e3e7afb455cf98601be9d
parentf8dbe2657cb4ed768815c5cf699ecb922e796934 (diff)
* Patch from James Westby to support podcasting, photoblogging, vidcasting,
or what have you, by creating enclosures for non-page items that are included in feeds.
-rw-r--r--IkiWiki/Plugin/inline.pm36
-rw-r--r--basewiki/blog.mdwn4
-rw-r--r--debian/changelog5
-rw-r--r--debian/control2
-rw-r--r--doc/features.mdwn4
-rw-r--r--doc/install.mdwn2
-rw-r--r--doc/todo/blogging.mdwn6
-rw-r--r--templates/atomitem.tmpl4
-rw-r--r--templates/rssitem.tmpl4
9 files changed, 58 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index bd0742d36..caef98ef2 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -105,7 +105,9 @@ sub preprocess_inline (@) { #{{{
) unless $raw;
foreach my $page (@list) {
- if (! $raw) {
+ my $file = $pagesources{$page};
+ my $type = pagetype($file);
+ if (! $raw || ($raw && ! defined $type)) {
# Get the content before populating the template,
# since getting the content uses the same template
# if inlines are nested.
@@ -116,7 +118,8 @@ sub preprocess_inline (@) { #{{{
my $content=get_inline_content($page, $params{destpage});
# Don't use htmllink because this way the title is separate
# and can be overridden by other plugins.
- my $link=htmlpage(bestlink($params{page}, $page));
+ my $link=bestlink($params{page}, $page);
+ $link=htmlpage($link) if defined $type;
$link=abs2rel($link, dirname($params{destpage}));
$template->param(pageurl => $link);
$template->param(title => pagetitle(basename($page)));
@@ -145,8 +148,6 @@ sub preprocess_inline (@) { #{{{
$template->clear_params;
}
else {
- my $file=$pagesources{$page};
- my $type=pagetype($file);
if (defined $type) {
$ret.="\n".
linkify($page, $params{page},
@@ -269,8 +270,33 @@ sub genfeed ($$$$@) { #{{{
permalink => $u,
date_822 => date_822($pagectime{$p}),
date_3339 => date_3339($pagectime{$p}),
- content => absolute_urls(get_inline_content($p, $page), $url),
);
+
+ my $pcontent = absolute_urls(get_inline_content($p, $page), $url);
+ if ($itemtemplate->query(name => "enclosure")) {
+ my $file=$pagesources{$p};
+ my $type=pagetype($file);
+ if (defined $type) {
+ $itemtemplate->param(content => $pcontent);
+ }
+ else {
+ my ($a, $b, $c, $d, $e, $f, $g, $size) = stat(srcfile($file));
+ my $mime="unknown";
+ eval q{use File::MimeInfo};
+ if (! $@) {
+ $mime = mimetype($file);
+ }
+ $itemtemplate->param(
+ enclosure => $u,
+ type => $mime,
+ length => $size,
+ );
+ }
+ }
+ else {
+ $itemtemplate->param(content => $pcontent);
+ }
+
run_hooks(pagetemplate => sub {
shift->(page => $p, destpage => $page,
template => $itemtemplate);
diff --git a/basewiki/blog.mdwn b/basewiki/blog.mdwn
index b1c2b9b33..859fa6aaa 100644
--- a/basewiki/blog.mdwn
+++ b/basewiki/blog.mdwn
@@ -5,7 +5,9 @@ You can turn any page on this wiki into a weblog by inserting a
Any pages that match the specified [[PageSpec]] (in the example, any
[[SubPage]] of "blog") will be part of the blog, and the newest 10
-of them will appear in the page.
+of them will appear in the page. Note that if files that are not pages
+match the [[PageSpec]], they will be included in the feed using RSS
+enclosures, which is useful for podcasting.
The optional `rootpage` parameter tells the wiki that new posts to this blog
should default to being [[SubPage]]s of "blog", and enables a form at the
diff --git a/debian/changelog b/debian/changelog
index fbe12edd3..86d639327 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,8 +30,11 @@ ikiwiki (1.32) UNRELEASED; urgency=low
* Remove duplicate link info when saving index. In some cases it could
pile up rather badly. (Probably not the best way to deal with this
problem.)
+ * Patch from James Westby to support podcasting, photoblogging, vidcasting,
+ or what have you, by creating enclosures for non-page items that are
+ included in feeds.
- -- Joey Hess <joeyh@debian.org> Wed, 1 Nov 2006 00:00:10 -0500
+ -- Joey Hess <joeyh@debian.org> Wed, 1 Nov 2006 01:11:10 -0500
ikiwiki (1.31) unstable; urgency=low
diff --git a/debian/control b/debian/control
index b4f08fc95..074a2922e 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Package: ikiwiki
Architecture: all
Depends: ${perl:Depends}, libxml-simple-perl, markdown, libtimedate-perl, libhtml-template-perl, libhtml-scrubber-perl, libcgi-formbuilder-perl (>= 3.02.02), libtime-duration-perl, libcgi-session-perl (>= 4.14-1), libmail-sendmail-perl, gcc | c-compiler, libc6-dev | libc-dev, libhtml-parser-perl, liburi-perl
Recommends: subversion | git-core | tla | mercurial, hyperestraier
-Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl, python-docutils, polygen, tidy, libxml-feed-perl, libmailtools-perl, perlmagick
+Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl, python-docutils, polygen, tidy, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl
Description: a wiki compiler
ikiwiki converts a directory full of wiki pages into html pages suitable
for publishing on a website. Unlike many wikis, ikiwiki does not have its
diff --git a/doc/features.mdwn b/doc/features.mdwn
index 092da603d..cb118f27d 100644
--- a/doc/features.mdwn
+++ b/doc/features.mdwn
@@ -60,6 +60,10 @@ Ikiwiki can also [[plugins/aggregate]] external blogs, feeding them into
the wiki. This can be used to create a Planet type site that aggregates
interesting feeds.
+You can also mix blogging with podcasting by dropping audio files where
+they will be picked up like blog posts. This will work for any files that
+you would care to syndicate.
+
## Valid html and [[css]]
ikiwiki aims to produce
diff --git a/doc/install.mdwn b/doc/install.mdwn
index bc1067737..22f1a3a39 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -10,7 +10,7 @@ modules be installed, and also uses the following perl modules if
available:
`CGI::Session` `CGI::FormBuilder` (version 3.02.02 or newer)
`HTML::Template` `Mail::Sendmail` `Time::Duration` `Date::Parse`,
-`HTML::Scrubber`, `RPC::XML`, `XML::Simple`, `XML::Feed`.
+`HTML::Scrubber`, `RPC::XML`, `XML::Simple`, `XML::Feed`, `File::MimeInfo`.
The [[tla]] support also needs the `MailTools` perl module.
diff --git a/doc/todo/blogging.mdwn b/doc/todo/blogging.mdwn
index f9037b063..a31674809 100644
--- a/doc/todo/blogging.mdwn
+++ b/doc/todo/blogging.mdwn
@@ -129,3 +129,9 @@ that you have for the links at the top.
> Thanks! I did tweak the css a bit. Not totally happy with it, but pretty
> good I think. (I'll try to get to the other patches soon.) --[[Joey]]
+
+
+---
+
+I'm very happy to report that this is [[todo/done]]. Podcasting patch
+applied (finally!) --[[Joey]]
diff --git a/templates/atomitem.tmpl b/templates/atomitem.tmpl
index e0f7bb4f9..005519296 100644
--- a/templates/atomitem.tmpl
+++ b/templates/atomitem.tmpl
@@ -12,9 +12,13 @@
</TMPL_LOOP>
</TMPL_IF>
<updated><TMPL_VAR DATE_3339></updated>
+ <TMPL_IF NAME="ENCLOSURE">
+ <link rel="enclosure" type="<TMPL_VAR TYPE>" href="<TMPL_VAR ENCLOSURE>" length="<TMPL_VAR LENGTH>" />
+ <TMPL_ELSE>
<content type="xhtml" xml:lang="en">
<div xmlns="http://www.w3.org/1999/xhtml">
![CDATA[<TMPL_VAR CONTENT>]]
</div>
</content>
+ </TMPL_IF>
</entry>
diff --git a/templates/rssitem.tmpl b/templates/rssitem.tmpl
index bfd38ec31..0fab42e71 100644
--- a/templates/rssitem.tmpl
+++ b/templates/rssitem.tmpl
@@ -13,5 +13,9 @@
</TMPL_LOOP>
</TMPL_IF>
<pubDate><TMPL_VAR DATE_822></pubDate>
+ <TMPL_IF NAME="ENCLOSURE">
+ <enclosure url="<TMPL_VAR ENCLOSURE>" type="<TMPL_VAR TYPE>" length="<TMPL_VAR LENGTH>" />
+ <TMPL_ELSE>
<description><![CDATA[<TMPL_VAR CONTENT>]]></description>
+ </TMPL_IF>
</item>