Additionally to simple strings, you can use expressions to set the
value of an attribute. Expressions must be enclosed
inside "(
" and ")
".
Inside expressions, you can refer to attributes simply by their name.
String constants must be enclosed inside quotes.
<$define image:string="hugo.gif"> <IMG SRC=(image) ALT="image">
will be converted to
<IMG SRC="hugo.gif" ALT="image">
not
expression
set
attribute
defined
attribute
<$macro>
or
<$define>
Exists(
local uri)
bool
).
This can also be specified as an absolute URI.Exists("index.html")
,
Exists(":image/next.gif")
fExists(
filename)
bool
). If you do not specify
a full filename (including a device name), it will be relative to
the source root directory.fExists("sepp:hugo/resi.hsc")
,
fExists("///child.txt")
,
fExists("include/global.hsc")
GetEnv(
environment-variable)
GetEnv("Workbench")
GetFileSize(
local uri)
HSC.Format.FileSize
to change the appearence of the result.GetFileSize("../../download/hugo.lha")
,
GetFileSize(":nudes/resi.jpg")
GetGMTime()
HSC.Format.Time
to change the appearence of the result.GetTime()
HSC.Format.Time
to change the appearence of the result.<$define name:string="hugo"> <$define here:string="here"> <IMG SRC=(name+".gif") ALT=(name+" was "+here)> <$if (name="hugo")> This is hugo! <$else> Maybe it's sepp? </$if> AmigaOS version: <(GetEnv ("KickStart"))>
will be converted to
<IMG SRC="hugo.gif" ALT="hugo was here">
This is hugo!
AmigaOS version: 40.63
At least on my machine.
If you pass an expression to a boolean attribute, the expression is
evaluated as before. If the expression returned an empty string,
the boolean attribute is interpreted as false
. This will
cause the attribute to be removed from the tag/macro-call.
Any none-empty string will set the attribute to true
,
resulting in a value equal to the name of attribute. (In html, writing
ISMAP
is short for ISMAP="ISMAP"
.)
<IMG SRC=(name) ALT="nufin" ISMAP=(name="map.gif")>
will be converted to
<IMG SRC="hugo.gif" ALT="nufin">
if name
has been set to "hugo.gif"
,
or to
<IMG SRC="map.gif" ALT="nufin" ISMAP>
if name
has been set to "map.gif"
. Note that
only the second call enables the boolean attribute ISMAP
,
while it gets stripped for the first call.
Important: Different to most programming languages, hsc does not support priorities for different operators. Therefor, expressions are simply processed sequentially (Programmer's lazyness rules).
But you can use nested brackets within complex expressions.