• Re: string map in wapp-subst

    From Rich@21:1/5 to Luis Mendes on Thu May 2 13:59:40 2024
    Luis Mendes <luisXXXlupeXXX@gmail.com> wrote:
    My attempt to string map [ to the corresponding html code have failed,
    like:

    string map " {[} {&#91;} " $descr
    string map { "[" "&#91;" } $descr

    Also tried to escape the [, but to no success.

    How can it be done?

    Although your followup implies you no longer need the answer to this,
    the way "to do it" is to feed a proper list to string map:

    string map [list \[ "&#91;"] $descr

    It is usually more difficult to try to create lists using "" or {} than
    to just let the [list] command do so. In either of the first cases,
    you have to have a very good internal understanding of what to quote
    (and not to quote) to make the list correct. Using [list], it will
    handle those details for you automatically.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Luis Mendes on Thu May 2 14:01:12 2024
    Luis Mendes <luisXXXlupeXXX@gmail.com> wrote:
    On 02 May 2024 12:22:33 GMT, Luis Mendes wrote:
    Upon further investigation, it seems that the problem doesn't happen
    because of the [, but because of quotes.
    I could already do the string map mentioned in the previous post.

    If I try `set descr "\"changed\": false"
    it breaks wapp.
    The error returned is:
    ERROR: extra characters after close-quote.

    What if you escape actual quotes into the html &quot; escape?

    string map [list \" "&quot;"] $your_variable

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Luis Mendes on Thu May 2 14:49:38 2024
    Luis Mendes <luisXXXlupeXXX@gmail.com> wrote:
    On Thu, 2 May 2024 14:01:12 -0000 (UTC), Rich wrote:

    Luis Mendes <luisXXXlupeXXX@gmail.com> wrote:
    On 02 May 2024 12:22:33 GMT, Luis Mendes wrote:
    Upon further investigation, it seems that the problem doesn't happen
    because of the [, but because of quotes.
    I could already do the string map mentioned in the previous post.

    If I try `set descr "\"changed\": false"
    it breaks wapp.
    The error returned is:
    ERROR: extra characters after close-quote.

    What if you escape actual quotes into the html &quot; escape?

    string map [list \" "&quot;"] $your_variable
    Wapp doens't break, but then the &quot; is not interpreted back to a "
    when rendered in html.

    I've substituted " by ' and it works, although not as accurate.
    Thank you.

    Then you might try escaping the quotes:

    string map [list \" \\\"] $your_variable

    And see if Wapp handles \" within the string properly.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)