* 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.master
parent
26c2c63c97
commit
8883001615
|
@ -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/(?<!\\)\[\[/\\\[\[/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});
|
||||
|
|
|
@ -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}.="<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 {
|
||||
|
@ -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}.="<meta name=\"".escapeHTML($key)."\" content=\"".escapeHTML($value)."\" />\n";
|
||||
$meta{$page}.="<meta name=\"".encode_entities($key).
|
||||
"\" content=\"".encode_entities($value)."\" />\n";
|
||||
}
|
||||
|
||||
return "";
|
||||
|
|
|
@ -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.
|
||||
* 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> Sat, 29 Jul 2006 20:10:51 -0400
|
||||
-- Joey Hess <joeyh@debian.org> Sun, 30 Jul 2006 18:17:28 -0400
|
||||
|
||||
ikiwiki (1.12) unstable; urgency=low
|
||||
|
||||
|
|
|
@ -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 <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
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)"]]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_IF NAME="TITLE">
|
||||
[[meta title="<TMPL_VAR NAME="TITLE" ESCAPE=HTML>"]]
|
||||
</TMPL_IF>
|
||||
|
|
Loading…
Reference in New Issue