|
@@ -36,7 +36,9 @@ The main message there is ``<<``, the high-level message to put an object on a s
|
|
|
|
|
|
With
|
|
|
|
|
|
- Silk new << 'Hello, world!'
|
|
|
+```smalltalk
|
|
|
+Silk new << 'Hello, world!'
|
|
|
+```
|
|
|
|
|
|
you append a text node to the body.
|
|
|
|
|
@@ -44,17 +46,21 @@ Silk uses the browser support for ``querySelector`` to get to the elements - tha
|
|
|
|
|
|
For example with
|
|
|
|
|
|
- '#log' asSilk << 'another item'
|
|
|
+```smalltalk
|
|
|
+'#log' asSilk << 'another item'
|
|
|
+```
|
|
|
|
|
|
you append the text ``another item`` to the element with id ``#log``.
|
|
|
|
|
|
Silk uses DNU (Smalltalk ``does not understand``) to help you to create HTML elements, and uses associations as a way to set attributes. So you do:
|
|
|
|
|
|
- Silk new
|
|
|
- H1: {'id'->'header'. 'Welcome'};
|
|
|
- P: {'id'->'welcome'. 'This is an acme page.'. 'It was created by Silk'};
|
|
|
- HR;
|
|
|
- SMALL: {'id'->'footer'. 'We do not guarantee anything.'}
|
|
|
+```smalltalk
|
|
|
+Silk new
|
|
|
+ H1: {'id'->'header'. 'Welcome'};
|
|
|
+ P: {'id'->'welcome'. 'This is an acme page.'. 'It was created by Silk'};
|
|
|
+ HR;
|
|
|
+ SMALL: {'id'->'footer'. 'We do not guarantee anything.'}
|
|
|
+```
|
|
|
|
|
|
BTW, `foo H1: bar` is just a convenience for `foo H1 << bar; yourself`.
|
|
|
|