Make use of a defined variable or sequencer

substitution

Use variable substitution within a manuscript to replace the variable's name with its value.

Syntax

Variable names begin with a dollar-sign $ and may be composed of alphabetic characters A-Z, a-z, numerals 0-9, and dashes -.

Here are some examples:

$ALPHA
$beta
$gamma-delta
$Epsilon123
Valid variable names

Ways to use variable substitution

When a variable name is typed into a manuscript, without using the assignment or increment operator, its internal dictionary value is injected into the compiled document.

A variable may be used wherever a phrase expects textual content: inside basic and text-mark phrases; inside interscribed and adjunct expressions; and inside external manuscript files accessed with !include, !use and !enclosure pragmas.

Variables may also be used inside phrase attribute values, but only if the attribute's value is enclosed by apostrophes ' ' or quotation marks " ".

Variables may be used inside grave-accent ` ` delimited sourcerefs to refer to URLs, filenames and paths.

Limitations

There several limitations to their use:

  • Variables located within graynotes are not substituted.
  • Variables cannot be used in pragmas and option statements.
  • Variables are never treated as semantax.
  • Phrase attribute names (as opposed to phrase attribute values) cannot be variables.

Examples

$TITLE="How to Build a Big Tent"
$DESCRIPTION="Creating a culture in which differences are valued"
$AUTHOR="Jeff Johnson"
$DATE="Feb 29, 2020"

html {
head {
title $TITLE
meta *charset=UTF-8
meta *name=description *content='$DESCRIPTION'
meta *name='dcterms.rightsHolder' *content='Copyright © $AUTHOR'
meta *name='twitter:card' *content='summary_large_image'
meta *name='twitter:title' *content='$TITLE'
meta *name='twitter:description' *content='$DESCRIPTION'
}
body {
h1 $TITLE
h2 $DESCRIPTION

By $AUTHOR
$DATE

Understanding how to build a big tent while at the same time
creating a culture in which differences are valued rather
than becoming fuel for conflict.
}
}
Using variable substitution

syntax > variables > substitutionMake use of a defined variable or sequencer

Q