From b220a1100869bc930ed886062d95c464a0bc3689 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 06:55:33 +0000 Subject: [PATCH 01/16] stop abusing titlepage for internal encoding (esp since it doesn't work) --- IkiWiki/Plugin/aggregate.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index a07d45dec..41ca9cce0 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -107,6 +107,8 @@ sub delete (@) { #{{{ } #}}} sub loadstate () { #{{{ + eval q{use HTML::Entities}; + die $@ if $@; if (-e "$IkiWiki::config{wikistatedir}/aggregate") { open (IN, "$IkiWiki::config{wikistatedir}/aggregate" || die "$IkiWiki::config{wikistatedir}/aggregate: $!"); @@ -118,7 +120,7 @@ sub loadstate () { #{{{ my ($field, $val)=split(/=/, $i, 2); if ($field eq "name" || $field eq "feed" || $field eq "guid" || $field eq "message") { - $data->{$field}=IkiWiki::pagetitle($val); + $data->{$field}=decode_entities($val, " \t\n"); } elsif ($field eq "tag") { push @{$data->{tags}}, $val; @@ -141,6 +143,8 @@ sub loadstate () { #{{{ } #}}} sub savestate () { #{{{ + eval q{use HTML::Entities}; + die $@ if $@; open (OUT, ">$IkiWiki::config{wikistatedir}/aggregate" || die "$IkiWiki::config{wikistatedir}/aggregate: $!"); foreach my $data (values %feeds, values %guids) { @@ -162,7 +166,7 @@ sub savestate () { #{{{ foreach my $field (keys %$data) { if ($field eq "name" || $field eq "feed" || $field eq "guid" || $field eq "message") { - push @line, "$field=".IkiWiki::titlepage($data->{$field}); + push @line, "$field=".encode_entities($data->{$field}, " \t\n"); } elsif ($field eq "tags") { push @line, "tag=$_" foreach @{$data->{tags}}; -- 2.39.5 From 33aab4802edd9af83a636d712a3dc4aca281a5a4 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 06:57:42 +0000 Subject: [PATCH 02/16] erase old tags --- IkiWiki/Plugin/aggregate.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 41ca9cce0..05ec48ee3 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -83,6 +83,7 @@ sub preprocess (@) { #{{{ $feed->{numposts}=0 unless defined $feed->{numposts}; $feed->{newposts}=0 unless defined $feed->{newposts}; $feed->{message}="new feed" unless defined $feed->{message}; + $feed->{tags}=[]; while (@_) { my $key=shift; my $value=shift; -- 2.39.5 From 22adebe8adf9ddf2a064c54b9c1e4c0e8799907b Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 07:07:20 +0000 Subject: [PATCH 03/16] need to lower-case pages, sigh.. --- IkiWiki/Plugin/aggregate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 05ec48ee3..d59f84450 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -310,7 +310,7 @@ sub remove_feeds () { #{{{ } #}}} sub pagefile ($) { #{{{ - my $page=shift; + my $page=lc(shift); return "$IkiWiki::config{srcdir}/$page.html"; } #}}} -- 2.39.5 From 9ae54f904af35f0c499180f27cab00d24093e62b Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 07:17:44 +0000 Subject: [PATCH 04/16] fix --- IkiWiki/Plugin/aggregate.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index d59f84450..c42884851 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -253,6 +253,7 @@ sub add_page (@) { #{{{ # assign it an unused page my $page=$feed->{dir}."/".IkiWiki::titlepage($params{title}); + $page=lc($page); ($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/; if (! defined $page || ! length $page) { $page=$feed->{dir}."/item"; @@ -310,7 +311,7 @@ sub remove_feeds () { #{{{ } #}}} sub pagefile ($) { #{{{ - my $page=lc(shift); + my $page=shift; return "$IkiWiki::config{srcdir}/$page.html"; } #}}} -- 2.39.5 From 7e35ad2cd91a1abc20b7baff30d8c9e713e9d1e9 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 07:30:08 +0000 Subject: [PATCH 05/16] when autogenerating a dir naem, include "feed/" in it --- IkiWiki/Plugin/aggregate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index c42884851..ba33a80aa 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -70,7 +70,7 @@ sub preprocess (@) { #{{{ $feed->{name}=$name; $feed->{sourcepage}=$params{page}; $feed->{url}=$params{url}; - my $dir=exists $params{dir} ? $params{dir} : IkiWiki::titlepage($params{name}); + my $dir=exists $params{dir} ? $params{dir} : "feed/".IkiWiki::titlepage($params{name}); $dir=~s/^\/+//; ($dir)=$dir=~/$IkiWiki::config{wiki_file_regexp}/; $feed->{dir}=$dir; -- 2.39.5 From 0f45548333c19d33d885b4417fa85285d74f87cf Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 07:41:26 +0000 Subject: [PATCH 06/16] allow hooks to add options even to --setup --- IkiWiki.pm | 6 ++++++ ikiwiki | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index b5707195b..2face7082 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -104,6 +104,12 @@ sub loadplugins () { #{{{ error("Failed to load plugin $mod: $@"); } } + run_hooks(getopt => sub { shift->() }); + if (grep /^-/, @ARGV) { + print STDERR "Unknown option: $_\n" + foreach grep /^-/, @ARGV; + usage(); + } } #}}} sub error ($) { #{{{ diff --git a/ikiwiki b/ikiwiki index 6518b8626..58f6af4ba 100755 --- a/ikiwiki +++ b/ikiwiki @@ -69,12 +69,6 @@ sub getconfig () { #{{{ if (! $config{setup}) { loadplugins(); - run_hooks(getopt => sub { shift->() }); - if (grep /^-/, @ARGV) { - print STDERR "Unknown option: $_\n" - foreach grep /^-/, @ARGV; - usage(); - } usage() unless @ARGV == 2; $config{srcdir} = possibly_foolish_untaint(shift @ARGV); $config{destdir} = possibly_foolish_untaint(shift @ARGV); -- 2.39.5 From 61ac8f2f513d939f7dc03c6669ecb94f3fb0eeea Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 07:59:04 +0000 Subject: [PATCH 07/16] improce --- doc/todo/aggregation.mdwn | 4 ++++ templates/aggregatepost.tmpl | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/todo/aggregation.mdwn b/doc/todo/aggregation.mdwn index 53b3133e2..63ee8f13b 100644 --- a/doc/todo/aggregation.mdwn +++ b/doc/todo/aggregation.mdwn @@ -1 +1,5 @@ * Still need to support feed expiry. +* Need to store page author metadata and include it in the rss feed. +* Should store the real page title (capitalised) as metadats. + Only problem is titles that contain quotes need to be escaped somehow, + and I'll need to add support for that first. diff --git a/templates/aggregatepost.tmpl b/templates/aggregatepost.tmpl index ef7a5f1ae..aa8bc27e4 100644 --- a/templates/aggregatepost.tmpl +++ b/templates/aggregatepost.tmpl @@ -1,5 +1,4 @@ -

From -- 2.39.5 From ff3ae9fbb54d0379ffb239cc745c11ebb3e1514f Mon Sep 17 00:00:00 2001 From: www-data Date: Sun, 30 Jul 2006 14:46:48 +0000 Subject: [PATCH 08/16] web commit by JonasSmedegaard: Corrected typo: imge -> image. --- doc/smileys.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/smileys.mdwn b/doc/smileys.mdwn index 6a09c1bdb..8d794cb5d 100644 --- a/doc/smileys.mdwn +++ b/doc/smileys.mdwn @@ -38,6 +38,6 @@ Note that the format is important; each list item should start with the text that is turned into the smiley, escaped so that users can see what produces it, followed by a [[WikiLink]] to the image to display. -/!\ Bear in mind that the link to the imge needs to be written in a way that +/!\ Bear in mind that the link to the image needs to be written in a way that will work if it's copied to other pages on the wiki. So be sure to include the smileys directory in the path to the file. -- 2.39.5 From 73e6f81ef3d5dfcfeea5272501a58e1e931c5b15 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 21:51:37 +0000 Subject: [PATCH 09/16] escape slashes in page names --- IkiWiki/Plugin/aggregate.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index ba33a80aa..9c28651f0 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -252,7 +252,9 @@ sub add_page (@) { #{{{ $feed->{newposts}++; # assign it an unused page - my $page=$feed->{dir}."/".IkiWiki::titlepage($params{title}); + my $page=IkiWiki::titlepage($params{title}); + $page=~s!([/])!"__".ord($1)."__"!eg; # escape slashes in title + $page=$feed->{dir}."/".$page; $page=lc($page); ($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/; if (! defined $page || ! length $page) { -- 2.39.5 From 26c2c63c97e6bfa704357503fdfd8d8834838851 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 21:54:03 +0000 Subject: [PATCH 10/16] add test for nonexistant polygen --- IkiWiki/Plugin/polygen.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm index c14889167..2ed81c8e4 100644 --- a/IkiWiki/Plugin/polygen.pm +++ b/IkiWiki/Plugin/polygen.pm @@ -27,6 +27,9 @@ sub preprocess (@) { #{{{ $symbol =~ s/[^A-Za-z0-9]//g if defined $symbol; my $grmfile = '/usr/share/polygen/ita/polygen.grm'; + if (! -d '/usr/share/polygen') { + return "[[polygen not installed]]"; + } find({wanted => sub { if (substr($File::Find::name, -length($grammar)) eq $grammar) { $grmfile = IkiWiki::possibly_foolish_untaint($File::Find::name); -- 2.39.5 From 88830016154d99a0155e1cee58582e9f32dcca51 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 22:58:48 +0000 Subject: [PATCH 11/16] * Change meta tags to use html entity-escaped text for values, so that quotes and such can be represented in title tags. * Depend and build-depend on HTML::Parser for HTML::Entities which is used for the above. * Make --rebuild also cause --aggregate to re-download and write aggregated pages. * Avoid outputting duplicate meta info. * Include title metadata on aggregated posts for capitalised and un-munged titles. --- IkiWiki/Plugin/aggregate.pm | 7 +++++-- IkiWiki/Plugin/meta.pm | 26 +++++++++++++++++++------- debian/changelog | 13 +++++++++++-- debian/control | 6 +++--- doc/plugins/aggregate.mdwn | 2 +- doc/plugins/meta.mdwn | 3 +++ doc/usage.mdwn | 4 ++++ templates/aggregatepost.tmpl | 3 +++ 8 files changed, 49 insertions(+), 15 deletions(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 9c28651f0..98e534366 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -188,7 +188,8 @@ sub aggregate () { #{{{ die $@ if $@; foreach my $feed (values %feeds) { - next unless time - $feed->{lastupdate} >= $feed->{updateinterval}; + next unless $IkiWiki::config{rebuild} || + time - $feed->{lastupdate} >= $feed->{updateinterval}; $feed->{lastupdate}=time; $feed->{newposts}=0; $IkiWiki::forcerebuild{$feed->{sourcepage}}=1; @@ -277,7 +278,7 @@ sub add_page (@) { #{{{ eval q{use Digest::MD5 'md5_hex'}; require Encode; my $digest=md5_hex(Encode::encode_utf8($params{content})); - return unless ! exists $guid->{md5} || $guid->{md5} ne $digest; + return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $IkiWiki::config{rebuild}; $guid->{md5}=$digest; # Create the page. @@ -285,6 +286,8 @@ sub add_page (@) { #{{{ my $content=$params{content}; $params{content}=~s/(?param(title => $params{title}) + if defined $params{title} && length($params{title}); $template->param(content => $params{content}); $template->param(url => $feed->{url}); $template->param(name => $feed->{name}); diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 15a8bad84..bac163469 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -12,10 +12,20 @@ my %title; sub import { #{{{ IkiWiki::hook(type => "preprocess", id => "meta", call => \&preprocess); + IkiWiki::hook(type => "filter", id => "meta", + call => \&filter); IkiWiki::hook(type => "pagetemplate", id => "meta", call => \&pagetemplate); } # }}} +sub filter (@) { #{{{ + my %params=@_; + + $meta{$params{page}}=''; + + return $params{content}; +} # }}} + sub preprocess (@) { #{{{ if (! @_) { return ""; @@ -28,13 +38,15 @@ sub preprocess (@) { #{{{ delete $params{page}; delete $params{destpage}; - eval q{use CGI 'escapeHTML'}; + eval q{use HTML::Entities}; + # Always dencode, even if encoding later, since it might not be + # fully encoded. + $value=decode_entities($value); if ($key eq 'link') { if (%params) { - $meta{$page}='' unless exists $meta{$page}; - $meta{$page}.="\n"; } else { @@ -43,11 +55,11 @@ sub preprocess (@) { #{{{ } } elsif ($key eq 'title') { - $title{$page}=escapeHTML($value); + $title{$page}=$value; } else { - $meta{$page}='' unless exists $meta{$page}; - $meta{$page}.="\n"; + $meta{$page}.="\n"; } return ""; diff --git a/debian/changelog b/debian/changelog index 6f33a3236..26b427333 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,17 @@ ikiwiki (1.13) UNRELEASED; urgency=low --wrappers to do that. * Add %IkiWiki::forcerebuild to provide a way for plugins like aggregate to update pages that haven't changed on disk. - - -- Joey Hess Sat, 29 Jul 2006 20:10:51 -0400 + * Change meta tags to use html entity-escaped text for values, so that + quotes and such can be represented in title tags. + * Depend and build-depend on HTML::Parser for HTML::Entities which is used + for the above. + * Make --rebuild also cause --aggregate to re-download and write aggregated + pages. + * Avoid outputting duplicate meta info. + * Include title metadata on aggregated posts for capitalised and un-munged + titles. + + -- Joey Hess Sun, 30 Jul 2006 18:17:28 -0400 ikiwiki (1.12) unstable; urgency=low diff --git a/debian/control b/debian/control index a556fa2ed..e03455652 100644 --- a/debian/control +++ b/debian/control @@ -2,15 +2,15 @@ Source: ikiwiki Section: web Priority: optional Build-Depends: perl, debhelper (>= 5) -Build-Depends-Indep: dpkg-dev (>= 1.9.0), markdown, libhtml-template-perl, libhtml-scrubber-perl, wdg-html-validator, libtext-wikiformat-perl +Build-Depends-Indep: dpkg-dev (>= 1.9.0), markdown, libhtml-template-perl, libhtml-scrubber-perl, wdg-html-validator, libtext-wikiformat-perl, libhtml-parser-perl Maintainer: Joey Hess Standards-Version: 3.7.2 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, libmail-sendmail-perl, gcc | c-compiler, libc6-dev | libc-dev +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, libmail-sendmail-perl, gcc | c-compiler, libc6-dev | libc-dev, libhtml-parser-perl Recommends: subversion | git-core, hyperestraier -Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl, polygen, tidy, libxml-feed-perl, libhtml-parser-perl +Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl, polygen, tidy, libxml-feed-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/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn index 85152170f..4cd5b57ac 100644 --- a/doc/plugins/aggregate.mdwn +++ b/doc/plugins/aggregate.mdwn @@ -13,7 +13,7 @@ aggregated feeds. ## setup Make sure that you have the [[html]] plugin enabled, as the created pages are -in html format. The [[tag]] plugin is also recommended. +in html format. The [[meta]] and [[tag]] plugins are also recommended. You will need to run ikiwiki periodically from a cron job, passing it the --aggregate parameter, to make it check for new posts. Here's an example diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn index 238233e11..32392ed54 100644 --- a/doc/plugins/meta.mdwn +++ b/doc/plugins/meta.mdwn @@ -40,6 +40,9 @@ If the field is not treated specially (as the link and title fields are), the metadata will be written to the generated html page as a <meta> header. +The field value is treated as HTML entity-escaped text, so you can include +a quote in the text by writing `"` and so on. + This plugin is included in ikiwiki, but it is not enabled by default. If it is enabled, the title of this page will say it is. [[meta title="meta plugin (enabled)"]] diff --git a/doc/usage.mdwn b/doc/usage.mdwn index a6ded5ec2..aab5330b6 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -71,6 +71,10 @@ These options control the mode that ikiwiki is operating in. If the aggregate plugin is enabled, this makes ikiwiki poll configured feeds and save new posts to the srcdir. + Note that to rebuild previously aggregated posts, use the --rebuild option + along with this one. --rebuild will also force feeds to be polled even if + they were polled recently. + # CONFIG OPTIONS These options configure the wiki. Note that plugins can add additional diff --git a/templates/aggregatepost.tmpl b/templates/aggregatepost.tmpl index aa8bc27e4..689a23341 100644 --- a/templates/aggregatepost.tmpl +++ b/templates/aggregatepost.tmpl @@ -10,3 +10,6 @@ From [[tag ]] + +[[meta title=""]] + -- 2.39.5 From ecd74fbe5d3ace51a57b0f6f756538aba8123727 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 23:08:10 +0000 Subject: [PATCH 12/16] avoid message if mailing password or registering --- IkiWiki/CGI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 5e54c5674..fc5dfc2ef 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -114,7 +114,7 @@ sub cgi_signin ($$) { #{{{ $form->field(name => "password", type => "password", required => 0); $form->field(name => "confirm_password", type => "password", required => 0); $form->field(name => "email", required => 0); - if ($q->param("do") ne "signin") { + if ($q->param("do") ne "signin" && !$form->submitted) { $form->text("You need to log in first."); } -- 2.39.5 From 908e004b4c5a1970246afd055a34dea4ea146b3e Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 30 Jul 2006 23:51:48 +0000 Subject: [PATCH 13/16] * Title metadata of inlined pages now shows up in blogs, although not yet in their rss feeds. --- IkiWiki/Plugin/inline.pm | 8 +++++++- debian/changelog | 4 +++- doc/bugs/meta_inline.mdwn | 2 ++ doc/todo/aggregation.mdwn | 3 --- templates/inlinepage.tmpl | 2 +- templates/inlinepagetitle.tmpl | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 7bb71a436..b06470bfe 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -83,7 +83,12 @@ sub preprocess_inline (@) { #{{{ ); foreach my $page (@list) { - $template->param(pagelink => htmllink($params{page}, $params{page}, $page)); + # 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)); + $link=abs2rel($link, dirname($params{page})); + $template->param(pageurl => $link); + $template->param(title => $page); $template->param(content => get_inline_content($page, $params{page})) if $params{archive} eq "no"; $template->param(ctime => displaytime($pagectime{$page})); @@ -172,6 +177,7 @@ sub genrss ($@) { #{{{ $template->param( title => $config{wikiname}, + wikiname => $config{wikiname}, pageurl => $url, items => \@items, ); diff --git a/debian/changelog b/debian/changelog index 26b427333..a0989cb74 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,8 +20,10 @@ ikiwiki (1.13) UNRELEASED; urgency=low * Avoid outputting duplicate meta info. * Include title metadata on aggregated posts for capitalised and un-munged titles. + * Title metadata of inlined pages now shows up in blogs, although not yet + in their rss feeds. - -- Joey Hess Sun, 30 Jul 2006 18:17:28 -0400 + -- Joey Hess Sun, 30 Jul 2006 19:22:11 -0400 ikiwiki (1.12) unstable; urgency=low diff --git a/doc/bugs/meta_inline.mdwn b/doc/bugs/meta_inline.mdwn index cd3d5ec2b..9ca32a0e8 100644 --- a/doc/bugs/meta_inline.mdwn +++ b/doc/bugs/meta_inline.mdwn @@ -1,2 +1,4 @@ The meta plugin doesn't affect a page if it's being inlined. Probably setting the title with it should override the title of the blog post. + +[[bugs/done]] diff --git a/doc/todo/aggregation.mdwn b/doc/todo/aggregation.mdwn index 63ee8f13b..65c4208d6 100644 --- a/doc/todo/aggregation.mdwn +++ b/doc/todo/aggregation.mdwn @@ -1,5 +1,2 @@ * Still need to support feed expiry. * Need to store page author metadata and include it in the rss feed. -* Should store the real page title (capitalised) as metadats. - Only problem is titles that contain quotes need to be escaped somehow, - and I'll need to add support for that first. diff --git a/templates/inlinepage.tmpl b/templates/inlinepage.tmpl index 0f0c47767..c2ddff867 100644 --- a/templates/inlinepage.tmpl +++ b/templates/inlinepage.tmpl @@ -1,5 +1,5 @@

- + diff --git a/templates/inlinepagetitle.tmpl b/templates/inlinepagetitle.tmpl index 10469f81c..3aa6a2415 100644 --- a/templates/inlinepagetitle.tmpl +++ b/templates/inlinepagetitle.tmpl @@ -1,5 +1,5 @@

-
+
Posted -- 2.39.5 From e4ccc4f3b09aaaa4f64bdba1d6ffff24e924fd20 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 31 Jul 2006 00:34:18 +0000 Subject: [PATCH 14/16] fix title metadata on blogs, reorg needed to do it, simplified tag some --- IkiWiki/Plugin/inline.pm | 31 +++++++++++++++++++------------ IkiWiki/Plugin/tag.pm | 17 ++++------------- debian/changelog | 3 +-- doc/templates.mdwn | 1 + templates/rssitem.tmpl | 12 ++++++++++++ templates/rsspage.tmpl | 25 ++++++------------------- 6 files changed, 43 insertions(+), 46 deletions(-) create mode 100644 templates/rssitem.tmpl diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index b06470bfe..110410abc 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -88,7 +88,7 @@ sub preprocess_inline (@) { #{{{ my $link=htmlpage(bestlink($params{page}, $page)); $link=abs2rel($link, dirname($params{page})); $template->param(pageurl => $link); - $template->param(title => $page); + $template->param(title => pagetitle(basename($page))); $template->param(content => get_inline_content($page, $params{page})) if $params{archive} eq "no"; $template->param(ctime => displaytime($pagectime{$page})); @@ -161,25 +161,32 @@ sub genrss ($@) { #{{{ my $url="$config{url}/".htmlpage($page); - my $template=template("rsspage.tmpl", blind_cache => 1, + my $itemtemplate=template("rssitem.tmpl", blind_cache => 1, die_on_bad_params => 0); - - my @items; + my $content=""; foreach my $p (@pages) { - push @items, { - itemtitle => pagetitle(basename($p)), - itemurl => "$config{url}/$renderedfiles{$p}", - itempubdate => date_822($pagectime{$p}), - itemcontent => absolute_urls(get_inline_content($p, $page), $url), - page => $p, # used by category adding code in tag plugin - } if exists $renderedfiles{$p}; + next unless exists $renderedfiles{$p}; + + $itemtemplate->param( + title => pagetitle(basename($p)), + url => "$config{url}/$renderedfiles{$p}", + pubdate => date_822($pagectime{$p}), + content => absolute_urls(get_inline_content($p, $page), $url), + ); + run_hooks(pagetemplate => sub { + shift->(page => $p, destpage => $page, + template => $itemtemplate); + }); + $content.=$itemtemplate->output; + $itemtemplate->clear_params; } + my $template=template("rsspage.tmpl", blind_cache => 1); $template->param( title => $config{wikiname}, wikiname => $config{wikiname}, pageurl => $url, - items => \@items, + content => $content, ); run_hooks(pagetemplate => sub { diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 2aa70d406..3de09a767 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -65,19 +65,10 @@ sub pagetemplate (@) { #{{{ }, @{$tags{$page}} ]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "tags"); - if ($template->query(name => "items")) { - # It's an rss template. Modify each item in the feed, - # adding any categories based on the page for that item. - foreach my $item (@{$template->param("items")}) { - my $p=$item->{page}; - if (exists $tags{$p} && @{$tags{$p}}) { - $item->{categories}=[]; - foreach my $tag (@{$tags{$p}}) { - push @{$item->{categories}}, { - category => $tag, - }; - } - } + if ($template->query(name => "pubdate")) { + # It's an rss template. Add any categories. + if (exists $tags{$page} && @{$tags{$page}}) { + $template->param(categories => [map { category => $_ }, @{$tags{$page}}]); } } } # }}} diff --git a/debian/changelog b/debian/changelog index a0989cb74..b42371969 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,8 +20,7 @@ ikiwiki (1.13) UNRELEASED; urgency=low * Avoid outputting duplicate meta info. * Include title metadata on aggregated posts for capitalised and un-munged titles. - * Title metadata of inlined pages now shows up in blogs, although not yet - in their rss feeds. + * Title metadata of inlined pages now shows up in blogs and rss feeds. -- Joey Hess Sun, 30 Jul 2006 19:22:11 -0400 diff --git a/doc/templates.mdwn b/doc/templates.mdwn index e500638f4..55e6ec6c8 100644 --- a/doc/templates.mdwn +++ b/doc/templates.mdwn @@ -17,6 +17,7 @@ It ships with some basic templates which can be customised: * `passwordmail.tmpl` - Not a html template, this is used to generate the mail with the user's password in it. * `rsspage.tmpl` - Used for generating rss feeds for [[blog]]s. +* `rssitem.tmpl` - Used for generating individual items on rss feeds. * `inlinepage.tmpl` - Used for adding a page inline in a blog page. * `inlinepagetitle.tmpl` - Used for listing a page inline in a blog diff --git a/templates/rssitem.tmpl b/templates/rssitem.tmpl new file mode 100644 index 000000000..421600591 --- /dev/null +++ b/templates/rssitem.tmpl @@ -0,0 +1,12 @@ + + <TMPL_VAR TITLE ESCAPE=HTML> + + + + + + + + + ]]> + diff --git a/templates/rsspage.tmpl b/templates/rsspage.tmpl index 55b1222ac..e7676ebbd 100644 --- a/templates/rsspage.tmpl +++ b/templates/rsspage.tmpl @@ -1,22 +1,9 @@ - - <TMPL_VAR TITLE ESCAPE=HTML> - - - - - <TMPL_VAR ITEMTITLE ESCAPE=HTML> - - - - - - - - - ]]> - - - + +<TMPL_VAR TITLE ESCAPE=HTML> + + + + -- 2.39.5 From 953ffa1fe31ab97caf3b1bcc5840e62728620833 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 31 Jul 2006 00:59:54 +0000 Subject: [PATCH 15/16] fix --- IkiWiki/Plugin/aggregate.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 98e534366..14461059d 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -254,14 +254,15 @@ sub add_page (@) { #{{{ # assign it an unused page my $page=IkiWiki::titlepage($params{title}); - $page=~s!([/])!"__".ord($1)."__"!eg; # escape slashes in title + # escape slashes and periods in title so it doesn't specify + # directory name or trigger ".." disallowing code. + $page=~s!([/.])!"__".ord($1)."__"!eg; $page=$feed->{dir}."/".$page; $page=lc($page); ($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/; if (! defined $page || ! length $page) { $page=$feed->{dir}."/item"; } - $page=~s/\.\.//g; # avoid ".." directory tricks my $c=""; while (exists $IkiWiki::pagesources{$page.$c} || -e pagefile($page.$c)) { -- 2.39.5 From 2604c3217eba299c181868de418880c38e93a24d Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 31 Jul 2006 01:05:22 +0000 Subject: [PATCH 16/16] one more change; use the page that pulls in a feed as the anchor for the default directory --- IkiWiki/Plugin/aggregate.pm | 2 +- doc/todo/aggregation.mdwn | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 14461059d..7142e6106 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -70,7 +70,7 @@ sub preprocess (@) { #{{{ $feed->{name}=$name; $feed->{sourcepage}=$params{page}; $feed->{url}=$params{url}; - my $dir=exists $params{dir} ? $params{dir} : "feed/".IkiWiki::titlepage($params{name}); + my $dir=exists $params{dir} ? $params{dir} : $params{page}."/".IkiWiki::titlepage($params{name}); $dir=~s/^\/+//; ($dir)=$dir=~/$IkiWiki::config{wiki_file_regexp}/; $feed->{dir}=$dir; diff --git a/doc/todo/aggregation.mdwn b/doc/todo/aggregation.mdwn index 65c4208d6..d56e41e04 100644 --- a/doc/todo/aggregation.mdwn +++ b/doc/todo/aggregation.mdwn @@ -1,2 +1,5 @@ * Still need to support feed expiry. * Need to store page author metadata and include it in the rss feed. +* Some rss feeds contain relative links or relative urls to inline images, + which break when aggregated. Do I need to parse the html and make them + all absolute? -- 2.39.5