eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTML::Encoder':



Class: Encoder (in HTML)



rev: 1.97 date: 2019/07/13 12:20:41
user: cg
file: HTML__Encoder.st directory: goodies/webServer/htmlTree
module: stx stc-classLibrary: htmlTree

Class protocol:

instance creation
o  new
Create a new encoder.
Build the necessary stream.

o  on: aStream
Create an encoder on a stream.

Instance protocol:

o  htmlString
Return the html string.
Call this after doing a '#visit:'.

o  stream
Return the stream the encoder encodes on.

o  stream: aStream

o  initialize
Set the indent depth to a default.
Attention: Direct instance variable
access relies on this setting

o  setStream: aStream
Set a stream as the stream to print on.
Private - Use only for instance creation.

o  attributeValuesPrintString: aRawObject
Print an attribute value or a list of attribute values.
aRawObject can be a string, a style object or a collection of those.

o  printAttribute: anAssociation
Print a single attribute given as an association
with key and value onto a stream.

The value sometimes can be a collection of values.

o  printAttributesOf: anElement
Print all set attributes of an
item onto the stream.

Attributes can be nil for no
attributes which is the default.

Otherwise will be key value pairs.
They are representated as 'key=value' in HTML.

o  printNewLineIndent
Print a carriage return and an indent
of length indent onto the stream,
but only if there is no inlining.

New line and indent are always printed
together. There is no newline without
indenting and no intenting witout a new

o  printScriptElement: aScriptElement
A script element gets printed.

o  printStyleElement: aStyleElement
A style element gets printed.

o  printInline: anElement
An element gets printed inline.

o  printSingle: anElement
Print an element without contents.
Do not use '<tag/>' or '<tag />', because it is not valid HTML 4.01,
(the first one is valid only in XHTML).

o  printSingle: anElement withSpace: withSpace
Print an element without contents.
Ignore withSpace, since it produces invalid HTML code.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  printTagsFor: anElement do: aBlock
Print both tags for an element and evaluate a block which
is printing other data between the tags.

o  areChildrenSimpleOf: element

o  visitSubelement: aSubElement
Visit a subelement.
Care for indent and newlines

o  visitSubelement: aSubElement indent: doIndent
Visit a subelement.
Care for indent and newlines

o  visitSubelementsOf: anElement
Visit the subelements of an element.

o  visitSubelementsOf: anElement indent: wantIndent
Visit the subelements of an element.

visiting - required
o  visitComment: aComment
(comment from inherited method)
A comment gets visited.

o  visitElement: anElement
The task of this encoder is to print html code.
So print a default version of every item of the tree.

o  visitProcessingInstruction: aProcessingInstruction
(comment from inherited method)
A processing instruction gets visited.

o  visitString: aString
A string gets visited.
We like to print it onto our stream.

o  visitDiv: aDiv
(comment from inherited method)
A div gets visited.

o  visitOption: anOptionElement

o  visitTextArea: anInput
A textarea gets visited.

o  visitScript: aScript
A script gets visited.

o  visitStyle: aStyle
A style element gets visited.

o  visitStyleElement: anElement

o  visitTitle: aTitle
A title element gets visited.

o  visitAnchor: anAnchor

o  visitArea: anArea

o  visitBreak: aLineBreak

o  visitInput: anInput

o  visitDefinitionTerm: aTerm
A definition term gets visited.

o  visitTableDataCell: aTableDataCell

o  visitTableHeaderCell: aTableHeaderCell

o  visitDocument: aDocument
A document gets visited.
Redefined to display the document type if existent.

ST/X; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sun, 27 Nov 2022 07:51:04 GMT