* toc: Revert change in 2.45 that made it run at sanitize time. This breaks
use of toc in a sidebar.
* Call format hooks when generating page previews, thus fixing toc display
there, as well as fixing inlins to again display in page previews, since
it's started using format hooks. This also allows several other things,
like embed, that use format hooks, to work during page preview time.
* Format hooks should not rely on getting an entire html document, as they
will only get the body during page preview.
* toggle: Deal with preview mode when adding javascript.
session => $session,
);
});
session => $session,
);
});
- $form->tmpl_param("page_preview",
- htmlize($page, $page, $type,
+ my $preview=htmlize($page, $page, $type,
linkify($page, $page,
preprocess($page, $page,
linkify($page, $page,
preprocess($page, $page,
- filter($page, $page, $content), 0, 1))));
+ filter($page, $page, $content), 0, 1)));
+ run_hooks(format => sub {
+ $preview=shift->(
+ page => $page,
+ content => $preview,
+ );
+ });
+ $form->tmpl_param("page_preview", $preview);
if ($new) {
delete $pagesources{$page};
if ($new) {
delete $pagesources{$page};
sub import { #{{{
hook(type => "preprocess", id => "toc", call => \&preprocess);
sub import { #{{{
hook(type => "preprocess", id => "toc", call => \&preprocess);
- hook(type => "sanitize", id => "toc", call => \&sanitize);
+ hook(type => "format", id => "toc", call => \&format);
my %params=@_;
my $content=$params{content};
my %params=@_;
my $content=$params{content};
if ($params{content}=~s!(<div class="toggleable" id="[^"]+">)</div>!$1!g) {
$params{content}=~s/<div class="toggleableend">//g;
if ($params{content}=~s!(<div class="toggleable" id="[^"]+">)</div>!$1!g) {
$params{content}=~s/<div class="toggleableend">//g;
- $params{content}=~s!^<\/body>!$javascript</body>!m;
+ if (! ($params{content}=~s!^<\/body>!$javascript</body>!m)) {
+ # no </body> tag, probably in preview mode
+ $params{content}.=$javascript;
+ }
}
return $params{content};
} # }}}
}
return $params{content};
} # }}}
* txt: New plugin, contributed by Gabriel McManus.
* smiley: Generate links relative to the destpage. (Fixes a reversion from
2.41.)
* txt: New plugin, contributed by Gabriel McManus.
* smiley: Generate links relative to the destpage. (Fixes a reversion from
2.41.)
+ * toc: Revert change in 2.45 that made it run at sanitize time. This breaks
+ use of toc in a sidebar.
+ * Call format hooks when generating page previews, thus fixing toc display
+ there, as well as fixing inlins to again display in page previews, since
+ it's started using format hooks. This also allows several other things,
+ like embed, that use format hooks, to work during page preview time.
+ * Format hooks should not rely on getting an entire html document, as they
+ will only get the body during page preview.
+ * toggle: Deal with preview mode when adding javascript.
-- Joey Hess <joeyh@debian.org> Sun, 15 Jun 2008 15:03:33 -0400
-- Joey Hess <joeyh@debian.org> Sun, 15 Jun 2008 15:03:33 -0400
the format hooks when generating a page preview? Maybe add an option to toc
to make it embeddable in the sidebar?
the format hooks when generating a page preview? Maybe add an option to toc
to make it embeddable in the sidebar?
+Hmm, I think I need to call format during preview. Another case is that
+inline uses a format hook to insert the inlined content..
+
The difference between format and sanitize is that sanitize only acts on
the page body, while format can modify the entire html page including the
The difference between format and sanitize is that sanitize only acts on
the page body, while format can modify the entire html page including the
-header and footer inserted by ikiwiki, the html document type, etc.
+header and footer inserted by ikiwiki, the html document type, etc. (It
+should not rely on always being passed the entire page, as it won't be
+when the page is being previewed.)
The function is passed named parameters: "page" and "content", and
should return the formatted content.
The function is passed named parameters: "page" and "content", and
should return the formatted content.
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-06-13 15:17-0400\n"
+"POT-Creation-Date: 2008-06-28 23:05-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "login failed, perhaps you need to turn on cookies?"
msgstr ""
msgid "login failed, perhaps you need to turn on cookies?"
msgstr ""
-#: ../IkiWiki/CGI.pm:190 ../IkiWiki/CGI.pm:521
+#: ../IkiWiki/CGI.pm:190 ../IkiWiki/CGI.pm:527
msgid "Your login session has expired."
msgstr ""
msgid "Your login session has expired."
msgstr ""
msgid "%s is not an editable page"
msgstr ""
msgid "%s is not an editable page"
msgstr ""
-#: ../IkiWiki/CGI.pm:432 ../IkiWiki/Plugin/brokenlinks.pm:24
+#: ../IkiWiki/CGI.pm:438 ../IkiWiki/Plugin/brokenlinks.pm:24
#: ../IkiWiki/Plugin/inline.pm:266 ../IkiWiki/Plugin/opendiscussion.pm:17
#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:95
#: ../IkiWiki/Render.pm:162
msgid "discussion"
msgstr ""
#: ../IkiWiki/Plugin/inline.pm:266 ../IkiWiki/Plugin/opendiscussion.pm:17
#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:95
#: ../IkiWiki/Render.pm:162
msgid "discussion"
msgstr ""
-#: ../IkiWiki/CGI.pm:488
+#: ../IkiWiki/CGI.pm:494
#, perl-format
msgid "creating %s"
msgstr ""
#, perl-format
msgid "creating %s"
msgstr ""
-#: ../IkiWiki/CGI.pm:506 ../IkiWiki/CGI.pm:534 ../IkiWiki/CGI.pm:544
-#: ../IkiWiki/CGI.pm:578 ../IkiWiki/CGI.pm:623
+#: ../IkiWiki/CGI.pm:512 ../IkiWiki/CGI.pm:540 ../IkiWiki/CGI.pm:550
+#: ../IkiWiki/CGI.pm:584 ../IkiWiki/CGI.pm:629
#, perl-format
msgid "editing %s"
msgstr ""
#, perl-format
msgid "editing %s"
msgstr ""
-#: ../IkiWiki/CGI.pm:716
+#: ../IkiWiki/CGI.pm:722
msgid "You are banned."
msgstr ""
msgid "You are banned."
msgstr ""
msgid "missing %s parameter"
msgstr ""
msgid "missing %s parameter"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:161
+#: ../IkiWiki/Plugin/aggregate.pm:168
msgid "new feed"
msgstr ""
msgid "new feed"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:175
+#: ../IkiWiki/Plugin/aggregate.pm:182
-#: ../IkiWiki/Plugin/aggregate.pm:177
+#: ../IkiWiki/Plugin/aggregate.pm:184
-#: ../IkiWiki/Plugin/aggregate.pm:340
+#: ../IkiWiki/Plugin/aggregate.pm:347
#, perl-format
msgid "expiring %s (%s days old)"
msgstr ""
#, perl-format
msgid "expiring %s (%s days old)"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:347
+#: ../IkiWiki/Plugin/aggregate.pm:354
#, perl-format
msgid "expiring %s"
msgstr ""
#, perl-format
msgid "expiring %s"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:374
+#: ../IkiWiki/Plugin/aggregate.pm:381
#, perl-format
msgid "processed ok at %s"
msgstr ""
#, perl-format
msgid "processed ok at %s"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:378
+#: ../IkiWiki/Plugin/aggregate.pm:385
#, perl-format
msgid "checking feed %s ..."
msgstr ""
#, perl-format
msgid "checking feed %s ..."
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:383
+#: ../IkiWiki/Plugin/aggregate.pm:390
#, perl-format
msgid "could not find feed at %s"
msgstr ""
#, perl-format
msgid "could not find feed at %s"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:398
+#: ../IkiWiki/Plugin/aggregate.pm:405
msgid "feed not found"
msgstr ""
msgid "feed not found"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:409
+#: ../IkiWiki/Plugin/aggregate.pm:416
#, perl-format
msgid "(invalid UTF-8 stripped from feed)"
msgstr ""
#, perl-format
msgid "(invalid UTF-8 stripped from feed)"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:415
+#: ../IkiWiki/Plugin/aggregate.pm:422
#, perl-format
msgid "(feed entities escaped)"
msgstr ""
#, perl-format
msgid "(feed entities escaped)"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:421
+#: ../IkiWiki/Plugin/aggregate.pm:428
msgid "feed crashed XML::Feed!"
msgstr ""
msgid "feed crashed XML::Feed!"
msgstr ""
-#: ../IkiWiki/Plugin/aggregate.pm:495
+#: ../IkiWiki/Plugin/aggregate.pm:502
#, perl-format
msgid "creating new page %s"
msgstr ""
#, perl-format
msgid "creating new page %s"
msgstr ""
msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
msgstr ""
msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
msgstr ""
-#: ../IkiWiki/Plugin/meta.pm:132
+#: ../IkiWiki/Plugin/meta.pm:137
msgid "stylesheet not found"
msgstr ""
msgid "stylesheet not found"
msgstr ""
-#: ../IkiWiki/Plugin/meta.pm:166
+#: ../IkiWiki/Plugin/meta.pm:171
msgid "redir page not found"
msgstr ""
msgid "redir page not found"
msgstr ""
-#: ../IkiWiki/Plugin/meta.pm:179
+#: ../IkiWiki/Plugin/meta.pm:184
msgid "redir cycle is not allowed"
msgstr ""
msgid "redir cycle is not allowed"
msgstr ""