more core docs
[io.git] / tools / io / docs2html.io
blobebff3e20373447277527c5c638e921992b851b71
1 /*
2 Directory with("addons") folders foreach(folder,
3 //write(folder name)
4 e := try(Lobby perform(folder name asSymbol))
5 //if(e, writeln(""), writeln(" (error)"))
7 */
9 protos := Protos slotValues map(slotValues) flatten unique select(!=nil) select(v, if(v type == "Object" and v docs ?slots == nil, false, true)) sortByKey(type asLowercase)
11 protos foreach(p,
12 if(p hasLocalSlot("docs") not, p docs := Object clone do(slots := Object clone))
13 p foreachSlot(k, v,
14 if(p docs slots getSlot(k) == nil,
15 p docs slots setSlot(k, Object clone do(description := "<font color=red>undocumented</font>"))
16 if(getSlot("v") type == Block, p docs slots getSlot("k") args := v argumentNames)
21 writeln("""
22 <html>
23 <head>
24 <title>io - core reference</title>
25 <META HTTP-EQUIV="EXPIRES" CONTENT=0>
26 <style>
29 color : #aaa;
30 text-decoration : none;
33 body {
34 font-family: 'Serif', 'Helvetica Neue', 'Helvetica', 'Sans';
37 ul {
38 padding: 0em 0em 0em 3.1em;
41 hr {
42 width:50em;
43 height:0em;
46 .Version {
47 color: #bbb;
48 text-align: left;
51 h1 {
52 color: #000000;
53 font-family: 'Helvetica-Bold', 'Helvetica';
54 font-size: 3em;
55 font-style: normal;
56 font-variant: normal;
57 font-weight: bold;
58 letter-spacing: 0;
59 line-height: 1.3;
60 margin-bottom: 0em;
61 margin-left: 0em;
62 margin-right: 0em;
63 margin-top: 0em;
64 padding-bottom: 0em;
65 padding-top: 2em;
66 text-align: left;
67 text-decoration: none;
68 text-indent: 0.00em;
69 text-transform: none;
70 vertical-align: 0.000000em;
73 pre {
74 color: #000000;
75 font-family: 'Courier', 'Courier';
76 font-size: .85em;
77 font-style: normal;
78 font-variant: normal;
79 font-weight: normal;
80 letter-spacing: 0;
81 line-height: 1.22;
82 margin-bottom: 1em;
83 margin-left: 2em;
84 margin-right: 0.00em;
85 margin-top: 1em;
86 padding-bottom: 0.000000em;
87 padding-top: 0.000000em;
88 text-align: left;
89 text-decoration: none;
90 text-indent: 0.00em;
91 text-transform: none;
92 vertical-align: 0.000000em;
95 h2 {
96 color: #000000;
97 font-family: 'Helvetica', 'Helvetica';
98 font-size: 1.8em;
99 font-style: normal;
100 font-variant: normal;
101 font-weight: bold;
102 letter-spacing: 0;
103 line-height: 1.21;
104 margin-bottom: .5em;
105 margin-left: 0em;
106 margin-right: 0.00em;
107 margin-top: 0.000000em;
108 padding-bottom: 7.000000pt;
109 padding-top: 21.000000pt;
110 text-align: left;
111 text-decoration: none;
112 text-indent: 0.00em;
113 text-transform: none;
114 vertical-align: 0.000000em;
117 h3 {
118 color: #777;
119 font-family: 'Helvetica-Bold', 'Helvetica';
120 font-size: 1.3em;
121 font-style: normal;
122 font-variant: normal;
123 font-weight: bold;
124 letter-spacing: 0;
125 line-height: 1.18em;
126 margin-bottom: 0em;
127 margin-left: 0em;
128 margin-right: 0em;
129 margin-top: 0em;
130 padding-bottom: 1em;
131 padding-top: 1em;
132 text-align: left;
133 text-decoration: none;
134 text-indent: 0.00em;
135 text-transform: none;
136 vertical-align: 0.000000em;
139 .PsuedoCode {
140 color: #000000;
141 font-family: 'Times-Italic', 'Times';
142 font-size: 11.00pt;
143 font-style: italic;
144 font-variant: normal;
145 font-weight: normal;
146 letter-spacing: 0;
147 line-height: 1.18;
148 margin-bottom: 0.000000em;
149 margin-left: 0em;
150 margin-right: 0.00em;
151 margin-top: 0.000000em;
152 padding-bottom: 0.000000em;
153 padding-top: 0.000000em;
154 text-align: left;
155 text-decoration: none;
156 text-indent: 0.00em;
157 text-transform: none;
158 vertical-align: 0.000000em;
161 </style>
162 </head>
163 <body>
164 """)
166 writeln("<ul>")
167 writeln("<h1>Io Core Reference Manual</h1>")
168 writeln("<div class=Version>Version " .. System version .. "</div>")
169 writeln("<h2>Prototypes</h2>")
170 writeln("<ul>")
172 protos map(v,
173 writeln("<a href=#", v type, " style=\"color: #555;\">", v type, "</a><br>")
176 writeln("</ul>")
178 Sequence do(
179 asHtml := method(
180 self asMutable replaceSeq(">", "&gt;") replaceSeq("<", "&lt;")
184 protos map(v,
185 write("<h2>")
186 write("<a name=" .. v type .. "><font color=black>", v type, "</font></a>")
187 writeln("</h2>")
188 writeln("<ul style=\"width:40em\">")
190 writeln("<b><font color=#000>Protos:</font></b> ", v protos map(type) join(", "))
192 if (v hasLocalSlot("docs"),
193 if (v docs ?description,
194 writeln("<h3>Description</h3>")
195 //writeln("<font face=\"Times\">")
196 v docs description println
197 writeln("</font>")
200 if (v docs ?slots,
201 writeln("<h3>Slot Index</h3>")
202 writeln("<div style=\"width:40em; margin-left:2em\">")
203 v docs slots foreachSlot(k, s,
204 write("<b><a href=#" .. v type .. "-" .. k asHtml .. " >")
205 write(k asHtml)
206 if(s ?args, write("()"))
207 //if(s ?args, write("(" .. s args join(",") .. ")"))
208 writeln("</a></b><br>")
210 writeln("</div>")
212 writeln("<br>")
213 writeln("<h3>Slots</h3>")
214 //writeln("<ul>")
215 writeln("<br>")
216 v docs slots foreachSlot(k, s,
217 write("<b>")
218 write("<a name=" .. v type .. "-" .. k asHtml .. "><font color=black>")
219 write(k asHtml)
220 if(s ?args, writeln("(</b><i>" .. s args map(asHtml) join(", ") .. "</i><b>)"))
221 write("</font></a></b>")
222 writeln("<p>")
223 writeln("<div style=\"width:40em; margin-left:2em\">")
224 //writeln("<font face=\"Times\">")
225 writeln(s description)
226 writeln("</font>")
227 writeln("</div>")
228 writeln("<p><br>")
230 //writeln("</ul>")
234 writeln("</ul>")
235 writeln("<br>")
236 writeln("<hr align=left>")
237 writeln("<br>")
240 writeln("</ul>")
241 5 repeat(writeln("<br>"))