* 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.
master
joey 2006-11-01 06:45:59 +00:00
parent f8dbe2657c
commit 369cf45ace
9 changed files with 58 additions and 9 deletions

View 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);

View 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

5
debian/changelog vendored
View 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

2
debian/control vendored
View 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

View 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

View 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.

View 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]]

View File

@ -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>

View 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>