aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-01-25 10:28:52 +0100
committerJoey Hess <joey@kitenet.net>2011-03-28 13:08:20 -0400
commit7e7dea078bce3437b9a14d96079ddd68a5f0aab9 (patch)
treee408feb868fbf755da81062cac928a091fdd00a2 /IkiWiki/Plugin
parent370767bd1f057079881cf4fc38b98aa894b1f010 (diff)
downloadikiwiki-7e7dea078bce3437b9a14d96079ddd68a5f0aab9.tar
ikiwiki-7e7dea078bce3437b9a14d96079ddd68a5f0aab9.tar.gz
meta plugin: script support
(cherry picked from commit 44c5b27f88fdbfb4fdd061f600039e490eaeff92)
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/meta.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 1a9f94a12..eebe3460f 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -179,6 +179,17 @@ sub preprocess (@) {
'" title="'.encode_entities($title).
"\" type=\"text/css\" />", $page, $destpage);
}
+ elsif ($key eq 'script') {
+ my $defer=exists $params{defer} ? ' defer="defer"' : '';
+ my $async=exists $params{async} ? ' async="async"' : '';
+ my $js=bestlink($page, $value.".js");
+ if (! length $js) {
+ error gettext("script not found");
+ }
+ push @{$metaheaders{$page}}, scrub('<script src="'.urlto($js, $page).
+ '"' . $defer . $async . ' type="text/javascript" />',
+ $page, $destpage);
+ }
elsif ($key eq 'openid') {
my $delegate=0; # both by default
if (exists $params{delegate}) {