From b31e8c08260b0da95014caea078f3155d4707e28 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 9 Jan 2008 01:05:54 -0500 Subject: * inline: Add copyright/license info on a per-post basis to atom feeds if available. (rss doesn't allow such info on a per-post basis) * meta: Allow copyright/license metadata to contain arbitrary markup. --- IkiWiki/Plugin/meta.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 987262a48..88c942fa4 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -43,6 +43,23 @@ sub scrub ($) { #{{{ } } #}}} +sub htmlize ($$$) { #{{{ + my $page = shift; + my $destpage = shift; + my $text = shift; + + $text=IkiWiki::htmlize($page, pagetype($pagesources{$page}), + IkiWiki::linkify($page, $destpage, + IkiWiki::preprocess($page, $destpage, $text))); + + # hack to get rid of enclosing junk added by markdown + $text=~s!^

!!; + $text=~s!

$!!; + chomp $text; + + return $text; +} + sub preprocess (@) { #{{{ return "" unless @_; my %params=@_; @@ -193,12 +210,12 @@ sub pagetemplate (@) { #{{{ if (exists $license{$page} && $template->query(name => "license") && ($page eq $destpage || ! exists $license{$destpage} || $license{$page} ne $license{$destpage})) { - $template->param(license => IkiWiki::linkify($page, $destpage, $license{$page})); + $template->param(license => htmlize($page, $destpage, $license{$page})); } if (exists $copyright{$page} && $template->query(name => "copyright") && ($page eq $destpage || ! exists $copyright{$destpage} || $copyright{$page} ne $copyright{$destpage})) { - $template->param(copyright => IkiWiki::linkify($page, $destpage, $copyright{$page})); + $template->param(copyright => htmlize($page, $destpage, $copyright{$page})); } } # }}} -- cgit v1.2.3