Tags
Tags are enclosed in square brackets, and consist of two parts:
the tag name, and an optional tag body (these are separated by
one or more whitespace characters). Some examples…
Tag | Name | Body
|
---|---|---|
[br] | br | (none) |
[url/ www.ibm.com] | url/ | www.ibm.com |
[topic "Lines[index]"] | topic | Lines[index] |
[article Best Practices] | article | Best Practices |
Within a tag body, any number of whitespace characters
(including line breaks) are coalesced into a single space.
Thus, long tag bodies, such as [section],
can be broken across multiple lines (the line break is treated
as a space).
For example…
[section Defining Comparisons with Boolean Operators
aka ComparisonsWithBoolOps]
The above is equivalent to (but easier to read than)…
[section Defining Comparisons with Boolean Operators aka ComparisonsWithBoolOps]
The one exception to these rules is the
[url] tag.
Sage supports quoted phrases in tag bodies, using either single quote
or double quote characters. This feature offers these benefits:
- Allows close square brackets, for example: [topic "Lines[index]"]. Without the quotes, the first close square bracket would end the tag.
- Supports whitespace other than spaces, for example: [topic 'A B']. Without the quotes, the line break would become a space.
- Supports multiple adjacent whitespace characters, for example: [topic 'A B']. Without the quotes, multiple adjacent whitespace characters would be coalesced into a single space.
There are two kinds of tags: self-terminating tags and nesting tags.
A self-terminating tag is a "one-and-done" affair,
such as the [...] tag, which denotes an ellipsis character.
In contrast, a nesting tag has a separate terminating tag,
which is nearly always the [end] tag.
For example, the [article] tag defines a Sage article.
The tag body contains the article's title.
The article's content is everything after the [article]
tag, but before the matching [end] tag.
Here is an example of a complete article definition:
[article SQL Operators]
SQL includes several [i]operators[end], including
...
These are discussed in more detail shortly.
[end]
Above, note that there are two [end]
tags: the first terminates the [i] tag,
and the last terminates the [article] tag.
Some Sage tags come in two varieties: one self-terminating
and the other nesting.
The two varieties will have the same name, except that the
self-terminating one will end with a forward slash.
For example, Sage offers the [url/] (self-terminating)
and [url] (nesting) tags.
We use the self-terminating tag when the desired caption is simply
the URL, and we use the nesting tag when we need to specify a
different caption.
For example:
This Sage code…
produces this HTML:
Whereas this Sage code…
produces this HTML:
The [url/] tag is more concise,
but [url]…[end]
is useful when the link's caption needs to be something different
from the URL itself, and/or benefits from some formatting
or other Sage markup.
This Sage code…
[url/ www.ibm.com]
produces this HTML:
<a href="www.ibm.com">www.ibm.com</a>
Whereas this Sage code…
[url www.ibm.com]IBM's website[end]
produces this HTML:
<a href="www.ibm.com">IBM's website</a>
The remainder of this topic discusses Sage tags in detail,
however, for a quick overview, see the
tag reference chart.
⏱ Last Modified: 10/24 9:45:52 am