tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

Add a "markup html attribute" example in the documentation that uses a concatenated expression #239

Closed BawdyInkSlinger closed 1 year ago

BawdyInkSlinger commented 1 year ago

Is your feature request related to a problem? When using markup HTML attributes, I occasionally want to use simple expressions as the attribute value (e.g., _id + '-suffix'), but I can never remember the syntax to do that.

Normally I...

  1. Try to use a simple expression, incorrectly wrapping it in back-ticks
  2. It doesn't work™
  3. I try a few other ideas to no avail
  4. I give up, settling for:

    <<set _id_attribute = _id + '-suffix'>>
    <span @id="_id_attribute">…</span>

Describe the solution you'd like. These are the current examples:

<span sc-eval:id="_id">…</span>
<span @id="_id">…</span>

I would like the documentation to include two more examples:

<span sc-eval:id="_id + '-suffix'">…</span>
<span @id="_id + + '-suffix'">…</span>

Describe alternatives you've considered. These would be the steps I documented above.

Additional context.

BawdyInkSlinger commented 1 year ago

Completed