An @if but no @but
SkoolKit 6.4 has been released. To get your copy, pop along to the download page, the Python Package Index, the Ubuntu PPA, or the Fedora copr repo.
Continuing the trend of new ASM directives that was started in 6.3, this
release brings us the @if
directive. As its name implies, it can be used to
conditionally process other ASM directives. The variables it can use are the
same as those available to the #IF
and #MAP
macros: asm
, base
, case
,
fix
(new in 6.4), html
and vars
(also new in 6.4). So, for example, if
you want to replace ‘foo’ with ‘bar’ in HTML mode, but with ‘baz’ otherwise,
you could do this:
@if({html})(replace=/foo/bar,replace=/foo/baz)
As noted above, the fix
and vars
replacement fields are new in this
release. fix
indicates the fix mode (0, 1, 2, 3 for none, @ofix
, @bfix
,
@rfix
), and vars
is a dictionary that holds values defined by the new
--var
option of skool2asm.py
and skool2html.py
. In addition, asm
now
indicates the exact ASM substitution mode (0, 1, 2, 3 for none, @isub
,
@ssub
, @rsub
) instead of just being 0 or 1.
Still on the subject of ASM directives, @isub
, @ssub
, @rsub
, @ofix
,
@bfix
and @rfix
can now replace not only the instruction on a given line,
but also the comment that goes with it. This capability reduces the need for
using ASM block directives (@bfix+begin
etc.), which cannot be preserved in a
control file.
Moving on to the skool macro department, this release introduces the second and
final new macro of the 6.x series: #RAW
. If you’ve ever been annoyed by
SkoolKit’s inability to render a hexadecimal number higher than 40959 (0x9FFF)
in upper case with a ‘#’ prefix (e.g. #ABCD), #RAW
will quickly become your
new best friend. It prevents any macros or macro-like tokens in its sole string
argument from being expanded. So you can now write #RAW(#BEEF)
, safe in the
knowledge that SkoolKit will not complain about ‘#BEEF’ being an unknown macro.
Finally, a word about the venerable #LIST
and #TABLE
macros. In previous
versions, neither of these macros could be used in an instruction-level comment
or as a parameter of another macro in ASM mode. That restriction has been
lifted in 6.4. Since no one’s ever complained to me about it before, I must
conclude that either no one noticed, or no one really cared. But preventing the
use of these macros in those locations in that mode made no sense, so there we
go.
For details on the other new features in this release, I will point you to the changelog. I would also recommend taking note of all the deprecated features, so that you’ll be ready for 7.0 when it arrives. See you then!