What Infuse Does
More Syntax
Desktop Usage
Container Variables in the container are words beginning and ending with a dollar sign ($). The first character after the initial dollar sign must be a letter of the alphabet or an underscore (_). Subsequent characters can be letters, digits or underscores. Variables must not contain blank spaces, punctuation characters, or control characters. You may find the StrongED tool strip useful for stripping out content from a webpage automatically. Content A content file is simply a set of assignments of the form
variable = [[text]]For example:
$signoff$ = [[
Yours faithfully
Clarissa O'Driscoll
PS. Keep on trucking.
]]
So the text can include newlines; however, a newline following the
opening double-bracket ([[) is ignored.
It is possible to include the values of previously defined
variables like this:
$greataunt$ = [[Clarissa O'Driscoll]]
$envoi$ = [[ Keep on trucking.]]
$template$ = [[
Yours faithfully
%s
PS. %s
]]
$signoff$ = $template$:format($greataunt$,$envoi$)
The symbol %s is a format-specifier which shows where
the arguments of the format function are to be placed.
However, if the variables $greataunt$, $envoi$ and $template$ do not
actually appear in the container, you can equally well write
local greataunt,envoi = [[Clarissa O'Driscoll]],[[ Keep on trucking.]]
local template = [[
Yours faithfully
%s
PS. %s
]]
$signoff$ = template:format(greataunt,envoi)
Note three differences. First, the word local preceding the
definitions of greataunt, envoi and template; this ensures that these
definitions cannot clash with others in other content-files. Second, the
$ symbols have been dispensed with; this is only possible if they
do not appear in the container. Third, it is possible to define
more than one variable at a time, using a multi-assignment.
The variables appear on the left, separated by commas, and the values
they are to be assigned appear on the right, separated by commas.
If a variable occurring in the container is not defined in a
content file, then the corresponding merged file will simply
contain the name of the variable. So look for words beginning and ending
with a dollar sign in the output because they probably indicate that you
forgot a definition.