|
Class: Encoder (in HTML)
Object
|
+--HTML::Visitor
|
+--HTML::Encoder
|
+--HTML::XHTMLEncoder
- Package:
- stx:goodies/webServer/htmlTree
- Category:
- Net-Documents-HTML-TreeBuilder
- Version:
- rev:
1.108
date: 2024/03/07 18:25:04
- user: cg
- file: HTML__Encoder.st directory: goodies/webServer/htmlTree
- module: stx stc-classLibrary: htmlTree
This encodes the HTML DOM elements as a string.
copyrightCOPYRIGHT (c) 2003 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
new
-
Create a new encoder.
Build the necessary stream.
-
on: aStream
-
Create an encoder on a stream.
accessing
-
generateCharEscapes: aBoolean
-
if true, any non-ascii chars in the output will be escaped as HTML character
entities (&#xxxx;)
if false, the output will be as is iff the output stream accepts wide chars,
or utf8-encoded if not.
-
generateCompactOutput: aBoolean
-
if true, the output is not prettyprinted;
if false, it is indented
-
htmlString
-
Return the html string.
Call this after doing a '#visit:'.
-
stream
-
Return the stream the encoder encodes on.
-
stream: aStream
-
initialization
-
initialize
-
Set the indent depth to a default.
Attention: Direct instance variable
access relies on this setting
private-accessing
-
setStream: aStream
-
Set a stream as the stream to print on.
Private - Use only for instance creation.
private-printing
-
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.
-
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.
-
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.
-
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
line.
-
printScriptElement: aScriptElement
-
A script element gets printed.
-
printStyleElement: aStyleElement
-
A style element gets printed.
private-printing-tags
-
printInline: anElement
-
An element gets printed inline.
-
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).
-
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) **
-
printTagsFor: anElement do: aBlock
-
Print both tags for an element and evaluate a block which
is printing other data between the tags.
private-queries
-
areChildrenSimpleOf: element
-
visiting
-
visitSubelement: aSubElement
-
Visit a subelement.
Care for indent and newlines
-
visitSubelement: aSubElement indent: doIndent
-
Visit a subelement.
Care for indent and newlines
-
visitSubelementsOf: anElement
-
Visit the subelements of an element.
Usage example(s):
self visitSubelementsOf:anElement indent:wantIndent.
|
-
visitSubelementsOf: anElement indent: wantIndent
-
Visit the subelements of an element.
visiting - required
-
visitComment: aComment
-
(comment from inherited method)
A comment gets visited.
-
visitElement: anElement
-
The task of this encoder is to print html code.
So print a default version of every item of the tree.
-
visitProcessingInstruction: aProcessingInstruction
-
(comment from inherited method)
A processing instruction gets visited.
-
visitString: aString
-
A string gets visited.
We like to print it onto our stream.
The stream MUST handle wide chars!
visiting-BlockLevel
-
visitDiv: aDiv
-
(comment from inherited method)
A div gets visited.
visiting-Form
-
visitOption: anOptionElement
-
(comment from inherited method)
An option gets visited.
-
visitTextArea: anInput
-
A textarea gets visited.
visiting-Head
-
visitScript: aScript
-
A script gets visited.
-
visitStyle: aStyle
-
A style element gets visited.
-
visitStyleElement: anElement
-
-
visitTitle: aTitle
-
A title element gets visited.
visiting-Inline
-
visitAnchor: anAnchor
-
(comment from inherited method)
An anchor gets visited.
-
visitArea: anArea
-
-
visitBreak: aLineBreak
-
(comment from inherited method)
A line break gets visited.
-
visitInput: anInput
-
(comment from inherited method)
An input gets visited.
-
visitObject: anInput
-
(comment from inherited method)
An object gets visited.
visiting-ListDefinition
-
visitDefinitionTerm: aTerm
-
A definition term gets visited.
visiting-Table
-
visitTableDataCell: aTableDataCell
-
(comment from inherited method)
A table data cell gets visited.
-
visitTableHeaderCell: aTableHeaderCell
-
(comment from inherited method)
A table header cell gets visited.
visiting-TopLevel
-
visitDocument: aDocument
-
A document gets visited.
Redefined to display the document type if existent.
|