]> sipb.mit.edu Git - ikiwiki.git/blob - doc/users/jasonblevins.mdwn
removed
[ikiwiki.git] / doc / users / jasonblevins.mdwn
1 [[!meta title="Jason Blevins"]]
2
3 I am a former Ikiwiki user who wrote several plugins and patches
4 related to MathML, [[SVG|todo/svg]], and [[todo/syntax highlighting]].
5 Some related links and notes are archived below.
6
7 Homepage: <http://jblevins.org/>
8
9 ## Plugins
10
11 The following [plugins](http://jblevins.org/projects/ikiwiki/)
12 are no longer maintained, but please feel free to use, modify, and
13 redistribute them.  Read the corresponding perldoc documentation for
14 more details.
15
16  * [mdwn_itex][] - Works with the [[`mdwn`|plugins/mdwn]] plugin to convert
17    inline [[todo/LaTeX]] expressions to MathML using `itex2MML`.
18
19  * [h1title][] - If present, use the leading level 1 Markdown header to
20    set the page title and remove it from the page body.
21
22  * [code][] - Whole file and inline code snippet [[todo/syntax highlighting]]
23    via GNU Source-highlight.  The list of supported file extensions is
24    configurable.
25
26  * [metamail][] - a plugin for loading metadata from email-style
27    headers at top of a file (e.g., `title: Page Title` or
28    `date: November 2, 2008 11:14 EST`).
29
30  * [pandoc][] - [[ikiwiki/Markdown]] page processing via
31    [Pandoc](http://johnmacfarlane.net/pandoc/) (a Haskell library for
32    converting from one markup format to another).  [[todo/LaTeX]] and
33    [[reStructuredText|plugins/rst]] are optional.
34
35  * [path][] - Provides path-specific template conditionals such as
36    `IS_HOMEPAGE` and `IN_DIR_SUBDIR`.
37
38  [mdwn_itex]: http://jblevins.org/git/ikiwiki/plugins.git/plain/mdwn_itex.pm
39  [h1title]: http://jblevins.org/git/ikiwiki/plugins.git/plain/h1title.pm
40  [code]: http://jblevins.org/projects/ikiwiki/code
41  [metamail]: http://jblevins.org/git/ikiwiki/plugins.git/plain/metamail.pm
42  [pandoc]: http://jblevins.org/git/ikiwiki/plugins.git/plain/pandoc.pm
43  [path]: http://jblevins.org/git/ikiwiki/plugins.git/plain/path.pm
44
45 ## MathML and SVG support
46
47 So far, I've made some notes on sanitizing MathML and SVG via
48 htmlscrubber on the [[todo/svg]] todo item.
49
50 I've also worked out some content-negotiation issues.  First of all,
51 one needs to modify the default templates to use the
52 XHTML+MathML+SVG doctype (see e.g., this [patch][template-patch]).
53 For most browsers, the content type of the pages should be
54 `application/xhtml+xml`.  The solution is easy if you want to
55 just send `application/xhtml+xml` to everybody:
56 just change the content type of `.html` files across the board.
57
58 However, if you want to support browsers that don't accept
59 `application/xhtml+xml` (and those that will but say they
60 don't, such as IE with the MathPlayer plugin), then one
61 needs a `mod_rewrite` rule like the following:
62
63     RewriteCond %{HTTP_ACCEPT} application\/xhtml\+xml [OR]
64     RewriteCond %{HTTP_USER_AGENT} (W3C.*Validator|MathPlayer)
65     RewriteRule \.html$ - [T=application/xhtml+xml]
66
67 This solves the problem of MathML and inline SVG in static pages
68 but some additional work is required for dynamically generated
69 pages, like page previews, that are generated by `ikiwiki.cgi`.
70 We need to allow `ikiwiki.cgi` to set the content type dynamically
71 based on the `HTTP_CONTENT_TYPE` environment variable
72 (e.g., with the following [patch][cgi-patch]).  Then, the following
73 rewrite rules can pass the correct content type to ikiwiki:
74
75     RewriteCond %{HTTP_ACCEPT} application\/xhtml\+xml [OR]
76     RewriteCond %{HTTP_USER_AGENT} (W3C.*Validator|MathPlayer)
77     RewriteRule ikiwiki.cgi$ - [T=application/xhtml+xml]
78
79 One final critical issue is that a production-ready setup needs to
80 implement some sort of on-the-fly error handling.  If a user submits
81 an invalid LaTeX expression or SVG code (not malicious, just invalid)
82 and saves the page, then browsers like Firefox will halt processing of
83 the page, preventing any further viewing or editing.  A less than
84 optimal solution is to force users to preview the page before saving.
85 That way if someone introduces invalid XHTML then they can't save the
86 page in the first place (unless they post directly to the right URL).
87
88  [template-patch]: http://jblevins.org/git/ikiwiki.git/commit/?h=xbeta&id=416d5d1b15b94e604442e4e209a30dee4b77b684
89  [cgi-patch]: http://jblevins.org/git/ikiwiki.git/commit/?id=fa538c375250ab08f396634135f7d79fce2a9d36