User:Pengo/ite

Image Templating Engine (ITE)
There's a huge amount of power ready to be unlocked in templatable SVG.

Here's how I see the interface working

 * Uploads an image like the one on the left.
 * Using the image tag normally as following, it will appear like it does on the right.




 * Running the image name through special ITE template like so:

150px

...and you can guess what happens! (or just see the image below)

Uses

 * Easy translating of diagrams
 * Maps: Regional colours could be changed, or country hi-lite toggled.
 * Cladistics: see my horrible attempt at drawing simple diagrams without ITE: User:Pengo/clad
 * Unexpected cool things you wouldn't expect until it happens

Further usage notes
To simplify the usage of ITE, it could also be wrapped in a normal template. For the above example I could make a template called Template:Hello with the following contents:

|150px

(bold added just for readability)

And to use it you could just insert

How ITE works

 * 1) MediaWiki sees an ITE template so handles it specially.
 * 2) The first parameter of the ITE template is the name of the source svg
 * 3) All subsequent parameters are then shifted up by one, so the the second parameter becomes
 * 4) SVG file is run through the normal template mechanism (as a template), with the shifted parameters
 * 5) Generated SVG is given a new name based on a hash of its parameters (the hashname)
 * 6) The generated image may also be cached (with the hashname as a key). Note that svg's can be very small.
 * 7) ITE returns the hashname and it is inserted, as the "output" of the template
 * 8) The name is treated like any other image name
 * 9) After an hour of the hash not being referenced (or when the cache fills, or whatever) the image is dumped from cache.

Example expansion
Example template expansion:  |150px 

becomes:

 

notes for above example:
 * Image:Pengo_test_52E84A3822.svg now contains the new image
 * 52E84A3822 is a hash of "1=Hello, world"
 * the generated image gets deleted again eventually, so using subst might be a bad idea.
 * We'd also probably actually give ite output its own namespace or something so it didn't accidently step on anything, but this way makes the example easier