Attribute Declaration

Attributes are comparable to function arguments in programming languages like Pascal, Oberon or E. So attributes are arguments passed to a tag or macro.

Additionally, you can create/update attributes using <$define> and <$let> therefor use them just like variables.

General Syntax

Within <$macro>, <$define> and <$deftag>, an attribute is declared using
name ":" type [ "/" modifiers ] [ "=" default value ]

Attribute Types

any text
references to an URI. Is affected by commandline options like StripExternal.
boolean flag
enumerator type; accepts only given values (eg the ALIGN attribute of <IMG>).
id for current position in document; can be refered with <A HREF="#id">
decimal integer value
a color-value matching the template "#rrggbb" or one of the values defined using HSC.COLOR-NAMES.

Attribute Modifiers

/CONST (short: /C)
Attribute is read-only; you can't set a new value using <$let>. This option is only allowed within <$define>
/GLOBAL (short: /G)
Attribute is global. Useful if you want to define an attribute inside a macro, that is not removed after macro has been processed. This option is only allowed within <$define>.
/JERK (short: /J)
Attribute is only used by a jerk.
Within <$macro> and <$deftag>, URIs also can have the following options:
/REQUIRED (short: /R)
Attribute must be set with a value when macro/tag is called.
/GETSIZE (short: /Z)
If the attribute references to a local file, try to evaluate the "size" of the file, search for attributes called WIDTH and HEIGHT within the same tag and set them with these values (if they have not been set before). At they moment, only tags like <IMG> support this.
/STRIPEXT (short: /X)
Strip whole tag, if the attribute references to an external URI and option StripExternal has been enabled.
/OBSOLETE (short: /O)
Attribute is obsolete. Makes little sense for macros, but is used in hsc.prefs to mark attributes obsoleted by CSS etc.

Default Value

The default value initialises the attribute every time the macro is called. If the attribute is not set within the macro call, the default value is used. Otherwise, the value passed to the macro will be used as new value.


defines a boolean attribute
defines an URI attribute and sets it's default value to ":main.html". The ":" indicates that the default value is a Project Relative URI.
defines an enumerator type; allowed values are ascii, bin and hex.