<!--mksite:updatevars--> <!--mksite:noupdatevars-->
The option can be selected in the sitefile, per default we do
update content prefixed with these comment variables.
mksite:nocommentvars
disables this feature as well.
input: derived<!--$varname:=-->
2004/04 output: derived 2004-04-16 default: derived 2004/04 input: derived<!--on $varname:=-->
2004/04 output: derived on 2004-04-16 default: derived 2004/04 input: derived<!--on $varname:?-->
2004/04 output: derived on 2004-0416 default: derived 2004/04 input: derived<!--$varname:?-->
2004/04 output: derived - 2004-0416 output: derived (2004-0416) default: derived 2004/04
This is the preferred method of updating content in the htm file. The comment itself is invisible while a default representation is visible (usually in a similar formatting). The expansion will cut away all text following the comment variable up to the next markup or endofline. That text is replaced with the value of the selected variable. If no variable of such a name exists then nothing is done and the default value persists.
The variant expansions can be selected via "?" after the
colon instead of the "=". This syntax derives directly
from shell variable name expansion which knows the two
variants as well ${varname:=default}
and
${varname:?default}
. A similar syntax was
picked up for the attribvars
expansion which update markup attribute text intead of
page content text.
The variant expansion scheme has two modes. In the direct variant expansion we pick the same as for the expandvars being hyphenated for toplevel variables ("$title" and "$author") and parenthesed for secondary variables ("$modified" and "$issued"). This is not recommended to be used with modern mksite.sh, and instead prefix the variable name with some whitespace to select the core expansion. (The direct variant expansion is a heritage of simplevars).
The variant expansion scheme with some prefix inside the
comment markup does only use the core expansion for
variable values. The variant value is internally already
(a) lowercased from the original value and (b) any
additional markup has been cut out. This core modification
of variants is very useful to paste variable values into
<title>
markups - in those the values are
officially marked text content but many browsers will treat it
as CDATA
thereby showing any markup verbatim instead
of interpreting them.