]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/toggle.pm
editpage escaping fixes
[git.ikiwiki.info.git] / IkiWiki / Plugin / toggle.pm
index f969d7686709da5a06410a260c09fbc598530f4b..284eb8249df031e77f2e1ff1796d19624bbae1cf 100644 (file)
@@ -108,9 +108,9 @@ sub format (@) { #{{{
 
        if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">)</div>!$1!g) {
                $params{content}=~s/<div class="toggleableend">//g;
 
        if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">)</div>!$1!g) {
                $params{content}=~s/<div class="toggleableend">//g;
-               if (! ($params{content}=~s!^<\/body>!$javascript</body>!m)) {
+               if (! ($params{content}=~s!^<body>!<body>$javascript!m)) {
                        # no </body> tag, probably in preview mode
                        # no </body> tag, probably in preview mode
-                       $params{content}.=$javascript;
+                       $params{content}=$javascript.$params{content};
                }
        }
        return $params{content};
                }
        }
        return $params{content};