diff options
author | Joey Hess <joey@kitenet.net> | 2010-07-25 20:18:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-25 20:18:02 -0400 |
commit | dd9d117894952efb23c8b444ae27672571d6548a (patch) | |
tree | f582830102f1195b9eda2a47cc85a518ada6b832 /IkiWiki/Plugin | |
parent | 80903dff493738bc66fd14b7f7ec52174af7311c (diff) |
meta: Allow syntax closer to html meta to be used.
The idea here is that <meta name="foo" description="bar">
can be written like [[!meta name="foo" description="bar">.
Of course, [[!meta foo=bar]] is still supported; this new feature
provides some DWIM when trying to directly convert a meta tag into
a meta directive.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/meta.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 7d68a9b2d..d18585d3d 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -253,12 +253,20 @@ sub preprocess (@) { ' content="'.encode_entities($value).'" />'; } elsif ($key eq 'description') { - push @{$metaheaders{$page}}, '<meta name="'.encode_entities($key). + push @{$metaheaders{$page}}, '<meta name="'. + encode_entities($key). '" content="'.encode_entities($value).'" />'; } + elsif ($key eq 'name') { + push @{$metaheaders{$page}}, scrub('<meta '.$key.'="'. + encode_entities($value). + join(' ', map { "$_=\"$params{$_}\"" } keys %params). + ' />', $destpage); + } else { - push @{$metaheaders{$page}}, scrub('<meta name="'.encode_entities($key). - '" content="'.encode_entities($value).'" />', $destpage); + push @{$metaheaders{$page}}, scrub('<meta name="'. + encode_entities($key).'" content="'. + encode_entities($value).'" />', $destpage); } return ""; |