These are chat archives for ractivejs/ractive

22nd
Mar 2018
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:18
hi
is there a way for decorators to interpret their argument as single raw string instead of trying to interpret it as expression?
What I'd like to do is: as-tooltip="Hey, here is a fancy message!"
but htis doesn't work since it'll be attempted to parse as expression ...and if you "quote ' in quotes", you can't use eiter as part of your message, which kind of sucks too
kouts
@kouts
Mar 22 2018 15:24
@dagnelies what is the problem if you use as-tooltip="'Hey, here is a fancy message!'" ?
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:25
That you can't write : as-tooltip="'Can't write that, or "that" !'"
kouts
@kouts
Mar 22 2018 15:27
Ahh I get it now
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:27
And if you use &quote;, bootstrap tooltips will render &quote;litterally for instance
kouts
@kouts
Mar 22 2018 15:27
I know that
yes
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:28
  • I meant ", sry
kouts
@kouts
Mar 22 2018 15:28
It escapes it by default
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:29
In theory it sounds trivial, in practice it's a bummer
(making a tooltip decorator)
Paul Maly
@PaulMaly_twitter
Mar 22 2018 15:33
Funny workaround:
{{#with “Can’t write that” as msg}}
)))
as-tooltip=“msg”
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:39
that would be aoption but it makes things quite verbose, I've found ontoer workaround though as-tooltip title="bla bla bla" and itside the decorator, fetch the title
Joseph
@fskreuz
Mar 22 2018 15:45
iirc, there's an undocumented backtick syntax for directives which might help. @evs-chris knows about it better though.
Arnaud Dagnelies
@dagnelies
Mar 22 2018 15:58
ok, thanks for the info
Chris Reeves
@evs-chris
Mar 22 2018 16:11
that's actually for anything that takes an expression
Arnaud Dagnelies
@dagnelies
Mar 22 2018 16:22
good to know
Chris Reeves
@evs-chris
Mar 22 2018 16:27
since ractive supports unquoted attribute values, and the expression parser takes over from the attribute parser while reading expressions, as long as the expression has clear delimiters, you can leave off the quotes (editor may not be happy though) - <div class-show=(.foo * 12 === 42) as-thing=`no quotes pileup, plus you can ${interpolate} still`>