Wordscript attributes are extremely versatile.
- Attributes can appear at the global scope, local scope, or anywhere within an element.
- Attributes can contain other elements, including text and other attributes.
- Multiple syntax styles can be mixed.
- Attributes can be namespaced directly or indirectly.
- Attribute elements can contain comments.
- Attribute values can be interpolated in scripts.
- Transitions can be applied between attribute declarations.
Here is an example of combining attribute syntax styles.
[[@
color:red;
{size: 16}
shape="round"
(myNamespace)
color:blue;
system.color='green'
]]
The system plugin can lookup various named values, including attributes. The $
tagname is the system plugin, and the @
before the key indicates to lookup an attribute.
[[@ name:Woolly Mammoth; breed:Sheepadoodle;]]
The dog is a [[$ @breed]] and his name is [[$ @name]]
Syntax
- Style content blocks can use various syntax styles, including CSS, JSON, HTML, or Javascript.
Comments
Attribute elements can contain single-line comments.
[[@
// the document title
title: My Wordscript;
// the document subtitle
subtitle: A modern language;
keywords: syntax language generate; // This is another comment
]]
Embedded Text
Any text in an attribute element must be explicit (inside [[
and ]]
)
[[@
color:red;
[[ this is text inside the attribute element ]]
]]
Scope
- An attribute element without no content elements will apply the elements to the surrounding external scope.
- An attribute element with content elements will apply the elements only to the internal scope.