[Seaside] Standalone package for WABuilder / WAHtmlCanvas ?
H. Hirzel
hannes.hirzel at gmail.com
Thu Sep 14 08:51:44 UTC 2017
Hello
Is there a ConfigurationOf ... file which loads what is needed to run
WABuilder with WAHtmlCanvas [1] stand-alone (no need other Seaside
package loaded) to generate HTML Seaside style?
If not which packages of the Seaside distribution would I need to load manually?
Recently there was a request on the Pharo list for this.
Thank you in advance.
Hannes
------------------------------------------------
[1]
WAObject subclass: #WABuilder
instanceVariableNames: 'fullDocument rootBlock rootClass
documentClass scriptGeneratorClass rendererClass codec actionUrl
resourceUrl'
classVariableNames: ''
poolDictionaries: ''
category: 'Seaside-Core-Rendering'
This is a convenience class which provides a result of a rendering
operation as a string. It is expected to be used like this:
WAHtmlCanvas builder render: [ :html |
html anchor
url: 'htttp://www.seaside.st';
with: 'Seaside Homepage' ]
..................
WABuilderCanvasTest has more examples.
testBody
| actual |
actual := WAHtmlCanvas builder render: [ :html |
html unorderedList: [
html listItem: 'an item' ] ].
self assert: actual = '<ul><li>an item</li></ul>'
testFullDocument
| actual |
actual := WAHtmlCanvas builder fullDocument: true; render: [ :html |
html unorderedList: [
html listItem: 'an item' ] ].
self assert: actual = '<html><head><title></title></head><body
onload="onLoad()"><ul><li>an item</li></ul><script
type="text/javascript">function onLoad(){};</script></body></html>'
testFullDocumentWithBlock
| actual |
actual := WAHtmlCanvas builder fullDocument: true;
rootBlock: [ :root |
root title: 'title'.
root stylesheet add: 'body{font-size:12px;}'.
root javascript add: 'alert("loaded")' ];
render: [ :html |
html unorderedList: [
html listItem: 'an item' ] ].
self assert: actual = '<html><head><title>title</title><style
type="text/css">body{font-size:12px;}</style><script
type="text/javascript">alert("loaded")</script></head><body
onload="onLoad()"><ul><li>an item</li></ul><script
type="text/javascript">function onLoad(){};</script></body></html>'
More information about the seaside
mailing list