]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
* Patch from James Westby to support podcasting, photoblogging, vidcasting,
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 1 Nov 2006 06:45:59 +0000 (06:45 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 1 Nov 2006 06:45:59 +0000 (06:45 +0000)
  or what have you, by creating enclosures for non-page items that are
  included in feeds.

IkiWiki/Plugin/inline.pm
basewiki/blog.mdwn
debian/changelog
debian/control
doc/features.mdwn
doc/install.mdwn
doc/todo/blogging.mdwn
templates/atomitem.tmpl
templates/rssitem.tmpl

index bd0742d36a0e66067d652b00f09c53c801617175..caef98ef2fc32fdd2c39c16b9f6a084af7dcfcbc 100644 (file)
@@ -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);
index b1c2b9b338e70856811efb604f0bd44ea9391ae3..859fa6aaa6e06238b58b08befa73c152de7d7e0c 100644 (file)
@@ -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
index fbe12edd399cb19232bc098deb466e1a7cbe1980..86d63932738b45344d2310d8ec5415133b151262 100644 (file)
@@ -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
 
index b4f08fc95c533f5975c4dd57a2e353aaed7bd688..074a2922e107c264471d64952e650253726c57a8 100644 (file)
@@ -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
index 092da603dc2ae541999889d5074dc8bf17146808..cb118f27d4eee5c1a8d050a432974dd034f5b8f9 100644 (file)
@@ -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 
index bc10677376e00551b4e277adfc47dd0a8da578d8..22f1a3a39b4e6efe47045eb3a12a4d546ac3848f 100644 (file)
@@ -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.
 
index f9037b06370232e27e768581ef772060486646b1..a316748092beb14e3c65d802c7e667a091dbca19 100644 (file)
@@ -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]]
index e0f7bb4f9bddd613f8468934cdb14de195e90f47..00551929615bd5c366df0fd567b5e1f06c2f04b5 100644 (file)
        </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>
index bfd38ec3154fb53ccb87126c6a334082b4ee7086..0fab42e710ba3689668fbc4f49e2fcbe192195c0 100644 (file)
@@ -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>