User:Pengo/ite
| Peter Halasz (talk) | ? | |
|---|---|---|
|
Subpages: /dia | /missing | /org | /pages | /photo | /quotes | ||
|
Subjects: /bot | /comp | /ee | /eco | /fringe | /micro | /sd | /zoo | ||
|
Incubator: /ownimg | /teletaxotest | /self | ||
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.
[[Image:Pengo_test.svg]]
- Running the image name through special ITE template like so:
[[{{ITE|Image:Pengo_test.svg|Hello, world}}|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:
[[{{ITE|Image:Pengo_test.svg|{{{1|Hi everyone}}}}}|150px]]
(bold added just for readability)
And to use it you could just insert {{Hello|a star!}}
How ITE works
- MediaWiki sees an ITE template so handles it specially.
- The first parameter of the ITE template is the name of the source svg
- All subsequent parameters are then shifted up by one, so the the second parameter becomes {{{1}}}
- SVG file is run through the normal template mechanism (as a template), with the shifted parameters
- Generated SVG is given a new name based on a hash of its parameters (the hashname)
- The generated image may also be cached (with the hashname as a key). Note that svg's can be very small.
- ITE returns the hashname and it is inserted, as the "output" of the template
- The name is treated like any other image name
- 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:
[[{{ITE|Image:Pengo_test.svg|Hello, world}}|150px]]
becomes:
[[Image:Pengo_test_52E84A3822.svg|150px]]
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
Notes
Note (1): There's nothing special about the SVG files here. Any other file type could be used just as well. The only thing that the template mechanism is looking for is {{{these}}} things anyway, just like when it runs against a normal wikipage.
Note (2): We can't make the syntax simply [[{{Image:Pengo_test.svg|Hello, world}}|150px]], because that syntax is already used to include the Image Description Page.
Note (3): For the morbidly curious, the source code of the SVG that draws the text for the above image looks like this (generated by inkscape 0.43). See the full source also.
<tspan
sodipodi:role="line"
id="tspan1311"
x="143.57103"
y="148.60481">{{{1|yay}}}</tspan>
Please leave comments on the talk page or at mediawiki bugzilla
More ideas and other thoughts like this at my rants page.

Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.