0 votes
by (120 points)
edited by

I want to use the { } hooks for whitespacing some code, but not the text in the following:

(if: $a) [

(set: $b to 1)

blablabla

blablabla

]

Ideal would be:

{

(if: $a) [

(set: $b to 1) }

blablabla

blablabla

]

But this causes the [ ] hooks to break because there's a } in between! How do I do this? Thanks in advance!

1 Answer

+1 vote
by (159k points)

The Collapsing whitespace markup is hook-like and you can't interlace the start & end delimiters of macros or hooks.
note: the the following example uses pseudo code to demonstrate the point, and is not actual Harlowe syntax.

VALID:
<start-macro-A>
<end-macro-A>
<start-macro-B>
<end-macro-B>

or

<start-macro-A>
	<start-macro-B>
	<end-macro-B>
<end-macro-A>

INVALID:
<start-macro-A>
<start-macro-B>
<end-macro-A>
<end-macro-B>

 

In this particular case you should be using Escaped line break markup to remove the unwanted line-breaks.

(if: $a)[\
(set: $b to 1)\
blablabla
blablabla
]

or something like the following, which uses indentation to make the code a little easier to read.

(if: $a)[\
	(set: $b to 1)\
	blablabla
	blablabla
]

 

...