| as yet unclassified |
| addHeadElement: anHtmlElement
|
headElements add: anHtmlElement
|
| addScript: aString
|
(scripts includes: aString) ifFalse: [scripts add: aString]
|
| addStyle: aString
|
(styles includes: aString) ifFalse: [styles add: aString]
|
| bodyAttributes
|
^ bodyAttrs
|
| docType
|
^ docType
|
| docType: aString
|
docType _ aString
|
| headAttributes
|
^ headAttrs
|
| htmlAttributes
|
^ htmlAttrs
|
| initialize
|
htmlAttrs _ WAHtmlAttributes new.
headAttrs _ WAHtmlAttributes new.
bodyAttrs _ WAHtmlAttributes new.
headElements _ OrderedCollection new.
scripts _ OrderedCollection new.
styles _ OrderedCollection new.
docType _ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'.
title _ ''.
|
| title
|
^ title
|
| title: aString
|
title _ aString
|
| writeHeadOn: aStream
|
aStream nextPutAll: '<title>', title, '</title>'.
styles do: [:ea | self writeStyle: ea on: aStream].
scripts do: [:ea | self writeScript: ea on: aStream].
headElements do: [:ea | ea writeOn: aStream]
|
| writeOn: aStream
|
aStream nextPutAll: docType.
aStream nextPutAll: '<html'.
htmlAttrs writeOn: aStream.
aStream nextPutAll: '><head'.
headAttrs writeOn: aStream.
aStream nextPutAll: '>'.
self writeHeadOn: aStream.
aStream nextPutAll: '</head><body'.
bodyAttrs writeOn: aStream.
aStream nextPutAll: '>'.
|
| writeScript: aString on: aStream
|
aStream
nextPutAll: '<script type="text/javascript">';
nextPutAll: aString;
nextPutAll: '</script>'
|
| writeStyle: aString on: aStream
|
aStream
nextPutAll: '<style>';
nextPutAll: aString;
nextPutAll: '</style>'
|