Added description of the asymptote plugin.
[ikiwiki] / doc / plugins / asymptote.mdwn
1 [[!template id=plugin name=asymptote author="[[PeterSimons]]"]]
2 [[!tag type/widget]]
3
4 This plugin provides the [[ikiwiki/directive/asymptote]]
5 [[ikiwiki/directive]]. This directive allows embedding
6 [asymptote](http://asymptote.sourceforge.net//) diagrams in a page.
7
8 Security implications: asymptote has functions for reading files and
9 other dangerous stuff, so enabling this plugin means that everyone who
10 can edit your Wiki can also read any file from your hard drive thats
11 accessible to the user running Ikiwiki. 
12
13 [[!if test="enabled(asymptote)" then="""
14 An example diagram:
15
16 [[!asymptote src="""
17 import geometry;
18 unitsize(1cm);
19 triangle t = triangle((0,0), (4,0), (0.5,2));
20 show(La="$D$", Lb="$E$", Lc="", t);
21 dot(t.A^^t.B^^t.C);
22 point pD = midpoint(t.BC); dot(pD);
23 point pE = midpoint(t.AC); dot(pE);
24 draw(pD--pE);
25
26 point A_ = (pD-t.A)*2+t.A; dot("$A'$", A_, NE);
27 draw(t.B--A_--t.C, dashed);
28 draw(t.A--A_, dashed);
29
30 point E_ = midpoint(line(t.B,A_)); dot(Label("$E'$", E_, E));
31 draw(E_--pD, dashed);
32 """]]
33 """]]
34
35 This plugin uses the [[!cpan Digest::SHA]] perl module.