toggle, relativedate: Support templates that add attributes to the body tag.

master
Joey Hess 2009-09-28 16:21:03 -04:00
parent 13b525d8ea
commit 3525a6b7f2
4 changed files with 6 additions and 2 deletions

View File

@ -26,7 +26,7 @@ sub getsetup () {
sub format (@) {
my %params=@_;
if (! ($params{content}=~s!^(<body>)!$1.include_javascript($params{page})!em)) {
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
# no </body> tag, probably in preview mode
$params{content}=include_javascript($params{page}, 1).$params{content};
}

View File

@ -68,7 +68,7 @@ sub format (@) {
if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">\s*)</div>!$1!g) {
$params{content}=~s/<div class="toggleableend">//g;
if (! ($params{content}=~s!^(<body>)!$1.include_javascript($params{page})!em)) {
if (! ($params{content}=~s!^(<body[^>]*>)!$1.include_javascript($params{page})!em)) {
# no </body> tag, probably in preview mode
$params{content}=include_javascript($params{page}, 1).$params{content};
}

2
debian/changelog vendored
View File

@ -4,6 +4,8 @@ ikiwiki (3.14159266) UNRELEASED; urgency=low
the toplevel index differently etc.
* img: Correct bug in image size calculation code.
* img: Fix dependency code for full size images.
* toggle, relativedate: Support templates that add attributes
to the body tag.
-- Joey Hess <joeyh@debian.org> Sun, 27 Sep 2009 17:40:03 -0400

View File

@ -1 +1,3 @@
The toggle plugins checks for a `<body>` in the page; if not found, javascript tags are inserted at the top of the document. Since my page uses `<body onload="javascript:fixLinks()">`; a plain `<body>` is not found and I get script links before the docstring declaration. Please see the source of the following toggle-using page: http://kaizer.se/wiki/kupfer/ -- ulrik [kaizer.se]
[[fixed|done]] --[[Joey]]