Addons updated to new doc format
[io.git] / tools / io / docs2html.io
blobde9d13c8431392bdf0540a3f22372ae25dcf592c
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 := Map clone
11 File with("libs/iovm/docs/docs.txt") contents split("------\n") foreach(e,
12 isSlot := e beginsWithSeq("doc")
13 h := e beforeSeq("\n") afterSeq(" ")
14 protoName := h beforeSeq(" ")
15 slotName := h afterSeq(" ")
16 description := e afterSeq("\n")
17 //list(protoName, slotName, description) println
18 p := protos atIfAbsentPut(protoName, Map clone atPut("slots", Map clone))
19 if(protoName == nil or slotName == nil, writeln("ERROR: ", e))
20 if(isSlot,
21 p at("slots") atPut(slotName, description)
23 p atPut(slotName, description)
27 writeln("""
28 <html>
29 <head>
30 <title>io - core reference</title>
31 <META HTTP-EQUIV="EXPIRES" CONTENT=0>
32 <style>
35 color : #aaa;
36 text-decoration : none;
39 body {
40 font-family: 'Serif', 'Helvetica Neue', 'Helvetica', 'Sans';
43 ul {
44 padding: 0em 0em 0em 3.1em;
47 hr {
48 width:50em;
49 height:0em;
52 .Version {
53 color: #bbb;
54 text-align: left;
57 h1 {
58 color: #000000;
59 font-family: 'Helvetica-Bold', 'Helvetica';
60 font-size: 3em;
61 font-style: normal;
62 font-variant: normal;
63 font-weight: bold;
64 letter-spacing: 0;
65 line-height: 1.3;
66 margin-bottom: 0em;
67 margin-left: 0em;
68 margin-right: 0em;
69 margin-top: 0em;
70 padding-bottom: 0em;
71 padding-top: 2em;
72 text-align: left;
73 text-decoration: none;
74 text-indent: 0.00em;
75 text-transform: none;
76 vertical-align: 0.000000em;
79 code {
80 white-space: pre;
81 color: #000000;
82 font-family: 'Courier', 'Courier';
83 font-size: .88em;
84 font-style: normal;
85 font-variant: normal;
86 font-weight: normal;
87 letter-spacing: 0;
88 line-height: 1.22;
89 margin-bottom: 1em;
90 margin-left: 8em;
91 margin-right: 0em;
92 margin-top: 0em;
93 padding-bottom: 0em;
94 padding-top: 0em;
95 text-align: left;
96 text-decoration: none;
97 text-indent: 0.00em;
98 text-transform: none;
99 vertical-align: 0.000000em;
102 h2 {
103 color: #000000;
104 font-family: 'Helvetica', 'Helvetica';
105 font-size: 1.8em;
106 font-style: normal;
107 font-variant: normal;
108 font-weight: bold;
109 letter-spacing: 0;
110 line-height: 1.21;
111 margin-bottom: .5em;
112 margin-left: 0em;
113 margin-right: 0.00em;
114 margin-top: 0.000000em;
115 padding-bottom: 7.000000pt;
116 padding-top: 21.000000pt;
117 text-align: left;
118 text-decoration: none;
119 text-indent: 0.00em;
120 text-transform: none;
121 vertical-align: 0.000000em;
124 h3 {
125 color: #777;
126 font-family: 'Helvetica-Bold', 'Helvetica';
127 font-size: 1.3em;
128 font-style: normal;
129 font-variant: normal;
130 font-weight: bold;
131 letter-spacing: 0;
132 line-height: 1.18em;
133 margin-bottom: 0em;
134 margin-left: 0em;
135 margin-right: 0em;
136 margin-top: 0em;
137 padding-bottom: 1em;
138 padding-top: 1em;
139 text-align: left;
140 text-decoration: none;
141 text-indent: 0.00em;
142 text-transform: none;
143 vertical-align: 0.000000em;
146 .PsuedoCode {
147 color: #000000;
148 font-family: 'Times-Italic', 'Times';
149 font-size: 11.00pt;
150 font-style: italic;
151 font-variant: normal;
152 font-weight: normal;
153 letter-spacing: 0;
154 line-height: 1.18;
155 margin-bottom: 0.000000em;
156 margin-left: 0em;
157 margin-right: 0.00em;
158 margin-top: 0.000000em;
159 padding-bottom: 0.000000em;
160 padding-top: 0.000000em;
161 text-align: left;
162 text-decoration: none;
163 text-indent: 0.00em;
164 text-transform: none;
165 vertical-align: 0.000000em;
168 </style>
169 </head>
170 <body>
171 """)
173 writeln("<ul>")
174 writeln("<h1>Io Core Reference Manual</h1>")
175 writeln("<div class=Version>Version " .. System version .. "</div>")
176 writeln("<h2>Prototypes</h2>")
177 writeln("<ul>")
179 protoNames := protos keys sort
181 protoNames map(k,
182 writeln("<a href=#", k, " style=\"color: #555;\">", k, "</a><br>")
185 writeln("</ul>")
187 Sequence do(
188 asHtml := method(
189 self asMutable replaceSeq(">", "&gt;") replaceSeq("<", "&lt;")
193 protoNames foreach(protoName,
194 p := protos at(protoName)
195 write("<h2>")
196 write("<a name=" .. protoName .. "><font color=black>", protoName, "</font></a>")
197 writeln("</h2>")
198 writeln("<ul style=\"width:40em\">")
200 writeln("<b><font color=#000>Protos:</font></b> ", getSlot(protoName) protos map(type) join(", "))
202 if (p at("description"),
203 writeln("<h3>Description</h3>")
204 p at("description") println
205 writeln("</font>")
208 slots := p at("slots")
209 if (slots,
210 writeln("<h3>Slot Index</h3>")
211 writeln("<div style=\"width:40em; margin-left:2em\">")
213 slotNames := slots keys sort
214 slotNames sort foreach(k,
215 s := slots at(k)
216 write("<b><a href=#" .. protoName .. "-" .. k asHtml .. " >")
217 write(k asHtml)
218 if(s ?args, write("()"))
219 writeln("</a></b><br>")
221 writeln("</div>")
223 writeln("<br>")
224 writeln("<h3>Slots</h3>")
225 //writeln("<ul>")
226 writeln("<br>")
227 slotNames foreach(k,
228 s := slots at(k)
229 write("<b>")
230 write("<a name=" .. protoName .. "-" .. k asHtml .. "><font color=black>")
231 write(k asHtml)
232 //if(s ?args, writeln("(</b><i>" .. s args map(asHtml) join(", ") .. "</i><b>)"))
233 write("</font></a></b>")
234 writeln("<p>")
235 writeln("<div style=\"width:40em; margin-left:2em\">")
236 //writeln("<font face=\"Times\">")
237 writeln(s)
238 writeln("</font>")
239 writeln("</div>")
240 writeln("<p><br>")
242 //writeln("</ul>")
245 writeln("</ul>")
246 writeln("<br>")
247 writeln("<hr align=left>")
248 writeln("<br>")
251 writeln("</ul>")
252 5 repeat(writeln("<br>"))