Documentation.deploy.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. smalltalk.addPackage('Documentation', {});
  2. smalltalk.addClass('ChapterSelectionAnnouncement', smalltalk.Object, ['id'], 'Documentation');
  3. smalltalk.addMethod(
  4. "_id",
  5. smalltalk.method({
  6. selector: "id",
  7. fn: function (){
  8. var self=this;
  9. return self['@id'];
  10. return self;}
  11. }),
  12. smalltalk.ChapterSelectionAnnouncement);
  13. smalltalk.addMethod(
  14. "_id_",
  15. smalltalk.method({
  16. selector: "id:",
  17. fn: function (aString){
  18. var self=this;
  19. (self['@id']=aString);
  20. return self;}
  21. }),
  22. smalltalk.ChapterSelectionAnnouncement);
  23. smalltalk.addClass('ClassSelectionAnnouncement', smalltalk.Object, ['theClass'], 'Documentation');
  24. smalltalk.addMethod(
  25. "_theClass",
  26. smalltalk.method({
  27. selector: "theClass",
  28. fn: function (){
  29. var self=this;
  30. return self['@theClass'];
  31. return self;}
  32. }),
  33. smalltalk.ClassSelectionAnnouncement);
  34. smalltalk.addMethod(
  35. "_theClass_",
  36. smalltalk.method({
  37. selector: "theClass:",
  38. fn: function (aClass){
  39. var self=this;
  40. (self['@theClass']=aClass);
  41. return self;}
  42. }),
  43. smalltalk.ClassSelectionAnnouncement);
  44. smalltalk.addMethod(
  45. "_on_",
  46. smalltalk.method({
  47. selector: "on:",
  48. fn: function (aClass){
  49. var self=this;
  50. return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  51. return self;}
  52. }),
  53. smalltalk.ClassSelectionAnnouncement.klass);
  54. smalltalk.addClass('DocChapter', smalltalk.Widget, ['title', 'contents', 'parent'], 'Documentation');
  55. smalltalk.addMethod(
  56. "_announcer",
  57. smalltalk.method({
  58. selector: "announcer",
  59. fn: function (){
  60. var self=this;
  61. return smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_announcer", []);
  62. return self;}
  63. }),
  64. smalltalk.DocChapter);
  65. smalltalk.addMethod(
  66. "_chapters",
  67. smalltalk.method({
  68. selector: "chapters",
  69. fn: function (){
  70. var self=this;
  71. return [];
  72. return self;}
  73. }),
  74. smalltalk.DocChapter);
  75. smalltalk.addMethod(
  76. "_contents",
  77. smalltalk.method({
  78. selector: "contents",
  79. fn: function (){
  80. var self=this;
  81. return (($receiver = self['@contents']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  82. return self;}
  83. }),
  84. smalltalk.DocChapter);
  85. smalltalk.addMethod(
  86. "_contents_",
  87. smalltalk.method({
  88. selector: "contents:",
  89. fn: function (aString){
  90. var self=this;
  91. (self['@contents']=aString);
  92. return self;}
  93. }),
  94. smalltalk.DocChapter);
  95. smalltalk.addMethod(
  96. "_cssClass",
  97. smalltalk.method({
  98. selector: "cssClass",
  99. fn: function (){
  100. var self=this;
  101. return "doc_chapter";
  102. return self;}
  103. }),
  104. smalltalk.DocChapter);
  105. smalltalk.addMethod(
  106. "_displayChapter_",
  107. smalltalk.method({
  108. selector: "displayChapter:",
  109. fn: function (aChapter){
  110. var self=this;
  111. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_widget", []), "_displayChapter_", [aChapter]);
  112. return self;}
  113. }),
  114. smalltalk.DocChapter);
  115. smalltalk.addMethod(
  116. "_htmlContents",
  117. smalltalk.method({
  118. selector: "htmlContents",
  119. fn: function (){
  120. var self=this;
  121. return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Showdown || Showdown), "_at_", [smalltalk.symbolFor("converter")]), "_new", []), "_makeHtml_", [smalltalk.send(self, "_contents", [])]);
  122. return self;}
  123. }),
  124. smalltalk.DocChapter);
  125. smalltalk.addMethod(
  126. "_id",
  127. smalltalk.method({
  128. selector: "id",
  129. fn: function (){
  130. var self=this;
  131. return smalltalk.send(smalltalk.send(self, "_title", []), "_replace_with_", [" ", "-"]);
  132. return self;}
  133. }),
  134. smalltalk.DocChapter);
  135. smalltalk.addMethod(
  136. "_initialize",
  137. smalltalk.method({
  138. selector: "initialize",
  139. fn: function (){
  140. var self=this;
  141. smalltalk.send(self, "_initialize", [], smalltalk.DocChapter.superclass || nil);
  142. smalltalk.send(self, "_subscribe", []);
  143. return self;}
  144. }),
  145. smalltalk.DocChapter);
  146. smalltalk.addMethod(
  147. "_level",
  148. smalltalk.method({
  149. selector: "level",
  150. fn: function (){
  151. var self=this;
  152. return (($receiver = smalltalk.send(self, "_parent", [])) == nil || $receiver == undefined) ? (function(){return (1);})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(self, "_parent", []), "_level", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})();
  153. return self;}
  154. }),
  155. smalltalk.DocChapter);
  156. smalltalk.addMethod(
  157. "_level_",
  158. smalltalk.method({
  159. selector: "level:",
  160. fn: function (anInteger){
  161. var self=this;
  162. (level=anInteger);
  163. return self;}
  164. }),
  165. smalltalk.DocChapter);
  166. smalltalk.addMethod(
  167. "_parent",
  168. smalltalk.method({
  169. selector: "parent",
  170. fn: function (){
  171. var self=this;
  172. return self['@parent'];
  173. return self;}
  174. }),
  175. smalltalk.DocChapter);
  176. smalltalk.addMethod(
  177. "_parent_",
  178. smalltalk.method({
  179. selector: "parent:",
  180. fn: function (aChapter){
  181. var self=this;
  182. (self['@parent']=aChapter);
  183. return self;}
  184. }),
  185. smalltalk.DocChapter);
  186. smalltalk.addMethod(
  187. "_renderDocOn_",
  188. smalltalk.method({
  189. selector: "renderDocOn:",
  190. fn: function (html){
  191. var self=this;
  192. var div=nil;
  193. smalltalk.send(smalltalk.send(html, "_h1", []), "_with_", [smalltalk.send(self, "_title", [])]);
  194. smalltalk.send(self, "_renderNavigationOn_", [html]);
  195. (div=smalltalk.send(smalltalk.send(html, "_div", []), "_class_", ["contents"]));
  196. smalltalk.send(smalltalk.send(div, "_asJQuery", []), "_html_", [smalltalk.send(self, "_htmlContents", [])]);
  197. return self;}
  198. }),
  199. smalltalk.DocChapter);
  200. smalltalk.addMethod(
  201. "_renderLinksOn_",
  202. smalltalk.method({
  203. selector: "renderLinksOn:",
  204. fn: function (html){
  205. var self=this;
  206. (function($rec){smalltalk.send($rec, "_class_", ["links"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_title", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [each]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})]);})(smalltalk.send(html, "_ul", []));
  207. return self;}
  208. }),
  209. smalltalk.DocChapter);
  210. smalltalk.addMethod(
  211. "_renderNavigationOn_",
  212. smalltalk.method({
  213. selector: "renderNavigationOn:",
  214. fn: function (html){
  215. var self=this;
  216. (($receiver = smalltalk.send(self, "_parent", [])) != nil && $receiver != undefined) ? (function(){return (function($rec){smalltalk.send($rec, "_class_", ["navigation"]);return smalltalk.send($rec, "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send("← back to ", "__comma", [smalltalk.send(smalltalk.send(self, "_parent", []), "_title", [])])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [smalltalk.send(self, "_parent", [])]);})]);})(smalltalk.send(html, "_a", []));})]);})(smalltalk.send(html, "_div", []));})() : nil;
  217. return self;}
  218. }),
  219. smalltalk.DocChapter);
  220. smalltalk.addMethod(
  221. "_renderOn_",
  222. smalltalk.method({
  223. selector: "renderOn:",
  224. fn: function (html){
  225. var self=this;
  226. (function($rec){smalltalk.send($rec, "_class_", [smalltalk.send(self, "_cssClass", [])]);return smalltalk.send($rec, "_with_", [(function(){smalltalk.send(self, "_renderDocOn_", [html]);return smalltalk.send(self, "_renderLinksOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
  227. return self;}
  228. }),
  229. smalltalk.DocChapter);
  230. smalltalk.addMethod(
  231. "_selectChapter_",
  232. smalltalk.method({
  233. selector: "selectChapter:",
  234. fn: function (aChapter){
  235. var self=this;
  236. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", [smalltalk.send(aChapter, "_id", [])]);
  237. return self;}
  238. }),
  239. smalltalk.DocChapter);
  240. smalltalk.addMethod(
  241. "_selectClass_",
  242. smalltalk.method({
  243. selector: "selectClass:",
  244. fn: function (aClass){
  245. var self=this;
  246. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.DocumentationBuilder || DocumentationBuilder), "_current", []), "_announcer", []), "_announce_", [smalltalk.send((smalltalk.ClassSelectionAnnouncement || ClassSelectionAnnouncement), "_on_", [aClass])]);
  247. return self;}
  248. }),
  249. smalltalk.DocChapter);
  250. smalltalk.addMethod(
  251. "_subscribe",
  252. smalltalk.method({
  253. selector: "subscribe",
  254. fn: function (){
  255. var self=this;
  256. smalltalk.send(smalltalk.send(self, "_announcer", []), "_on_do_", [(smalltalk.ChapterSelectionAnnouncement || ChapterSelectionAnnouncement), (function(ann){return ((($receiver = smalltalk.send(smalltalk.send(ann, "_id", []), "__eq", [smalltalk.send(self, "_id", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_displayChapter_", [self]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_displayChapter_", [self]);})]));})]);
  257. return self;}
  258. }),
  259. smalltalk.DocChapter);
  260. smalltalk.addMethod(
  261. "_title",
  262. smalltalk.method({
  263. selector: "title",
  264. fn: function (){
  265. var self=this;
  266. return (($receiver = self['@title']) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
  267. return self;}
  268. }),
  269. smalltalk.DocChapter);
  270. smalltalk.addMethod(
  271. "_title_",
  272. smalltalk.method({
  273. selector: "title:",
  274. fn: function (aString){
  275. var self=this;
  276. (self['@title']=aString);
  277. return self;}
  278. }),
  279. smalltalk.DocChapter);
  280. smalltalk.addClass('ClassDocChapter', smalltalk.DocChapter, ['theClass'], 'Documentation');
  281. smalltalk.addMethod(
  282. "_contents",
  283. smalltalk.method({
  284. selector: "contents",
  285. fn: function (){
  286. var self=this;
  287. return ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []), "_isEmpty", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []), "__comma", [" is not documented yet."]);})() : (function(){return smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []), "__comma", [" is not documented yet."]);}), (function(){return smalltalk.send(smalltalk.send(self, "_theClass", []), "_comment", []);})]));
  288. return self;}
  289. }),
  290. smalltalk.ClassDocChapter);
  291. smalltalk.addMethod(
  292. "_cssClass",
  293. smalltalk.method({
  294. selector: "cssClass",
  295. fn: function (){
  296. var self=this;
  297. return smalltalk.send("doc_class ", "__comma", [smalltalk.send(self, "_cssClass", [], smalltalk.ClassDocChapter.superclass || nil)]);
  298. return self;}
  299. }),
  300. smalltalk.ClassDocChapter);
  301. smalltalk.addMethod(
  302. "_initializeWithClass_",
  303. smalltalk.method({
  304. selector: "initializeWithClass:",
  305. fn: function (aClass){
  306. var self=this;
  307. (self['@theClass']=aClass);
  308. return self;}
  309. }),
  310. smalltalk.ClassDocChapter);
  311. smalltalk.addMethod(
  312. "_renderLinksOn_",
  313. smalltalk.method({
  314. selector: "renderLinksOn:",
  315. fn: function (html){
  316. var self=this;
  317. (function($rec){smalltalk.send($rec, "_class_", ["links"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", ["Browse this class"]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send((smalltalk.Browser || Browser), "_openOn_", [smalltalk.send(self, "_theClass", [])]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})(smalltalk.send(html, "_ul", []));
  318. return self;}
  319. }),
  320. smalltalk.ClassDocChapter);
  321. smalltalk.addMethod(
  322. "_subscribe",
  323. smalltalk.method({
  324. selector: "subscribe",
  325. fn: function (){
  326. var self=this;
  327. smalltalk.send(self, "_subscribe", [], smalltalk.ClassDocChapter.superclass || nil);
  328. smalltalk.send(smalltalk.send(self, "_announcer", []), "_on_do_", [(smalltalk.ClassSelectionAnnouncement || ClassSelectionAnnouncement), (function(ann){return ((($receiver = smalltalk.send(smalltalk.send(ann, "_theClass", []), "__eq", [smalltalk.send(self, "_theClass", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self, "_selectChapter_", [self]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self, "_selectChapter_", [self]);})]));})]);
  329. return self;}
  330. }),
  331. smalltalk.ClassDocChapter);
  332. smalltalk.addMethod(
  333. "_theClass",
  334. smalltalk.method({
  335. selector: "theClass",
  336. fn: function (){
  337. var self=this;
  338. return self['@theClass'];
  339. return self;}
  340. }),
  341. smalltalk.ClassDocChapter);
  342. smalltalk.addMethod(
  343. "_title",
  344. smalltalk.method({
  345. selector: "title",
  346. fn: function (){
  347. var self=this;
  348. return smalltalk.send(smalltalk.send(self, "_theClass", []), "_name", []);
  349. return self;}
  350. }),
  351. smalltalk.ClassDocChapter);
  352. smalltalk.addMethod(
  353. "_on_",
  354. smalltalk.method({
  355. selector: "on:",
  356. fn: function (aClass){
  357. var self=this;
  358. return (function($rec){smalltalk.send($rec, "_initializeWithClass_", [aClass]);smalltalk.send($rec, "_initialize", []);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_basicNew", []));
  359. return self;}
  360. }),
  361. smalltalk.ClassDocChapter.klass);
  362. smalltalk.addClass('ClassesIndexChapter', smalltalk.DocChapter, [], 'Documentation');
  363. smalltalk.addMethod(
  364. "_alphabet",
  365. smalltalk.method({
  366. selector: "alphabet",
  367. fn: function (){
  368. var self=this;
  369. return "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  370. return self;}
  371. }),
  372. smalltalk.ClassesIndexChapter);
  373. smalltalk.addMethod(
  374. "_cssClass",
  375. smalltalk.method({
  376. selector: "cssClass",
  377. fn: function (){
  378. var self=this;
  379. return smalltalk.send("index_doc ", "__comma", [smalltalk.send(self, "_cssClass", [], smalltalk.ClassesIndexChapter.superclass || nil)]);
  380. return self;}
  381. }),
  382. smalltalk.ClassesIndexChapter);
  383. smalltalk.addMethod(
  384. "_renderDocOn_",
  385. smalltalk.method({
  386. selector: "renderDocOn:",
  387. fn: function (html){
  388. var self=this;
  389. smalltalk.send(smalltalk.send(html, "_h1", []), "_with_", [smalltalk.send(self, "_title", [])]);
  390. smalltalk.send(smalltalk.send(self, "_alphabet", []), "_do_", [(function(letter){var classes=nil;
  391. (classes=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_classes", []), "_select_", [(function(each){return smalltalk.send(smalltalk.send(smalltalk.send(each, "_name", []), "_first", []), "__eq", [letter]);})]));smalltalk.send(classes, "_ifNotEmpty_", [(function(){return smalltalk.send(smalltalk.send(html, "_h2", []), "_with_", [letter]);})]);return smalltalk.send(smalltalk.send(html, "_ul", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(classes, "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_name", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_name", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_name", [])]));})]), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(each, "_name", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectClass_", [each]);})]);})(smalltalk.send(html, "_a", []));})]);})]);})]);})]);
  392. return self;}
  393. }),
  394. smalltalk.ClassesIndexChapter);
  395. smalltalk.addMethod(
  396. "_title",
  397. smalltalk.method({
  398. selector: "title",
  399. fn: function (){
  400. var self=this;
  401. return "Smalltalk classes by index";
  402. return self;}
  403. }),
  404. smalltalk.ClassesIndexChapter);
  405. smalltalk.addClass('PackageDocChapter', smalltalk.DocChapter, ['package', 'chapters'], 'Documentation');
  406. smalltalk.addMethod(
  407. "_chapters",
  408. smalltalk.method({
  409. selector: "chapters",
  410. fn: function (){
  411. var self=this;
  412. return self['@chapters'];
  413. return self;}
  414. }),
  415. smalltalk.PackageDocChapter);
  416. smalltalk.addMethod(
  417. "_contents",
  418. smalltalk.method({
  419. selector: "contents",
  420. fn: function (){
  421. var self=this;
  422. return smalltalk.send(smalltalk.send("Classes in package ", "__comma", [smalltalk.send(smalltalk.send(self, "_package", []), "_name", [])]), "__comma", [":"]);
  423. return self;}
  424. }),
  425. smalltalk.PackageDocChapter);
  426. smalltalk.addMethod(
  427. "_initializeWithPackage_",
  428. smalltalk.method({
  429. selector: "initializeWithPackage:",
  430. fn: function (aPackage){
  431. var self=this;
  432. (self['@package']=aPackage);
  433. (self['@chapters']=smalltalk.send(smalltalk.send(smalltalk.send(aPackage, "_classes", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_name", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_name", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_name", [])]));})]), "_collect_", [(function(each){return (function($rec){smalltalk.send($rec, "_parent_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassDocChapter || ClassDocChapter), "_on_", [each]));})]));
  434. return self;}
  435. }),
  436. smalltalk.PackageDocChapter);
  437. smalltalk.addMethod(
  438. "_package",
  439. smalltalk.method({
  440. selector: "package",
  441. fn: function (){
  442. var self=this;
  443. return self['@package'];
  444. return self;}
  445. }),
  446. smalltalk.PackageDocChapter);
  447. smalltalk.addMethod(
  448. "_title",
  449. smalltalk.method({
  450. selector: "title",
  451. fn: function (){
  452. var self=this;
  453. return smalltalk.send("Package ", "__comma", [smalltalk.send(smalltalk.send(self, "_package", []), "_name", [])]);
  454. return self;}
  455. }),
  456. smalltalk.PackageDocChapter);
  457. smalltalk.addMethod(
  458. "_on_",
  459. smalltalk.method({
  460. selector: "on:",
  461. fn: function (aPackage){
  462. var self=this;
  463. return (function($rec){smalltalk.send($rec, "_initializeWithPackage_", [aPackage]);smalltalk.send($rec, "_initialize", []);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_basicNew", []));
  464. return self;}
  465. }),
  466. smalltalk.PackageDocChapter.klass);
  467. smalltalk.addClass('TutorialsChapter', smalltalk.DocChapter, [], 'Documentation');
  468. smalltalk.addMethod(
  469. "_chapters",
  470. smalltalk.method({
  471. selector: "chapters",
  472. fn: function (){
  473. var self=this;
  474. return [smalltalk.send(self, "_firstAppChapter", []),smalltalk.send(self, "_counterChapter", [])];
  475. return self;}
  476. }),
  477. smalltalk.TutorialsChapter);
  478. smalltalk.addMethod(
  479. "_contents",
  480. smalltalk.method({
  481. selector: "contents",
  482. fn: function (){
  483. var self=this;
  484. return "Here's a serie of tutorials. If you are new to Smalltalk, you can also learn Amber online with [ProfStef](http://www.amber-lang.net/learn.html)";
  485. return self;}
  486. }),
  487. smalltalk.TutorialsChapter);
  488. smalltalk.addMethod(
  489. "_counterChapter",
  490. smalltalk.method({
  491. selector: "counterChapter",
  492. fn: function (){
  493. var self=this;
  494. return (function($rec){smalltalk.send($rec, "_title_", ["The counter application"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0aThis tutorial will teach you how to build HTML with Amber using jQuery and the HTMLCanvas API. It is freely adapted from \x0athe [Seaside counter example](http://www.seaside.st/about/examples/counter)\x0a\x0a##The counter widget\x0a\x0aThe counter is the most basic example of a widget. It allows to increment and decrement a number by clicking a button.\x0a\x0aAmber already comes with a counter example in the `Examples` package. To avoid class name conflict, we'll name our counter class `TCounter`.\x0a\x0a Widget subclass: #TCounter\x0a instanceVariableNames: 'count header'\x0a package: 'Tutorials'\x0a\x0aThe first method is used to initialize the component with the default state, in this case we set the counter to 0:\x0a\x0a initialize\x0a super initialize.\x0a count := 0\x0a\x0aThe method used for rendering a widget is `#renderOn:`. It takes an instance of HTMLCanvas as parameter. \x0aThe `header` h1 kept as an instance variable, so when the count value change, we can update it's contents accordingly.\x0a\x0a renderOn: html\x0a header := html h1 \x0a with: count asString;\x0a yourself.\x0a html button\x0a with: '++';\x0a onClick: [self increase].\x0a html button\x0a with: '--';\x0a onClick: [self decrease]\x0a\x0aThe counter is almost ready. All we need now is to implement the two action methods `#increase` and `#decrease` to change the state \x0aof our counter and update its header.\x0a\x0a increase\x0a count := count + 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a decrease\x0a count := count - 1.\x0a header contents: [:html | html with: count asString]\x0a\x0a\x0aThat's it! We can now display an instance of TCounter by rendering it on the page using jQuery:\x0a\x0a TCounter new appendToJQuery: 'body' asJQuery\x0a\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  495. return self;}
  496. }),
  497. smalltalk.TutorialsChapter);
  498. smalltalk.addMethod(
  499. "_firstAppChapter",
  500. smalltalk.method({
  501. selector: "firstAppChapter",
  502. fn: function (){
  503. var self=this;
  504. return (function($rec){smalltalk.send($rec, "_title_", ["A first application"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0aLet's make Hello World in Amber.\x0a\x0aFirst, you need a place for your new project. I made a new directory under amber:\x0a\x0a amber/projects/hello\x0a\x0aThis will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.\x0a\x0aYour index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:\x0a\x0a\x0a <!DOCTYPE html>\x0a <html>\x0a <head>\x0a <title>My First Amber Project</title>\x0a <script src=\x22../../js/amber.js\x22 type=\x22text/javascript\x22></script>\x0a <script type=\x22text/javascript\x22>\x0a loadAmber({\x0a files: [],\x0a prefix: 'projects/hello/js',\x0a ready: function() {\x0a \x0a }}); \x0a </script>\x0a </head>\x0a <body>\x0a <article>\x0a <h1>My First Amber Project</h1>\x0a <button onclick=\x22smalltalk.Browser._open()\x22>class browser</button>\x0a <button id=\x22sayHello\x22>say hello</button>\x0a </article>\x0a </body>\x0a </html>\x0a\x0aNow start up amber with node.js and navigate to http://localhost:4000/projects/hello/index.html\x0a\x0aIt's boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. \x0aThen click save. This creates a new class and leaves the old one intact, it doesn't overwrite it. Your class will look like this:\x0a\x0a Object subclass: #Hello\x0a instanceVariableNames: ''\x0a package: 'HelloApp'\x0a\x0aNow click save and navigate to your new class in its new package.\x0a Then click 'commit package'. You just created a new class and saved your work. \x0aOn your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.\x0a\x0aNow, refresh your browser page and reopen the class browser. Oh no, your new class is gone! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:\x0a\x0a\x0a loadAmber({\x0a files: ['HelloApp.js'],\x0a prefix: 'projects/hello/js',\x0a ready: function() { \x0a }}); \x0a\x0aSave and refresh again. Now your class is loaded and shows up in the class browser.\x0a\x0aNow, let's make this class do something. Create a new message in the class browser by navigating to your class, then clicking 'not yet classified' and fill in a simple message. Try this for example:\x0a\x0a begin\x0a\x09\x22Makes me say hello to the user.\x22\x0a\x0a\x09| msg button |\x0a\x09msg := 'Hello world!'.\x0a\x09button := '#sayHello' asJQuery.\x0a\x09button click: [button after: '<p>' , msg , '</p>'].\x0a\x0aYour message isn't too helpful if it doesn't get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:\x0a\x0a loadAmber({\x0a files: ['HelloApp.js'],\x0a prefix: 'projects/hello/js', // path for js files i think\x0a ready: function() {\x0a $(function() {\x0a smalltalk.Hello._new()._begin();\x0a });\x0a }}); \x0a\x0aFrom there, you can create new Smalltalk classes and messages to build up your app. Enjoy!\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  505. return self;}
  506. }),
  507. smalltalk.TutorialsChapter);
  508. smalltalk.addMethod(
  509. "_title",
  510. smalltalk.method({
  511. selector: "title",
  512. fn: function (){
  513. var self=this;
  514. return "Tutorials";
  515. return self;}
  516. }),
  517. smalltalk.TutorialsChapter);
  518. smalltalk.addClass('DocumentationBuilder', smalltalk.Object, ['chapters', 'announcer', 'widget'], 'Documentation');
  519. smalltalk.addMethod(
  520. "_announcer",
  521. smalltalk.method({
  522. selector: "announcer",
  523. fn: function (){
  524. var self=this;
  525. return (($receiver = self['@announcer']) == nil || $receiver == undefined) ? (function(){return (self['@announcer']=smalltalk.send((smalltalk.Announcer || Announcer), "_new", []));})() : $receiver;
  526. return self;}
  527. }),
  528. smalltalk.DocumentationBuilder);
  529. smalltalk.addMethod(
  530. "_build",
  531. smalltalk.method({
  532. selector: "build",
  533. fn: function (){
  534. var self=this;
  535. smalltalk.send(self, "_buildOnJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
  536. return self;}
  537. }),
  538. smalltalk.DocumentationBuilder);
  539. smalltalk.addMethod(
  540. "_buildChapters",
  541. smalltalk.method({
  542. selector: "buildChapters",
  543. fn: function (){
  544. var self=this;
  545. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_methodDictionary", []), "_values", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(a, "_selector", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(b, "_selector", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(b, "_selector", [])]));})]), "_select_", [(function(each){return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", ["chapters"]);})]), "_collect_", [(function(each){return smalltalk.send(self, "_perform_", [smalltalk.send(each, "_selector", [])]);})]);
  546. return self;}
  547. }),
  548. smalltalk.DocumentationBuilder);
  549. smalltalk.addMethod(
  550. "_buildOn_",
  551. smalltalk.method({
  552. selector: "buildOn:",
  553. fn: function (aCanvas){
  554. var self=this;
  555. smalltalk.send(aCanvas, "_with_", [smalltalk.send(self, "_widget", [])]);
  556. (function($rec){smalltalk.send($rec, "_checkHashChange", []);return smalltalk.send($rec, "_checkHash", []);})(self);
  557. return self;}
  558. }),
  559. smalltalk.DocumentationBuilder);
  560. smalltalk.addMethod(
  561. "_buildOnJQuery_",
  562. smalltalk.method({
  563. selector: "buildOnJQuery:",
  564. fn: function (aJQuery){
  565. var self=this;
  566. smalltalk.send(self, "_buildOn_", [smalltalk.send((smalltalk.HTMLCanvas || HTMLCanvas), "_onJQuery_", [aJQuery])]);
  567. return self;}
  568. }),
  569. smalltalk.DocumentationBuilder);
  570. smalltalk.addMethod(
  571. "_ch1introduction",
  572. smalltalk.method({
  573. selector: "ch1introduction",
  574. fn: function (){
  575. var self=this;
  576. return (function($rec){smalltalk.send($rec, "_title_", ["Introduction"]);return smalltalk.send($rec, "_contents_", ["\x0a\x0a##Amber Smalltalk in a nutshell\x0a\x0aAmber is an implementation of the Smalltalk-80 language. It is designed to make client-side web development **faster, easier and more fun** as it allows developers to write HTML5 applications in a live Smalltalk environment!\x0a\x0aAmber is written in itself, including the IDE and the compiler and it runs **directly inside your browser**. The IDE is fairly complete with a class browser, workspace, transcript, unit test runner, object inspectors, cross reference tools and even a debugger.\x0a\x0aNoteworthy features:\x0a\x0a- Amber is semantically and syntactically very close to [Pharo Smalltalk](http://www.pharo-project.org). Pharo is considered the reference implementation.\x0a- Amber **seamlessly interacts with JavaScript** and can use its full eco system of libraries without any glue code needed.\x0a- Amber **has no dependencies** and can be used in any JavaScript runtime, not only inside browsers. An important example is [Node.js](http://nodejs.org).\x0a- Amber is a live Smalltalk that **compiles incrementally into efficient JavaScript** often mapping one-to-one with JavaScript equivalents.\x0a- Amber has a **Seaside influenced canvas library** to dynamically generate HTML.\x0a\x0a## Arguments for using Amber\x0aIn our humble opinion the main arguments for using Amber are:\x0a\x0a- JavaScript is quite a broken language with lots of traps and odd quirks. It is the assembler of the Internet which is cool, but we don't want to write in it.\x0a- Smalltalk as a language is immensely cleaner and more mature, both syntactically and semantically.\x0a- Smalltalk has a simple class model with a lightweight syntax for closures, it is in many ways a perfect match for the Good Parts of JavaScript.\x0a- Having a true live interactive incremental development environment where you can build your application directly in the browser is unbeatable.\x0a\x0a## Disclaimer\x0a\x0aThis documentation doesn't aim to teach Smalltalk. \x0aKnowledge of Smalltalk is needed to understand the topics covered in this documentation. \x0aIf you want to learn the Smalltalk language, you can read the excellent [Pharo By Example](http://www.pharobyexample.org) book.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  577. return self;}
  578. }),
  579. smalltalk.DocumentationBuilder);
  580. smalltalk.addMethod(
  581. "_ch2differencesWithOtherSmalltalks",
  582. smalltalk.method({
  583. selector: "ch2differencesWithOtherSmalltalks",
  584. fn: function (){
  585. var self=this;
  586. return (function($rec){smalltalk.send($rec, "_title_", ["Differences with other Smalltalks"]);return smalltalk.send($rec, "_contents_", ["\x0aAmber has some differences with other Smalltalk implementations. This makes porting code a non-trivial thing, but still quite manageable.\x0aBecause it maps Smalltalk constructs one-to-one with the JavaScript equivalent, including Smalltalk classes to JavaScript constructors, the core class library is simplified compared to Pharo Smalltalk.\x0aAnd since we want Amber to be useful in building lean browser apps we can't let it bloat too much.\x0a\x0aBut apart from missing things other Smalltalks may have, there are also things that are plain different:\x0a\x0a- The collection class hierarchy is much simpler compared to most Smalltalk implementations. In part this is because we want to map reasonably well with JavaScript counter parts.\x0a- As of today, there is no SortedCollection. The size of arrays is dynamic, and they behave like an ordered collection. They can also be sorted with the `#sort*` methods.\x0a- The `Date` class behaves like the `Date` and `TimeStamp` classes in Pharo Smalltalk. Therefore both `Date today` and `Date now` are valid in Amber.\x0a- Amber does not have class Character, but `String` does implement some of Character behavior so a single character String can work as a Character.\x0a- Amber does support **class instance variables**, but not class variables.\x0a- Amber only has global classes and packages, but not arbitrary objects. Use classes instead like `Smalltalk current` instead of `Smalltalk` etc.\x0a- Amber does not support pool dictionaries.\x0a- Amber uses **< ...javascript code... >** to inline JavaScript code and does not have pragmas.\x0a- Amber does not have class categories. The left side in the browser lists real Packages, but they feel much the same.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  587. return self;}
  588. }),
  589. smalltalk.DocumentationBuilder);
  590. smalltalk.addMethod(
  591. "_ch3GettingStarted",
  592. smalltalk.method({
  593. selector: "ch3GettingStarted",
  594. fn: function (){
  595. var self=this;
  596. return (function($rec){smalltalk.send($rec, "_title_", ["Getting started"]);return smalltalk.send($rec, "_contents_", ["\x0aTo get started hacking in Amber you can basically take three routes, independent of your platform:\x0a\x0a1. Just **try it out directly** at [www.amber-lang.net](http://www.amber-lang.net) - click the **Class browser** button there. But you will **not be able to save any code you write**! \x0a Still, it works fine for looking at the IDE and playing around. Just **don't press F5/reload** - it will lose any code you have written.\x0a2. Download an Amber zip-ball, install [Nodejs](http://www.nodejs.org), fire up the Amber server and then open Amber from localhost - then you **can save code**. Detailed instructions are below!\x0a3. Same as above but install git first and get a proper clone from [http://github.com/NicolasPetton/amber](http://github.com/NicolasPetton/amber) instead of a zip/tar-ball. \x0a If you want to **contribute to Amber itself** this is really what you want to do. In fact, in most cases this is what you want to do. It requires installing git first, but it is quite simple - although we leave this bit as an \x22exercise to the reader\x22 :)\x0a\x0a**PLEASE NOTE:** Amber core developers use Linux. \x0aWe do not want to introduce dependencies that aren't cross platform - but currently amberc (the command line compiler) is a bash script and we also use Makefiles \x0a(for building Amber itself and server side examples) written on Linux/Unix. So using Windows is currently a bit limited - you can't run \x22make\x22 in the .st directory to rebuild whole of Amber for example.\x0a BUT... if you only want to use Amber to build web client apps and not really get involved in hacking Amber itself - then you should be fine!\x0a\x0a## Downloading Amber\x0aCurrently you can download in zip or tar-ball format, either cutting edge or a release. [Downloads are available here](https://github.com/NicolasPetton/amber/archives/amber). \x0a\x0aUnpack wherever you like, but I would rename the directory that is unpacked to something slightly shorter - like say \x22amber\x22. :)\x0aAnd yes, at this point you can double click the index.html file in the amber directory to get the IDE up, but again, **you will not be able to save code**. So please continue below :)\x0a\x0a## Installing Node.js\x0a[Node](http://www.nodejs.org) (for short) is simply the V8 Javascript VM from Google (used in Chrome) hooked together with some hard core C-libraries for doing \x22evented I/O\x22.\x0aBasically it's JavaScript for the server - on asynch steroids. Amber runs fine in Node and we use it for several Amber tools, like amberc (the command line Amber compiler) or the Amber server (see below). \x0aThere are also several Amber-Node examples to look at if you want to play with running Amber programs server side. **In short - you really want to install Nodejs. :)**\x0a\x0a- Installing Node on Linux can be done using your package tool of choice (`apt-get install nodejs` for example) or any other way described at [the download page](http://nodejs.org/#download).\x0a- Installing Node on MacOS or Windows is probably done best by using the [installers available at Nodejs.org](http://nodejs.org/#download).\x0a\x0a## Starting Amber server\x0aNicolas has written a minimal webDAV server that is the easiest way to get up and running Amber with the ability to save code. This little server is written in... Amber! \x0aAnd it runs on top of Node. So to start it up serving your brand new directory tree of sweet Amber you do:\x0a\x0a\x09cd amber\x09(or whatever you called the directory you unpackaged)\x0a\x09./bin/server\x09(in windows you type `node server\x5cserver.js` instead)\x0a\x0aIt should say it is listening on port 4000. If it does, hooray! That means both Node and Amber are good. In Windows you might get a question about opening that port in the local firewall - yep, do it!\x0a\x0a## Firing up Amber\x0aThe Amber IDE is written in... Amber. It uses [jQuery](http://jquery.com) and runs right in your browser as a ... well, a web page. \x0aWe could open it up just using a file url - but the reason we performed the previous steps is so that we can load the IDE web page from a server that can handle PUTs (webDAV) of source code. \x0aAccording to web security Amber can only do PUT back to the same server it was loaded from. Thus we instead want to open it [through our little server now listening on port 4000](http://localhost:4000/index.html).\x0aClicking that link and then pressing the **Class browser** should get your Amber IDE running with the ability to commit modified packages locally.\x0a\x0aTo verify that you can indeed commit now - just select a Package in the browser, like say \x22Examples\x22 and press the **Commit** button below. **If all goes well nothing happens :)**. \x0aSo in order to really know if it worked we can check the modified date on the files **amber/st/Examples.st**, **amber/js/Examples.js** and **amber/js/Examples.deploy.js** - they should be brand new.\x0a\x0aNOTE: We can use any webDAV server and Apache2 has been used earlier and works fine. But the Amber server is smaller and simpler to start.\x0a"]);})(smalltalk.send((smalltalk.DocChapter || DocChapter), "_new", []));
  597. return self;}
  598. }),
  599. smalltalk.DocumentationBuilder);
  600. smalltalk.addMethod(
  601. "_ch4Tutorials",
  602. smalltalk.method({
  603. selector: "ch4Tutorials",
  604. fn: function (){
  605. var self=this;
  606. return smalltalk.send((smalltalk.TutorialsChapter || TutorialsChapter), "_new", []);
  607. return self;}
  608. }),
  609. smalltalk.DocumentationBuilder);
  610. smalltalk.addMethod(
  611. "_ch5Index",
  612. smalltalk.method({
  613. selector: "ch5Index",
  614. fn: function (){
  615. var self=this;
  616. return smalltalk.send((smalltalk.ClassesIndexChapter || ClassesIndexChapter), "_new", []);
  617. return self;}
  618. }),
  619. smalltalk.DocumentationBuilder);
  620. smalltalk.addMethod(
  621. "_ch6KernelObjects",
  622. smalltalk.method({
  623. selector: "ch6KernelObjects",
  624. fn: function (){
  625. var self=this;
  626. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Objects"])]);
  627. return self;}
  628. }),
  629. smalltalk.DocumentationBuilder);
  630. smalltalk.addMethod(
  631. "_ch7KernelClasses",
  632. smalltalk.method({
  633. selector: "ch7KernelClasses",
  634. fn: function (){
  635. var self=this;
  636. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Classes"])]);
  637. return self;}
  638. }),
  639. smalltalk.DocumentationBuilder);
  640. smalltalk.addMethod(
  641. "_ch8KernelCollection",
  642. smalltalk.method({
  643. selector: "ch8KernelCollection",
  644. fn: function (){
  645. var self=this;
  646. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Collections"])]);
  647. return self;}
  648. }),
  649. smalltalk.DocumentationBuilder);
  650. smalltalk.addMethod(
  651. "_ch9KernelMethods",
  652. smalltalk.method({
  653. selector: "ch9KernelMethods",
  654. fn: function (){
  655. var self=this;
  656. return smalltalk.send((smalltalk.PackageDocChapter || PackageDocChapter), "_on_", [smalltalk.send((smalltalk.Package || Package), "_named_", ["Kernel-Methods"])]);
  657. return self;}
  658. }),
  659. smalltalk.DocumentationBuilder);
  660. smalltalk.addMethod(
  661. "_chapters",
  662. smalltalk.method({
  663. selector: "chapters",
  664. fn: function (){
  665. var self=this;
  666. return (($receiver = self['@chapters']) == nil || $receiver == undefined) ? (function(){return (self['@chapters']=smalltalk.send(self, "_buildChapters", []));})() : $receiver;
  667. return self;}
  668. }),
  669. smalltalk.DocumentationBuilder);
  670. smalltalk.addMethod(
  671. "_checkHash",
  672. smalltalk.method({
  673. selector: "checkHash",
  674. fn: function (){
  675. var self=this;
  676. var hash=nil;
  677. var presentation=nil;
  678. (hash=smalltalk.send(smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", []), "_replace_with_", ["^#", ""]));
  679. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [(function($rec){smalltalk.send($rec, "_id_", [hash]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ChapterSelectionAnnouncement || ChapterSelectionAnnouncement), "_new", []))]);
  680. return self;}
  681. }),
  682. smalltalk.DocumentationBuilder);
  683. smalltalk.addMethod(
  684. "_checkHashChange",
  685. smalltalk.method({
  686. selector: "checkHashChange",
  687. fn: function (){
  688. var self=this;
  689. smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [(typeof window == 'undefined' ? nil : window)]), "_bind_do_", ["hashchange", (function(){return smalltalk.send(self, "_checkHash", []);})]);
  690. return self;}
  691. }),
  692. smalltalk.DocumentationBuilder);
  693. smalltalk.addMethod(
  694. "_update",
  695. smalltalk.method({
  696. selector: "update",
  697. fn: function (){
  698. var self=this;
  699. (self['@chapters']=nil);
  700. (self['@announcer']=nil);
  701. (self['@widget']=nil);
  702. smalltalk.send(smalltalk.send((typeof window == 'undefined' ? nil : window), "_jQuery_", [".documentation"]), "_remove", []);
  703. smalltalk.send(self, "_build", []);
  704. return self;}
  705. }),
  706. smalltalk.DocumentationBuilder);
  707. smalltalk.addMethod(
  708. "_widget",
  709. smalltalk.method({
  710. selector: "widget",
  711. fn: function (){
  712. var self=this;
  713. return (($receiver = self['@widget']) == nil || $receiver == undefined) ? (function(){return (self['@widget']=smalltalk.send((smalltalk.DocumentationWidget || DocumentationWidget), "_on_", [self]));})() : $receiver;
  714. return self;}
  715. }),
  716. smalltalk.DocumentationBuilder);
  717. smalltalk.DocumentationBuilder.klass.iVarNames = ['current'];
  718. smalltalk.addMethod(
  719. "_current",
  720. smalltalk.method({
  721. selector: "current",
  722. fn: function (){
  723. var self=this;
  724. return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return (self['@current']=smalltalk.send(self, "_new", []));})() : $receiver;
  725. return self;}
  726. }),
  727. smalltalk.DocumentationBuilder.klass);
  728. smalltalk.addMethod(
  729. "_initialize",
  730. smalltalk.method({
  731. selector: "initialize",
  732. fn: function (){
  733. var self=this;
  734. smalltalk.send(smalltalk.send(self, "_current", []), "_build", []);
  735. return self;}
  736. }),
  737. smalltalk.DocumentationBuilder.klass);
  738. smalltalk.addClass('DocumentationWidget', smalltalk.Widget, ['builder', 'selectedChapter', 'chapterDiv'], 'Documentation');
  739. smalltalk.addMethod(
  740. "_builder",
  741. smalltalk.method({
  742. selector: "builder",
  743. fn: function (){
  744. var self=this;
  745. return self['@builder'];
  746. return self;}
  747. }),
  748. smalltalk.DocumentationWidget);
  749. smalltalk.addMethod(
  750. "_builder_",
  751. smalltalk.method({
  752. selector: "builder:",
  753. fn: function (aDocumentationBuilder){
  754. var self=this;
  755. (self['@builder']=aDocumentationBuilder);
  756. return self;}
  757. }),
  758. smalltalk.DocumentationWidget);
  759. smalltalk.addMethod(
  760. "_chapters",
  761. smalltalk.method({
  762. selector: "chapters",
  763. fn: function (){
  764. var self=this;
  765. return smalltalk.send(smalltalk.send(self, "_builder", []), "_chapters", []);
  766. return self;}
  767. }),
  768. smalltalk.DocumentationWidget);
  769. smalltalk.addMethod(
  770. "_displayChapter_",
  771. smalltalk.method({
  772. selector: "displayChapter:",
  773. fn: function (aChapter){
  774. var self=this;
  775. smalltalk.send(self, "_selectedChapter_", [aChapter]);
  776. smalltalk.send(self, "_updateChapterDiv", []);
  777. return self;}
  778. }),
  779. smalltalk.DocumentationWidget);
  780. smalltalk.addMethod(
  781. "_renderChapterMenu_on_",
  782. smalltalk.method({
  783. selector: "renderChapterMenu:on:",
  784. fn: function (aChapter, html){
  785. var self=this;
  786. (function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(aChapter, "_title", [])]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_selectChapter_", [aChapter]);})]);})(smalltalk.send(html, "_a", []));
  787. smalltalk.send(smalltalk.send(html, "_ol", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(aChapter, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return smalltalk.send(self, "_renderChapterMenu_on_", [each, html]);})]);})]);})]);
  788. return self;}
  789. }),
  790. smalltalk.DocumentationWidget);
  791. smalltalk.addMethod(
  792. "_renderMenuOn_",
  793. smalltalk.method({
  794. selector: "renderMenuOn:",
  795. fn: function (html){
  796. var self=this;
  797. (function($rec){smalltalk.send($rec, "_class_", ["menu"]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(html, "_ol", []), "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_chapters", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(html, "_li", []), "_with_", [(function(){return smalltalk.send(self, "_renderChapterMenu_on_", [each, html]);})]);})]);})]);})]);})(smalltalk.send(html, "_div", []));
  798. return self;}
  799. }),
  800. smalltalk.DocumentationWidget);
  801. smalltalk.addMethod(
  802. "_renderOn_",
  803. smalltalk.method({
  804. selector: "renderOn:",
  805. fn: function (html){
  806. var self=this;
  807. (function($rec){smalltalk.send($rec, "_class_", ["documentation"]);return smalltalk.send($rec, "_with_", [(function(){smalltalk.send(self, "_renderMenuOn_", [html]);(self['@chapterDiv']=smalltalk.send(html, "_div", []));return smalltalk.send(self, "_updateChapterDiv", []);})]);})(smalltalk.send(html, "_div", []));
  808. return self;}
  809. }),
  810. smalltalk.DocumentationWidget);
  811. smalltalk.addMethod(
  812. "_selectChapter_",
  813. smalltalk.method({
  814. selector: "selectChapter:",
  815. fn: function (aChapter){
  816. var self=this;
  817. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", [smalltalk.send(aChapter, "_id", [])]);
  818. return self;}
  819. }),
  820. smalltalk.DocumentationWidget);
  821. smalltalk.addMethod(
  822. "_selectedChapter",
  823. smalltalk.method({
  824. selector: "selectedChapter",
  825. fn: function (){
  826. var self=this;
  827. return (($receiver = self['@selectedChapter']) == nil || $receiver == undefined) ? (function(){return (self['@selectedChapter']=smalltalk.send(smalltalk.send(self, "_chapters", []), "_first", []));})() : $receiver;
  828. return self;}
  829. }),
  830. smalltalk.DocumentationWidget);
  831. smalltalk.addMethod(
  832. "_selectedChapter_",
  833. smalltalk.method({
  834. selector: "selectedChapter:",
  835. fn: function (aChapter){
  836. var self=this;
  837. return (self['@selectedChapter']=aChapter);
  838. return self;}
  839. }),
  840. smalltalk.DocumentationWidget);
  841. smalltalk.addMethod(
  842. "_updateChapterDiv",
  843. smalltalk.method({
  844. selector: "updateChapterDiv",
  845. fn: function (){
  846. var self=this;
  847. smalltalk.send(self['@chapterDiv'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self, "_selectedChapter", [])]);})]);
  848. return self;}
  849. }),
  850. smalltalk.DocumentationWidget);
  851. smalltalk.addMethod(
  852. "_on_",
  853. smalltalk.method({
  854. selector: "on:",
  855. fn: function (aBuilder){
  856. var self=this;
  857. return (function($rec){smalltalk.send($rec, "_builder_", [aBuilder]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  858. return self;}
  859. }),
  860. smalltalk.DocumentationWidget.klass);