DML2  v1.0.1
Introduction to DML2
Getting Started
Files and Directories
Custom Tags
File Output
Creating Objects
Rendering and Scope
Object Execution
Rendering Arrays
Automatic Tags
Release Notes
<( Custom Tags )>

DML2's predecessor, DML boasted mostly of one feature, user-definable tags. The tags are similar in structure and function to HTML tags but they can be made to represent any arbitrary string (that may include other tags, as well as parameters). To call a tag without parameters, you must simply write a less than sign, an open parenthesis, the tag name, a closing parenthesis, and a greater than sign. Here's an example: <(aDML2Tag)>

Defining a tag is simple enough (especially if you're used to C-style syntax). Inside of your .dml2 file, just type something similar to the follow:

tag nameOfTag {
Here's the tag content. This text will be inserted when you call the tag.

You can also create tags that work like HTML/XML tags that may enclose groups of text. If you're not familiar with these languages, here's an example: Let's say you had a block of text that you wanted to enclose within a bounding box of some type. You could make a tag for the beginning of the block and one for the end, but if you needed to write the text twice, this wouldn't work.

To solve this problem, DML2 has "tag parameters". They are defined by adding a slash to the end of the tag name. Inside of the definition, when you want to call the text that is enclosed, simply type a DML2 tag who's name is the at sign (@). Here's an example:

tag aTagWithATagParameter/ {
This tag surrounds the following text: <(@)>

Lastly, DML2 tags may take parameters. These parameters are given using C-style notation. After the tag's name (still within the DML2 tag), put an open parenthesis. Follow this by a set of parameters enclosed within quotes, deliminated by commas, ending with a closing parenthesis. The parameters are accessed within the tag definition by making a tag whose name is the at sign (@) followed by a number corresponding to its position within the set of parameters. The first parameter's number is zero. The following are two examples that demonstrate both the definition and invocation of tags with parameters.

tag parameterTag {
The first parameter passed to this tag is: "<(@0)>"
Here's the second: "<(@1)>"

Now that we've defined the tag, why don't we call it?
<(parameterTag("Parameter #1", "Parameter #2"))>
The previous line will call the tag and it's text will be inserted there with the parameters substituted into the proper spots.

!Note: Since tag parameters are surrounded by quotation marks, you can't very well use the double quote character (") within a parameter. To work around this, simply put a backslash character (\) in front of the quotation mark, like this: \". However, inside of a DML2 tag (when doing parameters), you must use just the double quote character (as you normally would).

!Note: DML also supported another type of parameter known as the "named parameter." This type of parameter allowed users to not have to remember the sequence of parameters, instead relying on a user-defined name to locate the data. DML2 has no need for this thanks to its (more powerful) objects (a topic that is discussed later).
©2002 Jared Krinke. ((( Revolution )))