Main ----- Copyright Up -------- ----

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 using them like variables.

General syntax

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

Attribute types

STRING
any text
URI
references to an URI. Is affected by CLI options like STRIPEXTERNAL.
BOOL
boolean flag
ENUM
enumerator type; accepts only given values (eg the ALIGN attribute of <IMG>).
ID
id for current position in document; can be refered with <A HREF="#id">
NUM
decimal integer value
COLOR
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.
/REQUIRED (short: /R)
Attribute must be set when macro/tag is called.
Within <$macro> and <$deftag>, URIs also can have the following options:
/SIZE (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.

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.

Examples

DO_IT:bool
defines a boolean attribute
UP:uri=":main.html"
defines an URI attribute and sets it's default value to ":main.html". The ":" indicates that the default value is an absolute URI.
MODE:enum("ascii|bin|hex")
defines an enumerator type; legal values are ascii, bin and hex.