|
Class: STTTemplate (in Comanche)
Object
|
+--Comanche::STTTemplate
- Package:
- stx:goodies/webServer/comanche/stt
- Category:
- Comanche-STT
- Version:
- rev:
1.27
date: 2004/09/16 13:07:47
- user: ca
- file: STTTemplate.st directory: goodies/webServer/comanche/stt
- module: stx stc-classLibrary: stt
- Author:
- Federico Gregorio Stilman
STT (Smalltalk Templates) support.
Enables embedding Smalltalk code in HTML and other documents too.
I'm a Smalltalk Template.
My escaping sequence for embedding Smalltalk expressions is: {% %} or {%= %}.
CG:
I changed these to <?stt ... ?>
and <?stt= ... ?>
[Date:]
7 July 2002
defaults
-
defaultAsStringSelector
-
instance creation
-
on: aString
-
Creates an instance of the receiver on aString
-
on: aString asStringSelector: aSymbol
-
Creates an instance of the receiver on aString
accessing
-
asStringSelector
-
Returns the selector used to show objects as Strings on the receiver
-
asStringSelector: aSymbol
-
Sets the selector used to show objects as Strings on the receiver
-
sttCode
-
Returns the receiver's Smalltalk Template code
caching
-
cache
-
Returns the receiver's cached object
-
cache: anObject
-
Save anObject in the receiver's cache
-
flushIfOlderThanFile: aFile
-
-
initializeCache
-
Initialize the receiver's cache
-
isCached
-
Tell if the receiver is cached or not. In the future,
this will consider the fact that a cached object may
become old after some time, and that means that the
object is NOT cached anymore.
-
isOlderThanFile: aFile
-
code generation
-
asSmalltalkCode: sttCode model: commancheModel
-
Returns the equivalent version of the receiver as Smalltalk code
-
asSmalltalkCodeWithModel: aModel
-
Returns the equivalent version of the receiver as Smalltalk code
-
writeOutputCodeFor: aString on: aStream
-
Writes on aStream the required Smalltalk code for sending aString as reply
compiling
-
compileFor: aComancheModel
-
Compiles the receiver's template in aClass and returns aCompiledMethod
evaluating
-
evaluateFor: aComancheModel
-
Evaluates the receiver within for anObject
initializing
-
initializeOn: aString asStringSelector: aSymbol
-
Try these expressions:
(STTTemplate on: 'Repeating word...<?stt 10 timesRepeat: [ ?> WORD <?stt ] ?> end!') evaluateFor: nil.
(STTTemplate on: 'Counting:
<?stt self to: 10 do: [ :each | ?>
[<?stt = each ?>]
<?stt ] ?>'
) evaluateFor: 1.
obsolete (non xml-compliant):
(STTTemplate on: 'Repeating word...{% 10 timesRepeat: [ %} WORD {% ] %} end!') evaluateFor: nil.
(STTTemplate on: 'Counting:
{% self to: 10 do: [ :each | %}
[{%= each %}]
{% ] %}'
) evaluateFor: 1.
checking documents:
XML::XMLParser
processDocumentInFilename:'../../goodies/webServer/data/comancheSTT/test1.stt'
beforeScanDo:[:p | p validate:false]
XML::XMLParser
processDocumentInFilename:'../../goodies/webServer/data/comancheSTT/test4.stt'
beforeScanDo:[:p | p validate:false]
|