X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/2427bd01d6ab5bfa0e13d6bfc56b43e8f0b57e61..16f9fee1da6f3f102c953f61f79bcd8bdb28aaf3:/doc/users/jasonblevins.mdwn?ds=sidebyside diff --git a/doc/users/jasonblevins.mdwn b/doc/users/jasonblevins.mdwn index 52420f7c9..e4a459e30 100644 --- a/doc/users/jasonblevins.mdwn +++ b/doc/users/jasonblevins.mdwn @@ -1,11 +1,89 @@ -I'm currently hosting a private ikiwiki for keeping research notes -which, with some patches and a (currently unreleased) plugin, will -convert inline LaTeX expressions to MathML. I'm working towards a -patchset and instructions for others to do the same. +[[!meta title="Jason Blevins"]] -There is one thing that needs to be decided first: whether or not to -include [[sanitization|todo/svg]] of MathML in htmlscrubber (and while -we're at it, why not SVG). +I am a former Ikiwiki user who wrote several plugins and patches +related to MathML, [[SVG|todo/svg]], and [[todo/syntax highlighting]]. +Some related links and notes are archived below. -My (also MathML-enabled) homepage: (still using -Blosxom...maybe one day I'll convert it to ikiwiki...) +Homepage: + +## Plugins + +The following [plugins](http://jblevins.org/projects/ikiwiki/) +are no longer maintained, but please feel free to use, modify, and +redistribute them. Read the corresponding perldoc documentation for +more details. + + * [mdwn_itex][] - Works with the [[`mdwn`|plugins/mdwn]] plugin to convert + inline [[todo/LaTeX]] expressions to MathML using `itex2MML`. + + * [h1title][] - If present, use the leading level 1 Markdown header to + set the page title and remove it from the page body. + + * [code][] - Whole file and inline code snippet [[todo/syntax highlighting]] + via GNU Source-highlight. The list of supported file extensions is + configurable. + + * [metamail][] - a plugin for loading metadata from email-style + headers at top of a file (e.g., `title: Page Title` or + `date: November 2, 2008 11:14 EST`). + + * [pandoc][] - [[ikiwiki/Markdown]] page processing via + [Pandoc](http://johnmacfarlane.net/pandoc/) (a Haskell library for + converting from one markup format to another). [[todo/LaTeX]] and + [[reStructuredText|plugins/rst]] are optional. + + * [path][] - Provides path-specific template conditionals such as + `IS_HOMEPAGE` and `IN_DIR_SUBDIR`. + + [mdwn_itex]: http://jblevins.org/git/ikiwiki/plugins.git/plain/mdwn_itex.pm + [h1title]: http://jblevins.org/git/ikiwiki/plugins.git/plain/h1title.pm + [code]: http://jblevins.org/projects/ikiwiki/code + [metamail]: http://jblevins.org/git/ikiwiki/plugins.git/plain/metamail.pm + [pandoc]: http://jblevins.org/git/ikiwiki/plugins.git/plain/pandoc.pm + [path]: http://jblevins.org/git/ikiwiki/plugins.git/plain/path.pm + +## MathML and SVG support + +So far, I've made some notes on sanitizing MathML and SVG via +htmlscrubber on the [[todo/svg]] todo item. + +I've also worked out some content-negotiation issues. First of all, +one needs to modify the default templates to use the +XHTML+MathML+SVG doctype (see e.g., this [patch][template-patch]). +For most browsers, the content type of the pages should be +`application/xhtml+xml`. The solution is easy if you want to +just send `application/xhtml+xml` to everybody: +just change the content type of `.html` files across the board. + +However, if you want to support browsers that don't accept +`application/xhtml+xml` (and those that will but say they +don't, such as IE with the MathPlayer plugin), then one +needs a `mod_rewrite` rule like the following: + + RewriteCond %{HTTP_ACCEPT} application\/xhtml\+xml [OR] + RewriteCond %{HTTP_USER_AGENT} (W3C.*Validator|MathPlayer) + RewriteRule \.html$ - [T=application/xhtml+xml] + +This solves the problem of MathML and inline SVG in static pages +but some additional work is required for dynamically generated +pages, like page previews, that are generated by `ikiwiki.cgi`. +We need to allow `ikiwiki.cgi` to set the content type dynamically +based on the `HTTP_CONTENT_TYPE` environment variable +(e.g., with the following [patch][cgi-patch]). Then, the following +rewrite rules can pass the correct content type to ikiwiki: + + RewriteCond %{HTTP_ACCEPT} application\/xhtml\+xml [OR] + RewriteCond %{HTTP_USER_AGENT} (W3C.*Validator|MathPlayer) + RewriteRule ikiwiki.cgi$ - [T=application/xhtml+xml] + +One final critical issue is that a production-ready setup needs to +implement some sort of on-the-fly error handling. If a user submits +an invalid LaTeX expression or SVG code (not malicious, just invalid) +and saves the page, then browsers like Firefox will halt processing of +the page, preventing any further viewing or editing. A less than +optimal solution is to force users to preview the page before saving. +That way if someone introduces invalid XHTML then they can't save the +page in the first place (unless they post directly to the right URL). + + [template-patch]: http://jblevins.org/git/ikiwiki.git/commit/?h=xbeta&id=416d5d1b15b94e604442e4e209a30dee4b77b684 + [cgi-patch]: http://jblevins.org/git/ikiwiki.git/commit/?id=fa538c375250ab08f396634135f7d79fce2a9d36