Skip to content

Allow escaping $ in strings. #5

Description

@AndrewKraevskii

Some libraries have syntax highly similar to scripty syntax which makes them impossible to use. Consider example from https://data-star.dev/guide/reactive_signals#data-text

<input data-bind:foo-bar />
<div data-text="$fooBar.toUpperCase()"></div>

Pasting this into shtml file produces this error message.

---------- SCRIPT RESULT TYPE MISMATCH ----------
A script evaluated to an unexpected type.

This attribute expects to evaluate to one
of the following types:
   - string
   - int

[script_eval_not_string_or_int]
(index.shtml) layouts:7:6:
    <div data-text="$fooBar.toUpperCase()"></div>
         ^^^^^^^^^

note: value was generated from this sub-expression:
(index.shtml) layouts:7:17:
    <div data-text="$fooBar.toUpperCase()"></div>
                    ^^^^^^^^
Scripty evaluated to type: err
Error message: 'field not found'

trace:
    layout `index.shtml`,
    content `content/about.smd`.

It would be cool to have ability to escape $ in this case. Or as an alternative making it replaceabale for another character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions