From b66f9a1981094bc2159a228dfaefc5c2e01ee68a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 28 Jun 2008 23:08:24 -0400 Subject: call format hooks when generating page previews * 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. --- doc/bugs/toc_in_sidebar.mdwn | 5 +++++ doc/plugins/plaintext/.discussion.mdwn.swp | Bin 12288 -> 0 bytes doc/plugins/write.mdwn | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) delete mode 100644 doc/plugins/plaintext/.discussion.mdwn.swp (limited to 'doc') diff --git a/doc/bugs/toc_in_sidebar.mdwn b/doc/bugs/toc_in_sidebar.mdwn index 9286790b8..d2c3ab975 100644 --- a/doc/bugs/toc_in_sidebar.mdwn +++ b/doc/bugs/toc_in_sidebar.mdwn @@ -13,4 +13,9 @@ I can't think of a way between these that works in all cases. Maybe call 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.. + --[[Joey]] + +[[done]] diff --git a/doc/plugins/plaintext/.discussion.mdwn.swp b/doc/plugins/plaintext/.discussion.mdwn.swp deleted file mode 100644 index df2347f9e..000000000 Binary files a/doc/plugins/plaintext/.discussion.mdwn.swp and /dev/null differ diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 35f391f7f..5def4c679 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -220,7 +220,9 @@ and should return the sanitized 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 -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. -- cgit v1.2.3