]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
* Change meta tags to use html entity-escaped text for values, so that
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 30 Jul 2006 22:58:48 +0000 (22:58 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 30 Jul 2006 22:58:48 +0000 (22:58 +0000)
  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
IkiWiki/Plugin/meta.pm
debian/changelog
debian/control
doc/plugins/aggregate.mdwn
doc/plugins/meta.mdwn
doc/usage.mdwn
templates/aggregatepost.tmpl

index 9c28651f03e06306e7d319fee2a448dc0b93731e..98e53436640f9303643c7d6427ede146b92bd266 100644 (file)
@@ -188,7 +188,8 @@ sub aggregate () { #{{{
        die $@ if $@;
 
        foreach my $feed (values %feeds) {
        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;
                $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}));
        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.
        $guid->{md5}=$digest;
 
        # Create the page.
@@ -285,6 +286,8 @@ sub add_page (@) { #{{{
        my $content=$params{content};
        $params{content}=~s/(?<!\\)\[\[/\\\[\[/g; # escape accidental wikilinks
                                                  # and preprocessor stuff
        my $content=$params{content};
        $params{content}=~s/(?<!\\)\[\[/\\\[\[/g; # escape accidental wikilinks
                                                  # and preprocessor stuff
+       $template->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});
        $template->param(content => $params{content});
        $template->param(url => $feed->{url});
        $template->param(name => $feed->{name});
index 15a8bad845f08e389bbc656ff518947ff175c6b9..bac16346932d2a00e1bc034d500a1fe8a08abebb 100644 (file)
@@ -12,10 +12,20 @@ my %title;
 sub import { #{{{
        IkiWiki::hook(type => "preprocess", id => "meta", 
                call => \&preprocess);
 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);
 } # }}}
 
        IkiWiki::hook(type => "pagetemplate", id => "meta", 
                call => \&pagetemplate);
 } # }}}
 
+sub filter (@) { #{{{
+       my %params=@_;
+       
+       $meta{$params{page}}='';
+
+       return $params{content};
+} # }}}
+
 sub preprocess (@) { #{{{
        if (! @_) {
                return "";
 sub preprocess (@) { #{{{
        if (! @_) {
                return "";
@@ -28,13 +38,15 @@ sub preprocess (@) { #{{{
        delete $params{page};
        delete $params{destpage};
 
        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) {
 
        if ($key eq 'link') {
                if (%params) {
-                       $meta{$page}='' unless exists $meta{$page};
-                       $meta{$page}.="<link href=\"".escapeHTML($value)."\" ".
-                               join(" ", map { escapeHTML("$_=\"$params{$_}\"") } keys %params).
+                       $meta{$page}.="<link href=\"".encode_entities($value)."\" ".
+                               join(" ", map { encode_entities($_)."=\"".encode_entities(decode_entities($params{$_}))."\"" } keys %params).
                                " />\n";
                }
                else {
                                " />\n";
                }
                else {
@@ -43,11 +55,11 @@ sub preprocess (@) { #{{{
                }
        }
        elsif ($key eq 'title') {
                }
        }
        elsif ($key eq 'title') {
-               $title{$page}=escapeHTML($value);
+               $title{$page}=$value;
        }
        else {
        }
        else {
-               $meta{$page}='' unless exists $meta{$page};
-               $meta{$page}.="<meta name=\"".escapeHTML($key)."\" content=\"".escapeHTML($value)."\" />\n";
+               $meta{$page}.="<meta name=\"".encode_entities($key).
+                       "\" content=\"".encode_entities($value)."\" />\n";
        }
 
        return "";
        }
 
        return "";
index 6f33a3236fa2509682e2ee56b22ae41aaca85fc4..26b427333e538b2dba7eb94289666286f1add432 100644 (file)
@@ -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.
     --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 <joeyh@debian.org>  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 <joeyh@debian.org>  Sun, 30 Jul 2006 18:17:28 -0400
 
 ikiwiki (1.12) unstable; urgency=low
 
 
 ikiwiki (1.12) unstable; urgency=low
 
index a556fa2ed284fde3326c50614d15c4fb8dbbb8c0..e03455652e3bd413eda520c380e4d96ea74bb354 100644 (file)
@@ -2,15 +2,15 @@ Source: ikiwiki
 Section: web
 Priority: optional
 Build-Depends: perl, debhelper (>= 5)
 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 <joeyh@debian.org>
 Standards-Version: 3.7.2
 
 Package: ikiwiki
 Architecture: all
 Maintainer: Joey Hess <joeyh@debian.org>
 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
 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
 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 85152170f43d1effa4f888baf5600ad8606155e0..4cd5b57acc4316f31a115e4a841b1ad66cf6ac2c 100644 (file)
@@ -13,7 +13,7 @@ aggregated feeds.
 ## setup
 
 Make sure that you have the [[html]] plugin enabled, as the created pages are
 ## 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
 
 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
index 238233e11db60ffc10f4391d14ec1ee5e464971c..32392ed546b3f67d1016751139b1d47d464cd4ff 100644 (file)
@@ -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 &lt;meta&gt;
 header.
 
 the metadata will be written to the generated html page as a &lt;meta&gt;
 header.
 
+The field value is treated as HTML entity-escaped text, so you can include
+a quote in the text by writing `&quot;` 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)"]]
 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)"]]
index a6ded5ec2186790c6f0452fb810703fb55fa0cd5..aab5330b637eb1011597f993f6f1b56d00877a07 100644 (file)
@@ -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.
 
   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
 # CONFIG OPTIONS
 
 These options configure the wiki. Note that plugins can add additional
index aa8bc27e45e8e5b7b1d7a5a79db193068ef37a42..689a23341b9e283f37c770e52ca7fb35e4a56aea 100644 (file)
@@ -10,3 +10,6 @@ From <a href="<TMPL_VAR URL>"><TMPL_VAR NAME></a>
 <TMPL_LOOP NAME="TAGS">
 [[tag <TMPL_VAR TAG>]]
 </TMPL_LOOP>
 <TMPL_LOOP NAME="TAGS">
 [[tag <TMPL_VAR TAG>]]
 </TMPL_LOOP>
+<TMPL_IF NAME="TITLE">
+[[meta title="<TMPL_VAR NAME="TITLE" ESCAPE=HTML>"]]
+</TMPL_IF>