Ok here's a solution. If a : is enclosed within {...:...} I will
interpret the directive in its inline form ex:
{header: off}
This is only 1 line and much less typing than:
{header}
off
{end}
If there is not : enclosed within the {...} then it will be
interpretted as a block, and whatever is enclosed with {...} will be
prepended to the directives found in the block:
{header}
family: value <= becomes {header-family: value}
font: value <= becomes {header-font: value}
size: value =< becomes {header-size: value}
left-string: value <=becomes {header-left-string: value}
{end}
I say "becomes", because all I am doing it converting the naked style
directives (without curly braces) into braced form (which are already
defined prorgamatically) and letting th interpret transform those into
MOM code, the way it has been all along.
Then {header-family: value} by itself is still a valid tml command if
one chooses to use it in its inline form and also valid if used in its
block form:
{header}
family: value
{end}
The interpreter simply transforms the latter into the first then
generates MOM code.
I think this is a brilliant solution.
To recap:
{item-option: value} <= inline form. The "keyword" is the colon
within the {...}, which means this is not a block
{item}
option: value
{end}
This is the block form of the same style/config. This form does not
contain a colon within the {...} and whatever string is within the
{...} will be prepended to the list of commands which make up the
block.
This way no need for setup-block. Also I could match against a list
of TML aware words: header, chapter, page etc...which make up
configurable items. If the string within {...} does not match one of
those, it will assume it is arbitrary and user defined, and NOT
prepend the string to the commands within the block.
For example:
{my-special-style}
header-family: value
justification: left
page-size: 3x4
{end}
{header} on {off}
takes up 3 lines of vertical space,
Ok here's a solution. If a : is enclosed within {...:...} I will interpret the directive in its inline form ex:
{header: off}
This is only 1 line and much less typing than:
{header} off {end}
If there is not : enclosed within the {...} then it will be interpretted as a block, and whatever is enclosed with {...} will be prepended to the directives found in the block:
{header} family: value <= becomes {header-family: value} font: value <= becomes {header-font: value} size: value =< becomes {header-size: value} left-string: value <=becomes {header-left-string: value} {end}
I say "becomes", because all I am doing it converting the naked style directives (without curly braces) into braced form (which are already defined prorgamatically) and letting th interpret transform those into MOM code, the way it has been all along.
Then {header-family: value} by itself is still a valid tml command if one chooses to use it in its inline form and also valid if used in its block form:
{header} family: value {end}
The interpreter simply transforms the latter into the first then generates MOM code.
I think this is a brilliant solution.
To recap:
{item-option: value} <= inline form. The "keyword" is the colon within the {...}, which means this is not a block
{item} option: value {end}
This is the block form of the same style/config. This form does not contain a colon within the {...} and whatever string is within the {...} will be prepended to the list of commands which make up the block.
This way no need for setup-block. Also I could match against a list of TML aware words: header, chapter, page etc...which make up configurable items. If the string within {...} does not match one of those, it will assume it is arbitrary and user defined, and NOT prepend the string to the commands within the block.
For example:
{my-special-style} header-family: value justification: left page-size: 3x4 {end}