* meta: Support license and copyright information. The information will

be shown in the page footer. HTML will also be inserted that should
  support the rel=license microformat as well as the HTML spec's
  rel=copyright.
master
joey 2007-09-14 18:11:10 +00:00
parent dedd467376
commit 906dcfd518
6 changed files with 57 additions and 4 deletions

View File

@ -11,6 +11,8 @@ my %title;
my %permalink;
my %author;
my %authorurl;
my %license;
my %copyright;
sub import { #{{{
hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1);
@ -45,6 +47,7 @@ sub preprocess (@) { #{{{
delete $params{$key};
my $page=$params{page};
delete $params{page};
my $destpage=$params{destpage};
delete $params{destpage};
delete $params{preview};
@ -100,6 +103,14 @@ sub preprocess (@) { #{{{
$meta{$page}.='<link href="'.encode_entities($value).
"\" rel=\"openid.delegate\" />\n";
}
elsif ($key eq 'license') {
$meta{$page}.="<link rel=\"license\" href=\"#page_license\" />\n";
$license{$page}=IkiWiki::linkify($page, $destpage, $value);
}
elsif ($key eq 'copyright') {
$meta{$page}.="<link rel=\"copyright\" href=\"#page_copyright\" />\n";
$copyright{$page}=IkiWiki::linkify($page, $destpage, $value);
}
else {
$meta{$page}.=scrub("<meta name=\"".encode_entities($key).
"\" content=\"".encode_entities($value)."\" />\n");
@ -131,6 +142,10 @@ sub pagetemplate (@) { #{{{
if exists $author{$page} && $template->query(name => "author");
$template->param(authorurl => $authorurl{$page})
if exists $authorurl{$page} && $template->query(name => "authorurl");
$template->param(license => $license{$page})
if exists $license{$page} && $template->query(name => "license");
$template->param(copyright => $copyright{$page})
if exists $copyright{$page} && $template->query(name => "copyright");
} # }}}

6
debian/changelog vendored
View File

@ -4,8 +4,12 @@ ikiwiki (2.8) UNRELEASED; urgency=low
format. Included many details not previously listed in the old file.
* inline: add feedonly option, set feedonly=yes to get only the feed button
but not inline the pages.
* meta: Support license and copyright information. The information will
be shown in the page footer. HTML will also be inserted that should
support the rel=license microformat as well as the HTML spec's
rel=copyright.
-- Joey Hess <joeyh@debian.org> Thu, 13 Sep 2007 18:07:51 -0400
-- Joey Hess <joeyh@debian.org> Fri, 14 Sep 2007 13:05:22 -0400
ikiwiki (2.7) unstable; urgency=low

View File

@ -41,7 +41,13 @@ You can use any field names you like, but here are some predefined ones:
* license
Specifies a copyright license for the page, for example, "GPL".
Specifies a license for the page, for example, "GPL". Can contain
WikiLinks.
* copyright
Specifies the copyright of the page, for example, "Copyright 2007 by
Joey Hess". Can contain WikiLinks.
* author

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-13 18:22-0400\n"
"POT-Creation-Date: 2007-09-14 14:10-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -213,7 +213,7 @@ msgstr ""
msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
msgstr ""
#: ../IkiWiki/Plugin/meta.pm:88
#: ../IkiWiki/Plugin/meta.pm:92
msgid "stylesheet not found"
msgstr ""

View File

@ -30,6 +30,20 @@ Tags:
</span>
</TMPL_IF>
<TMPL_IF COPYRIGHT>
<div class="copyright">
<a name="page_copyright"></a>
<TMPL_VAR COPYRIGHT>
</div>
</TMPL_IF>
<TMPL_IF LICENSE>
<div class="license">
<a name="page_license"></a>
License: <TMPL_VAR LICENSE>
</div>
</TMPL_IF>
<TMPL_IF NAME="HAVE_ACTIONS">
<div class="actions">
<ul>

View File

@ -88,6 +88,20 @@ Links:
</div>
</TMPL_IF>
<TMPL_IF COPYRIGHT>
<div class="copyright">
<a name="page_copyright"></a>
<TMPL_VAR COPYRIGHT>
</div>
</TMPL_IF>
<TMPL_IF LICENSE>
<div class="license">
<a name="page_license"></a>
License: <TMPL_VAR LICENSE>
</div>
</TMPL_IF>
<div class="pagedate">
Last edited <TMPL_VAR NAME=MTIME>
</div>