While editing a javascript code to adapt the behavior of an addthis
button I got something unexpected...
Checkout this JS code and thing about web2py template code:
var addthis_share = {
templates: { twitter: 'check out {{title}} @ {{url}}' }
}
First try:
templates: { twitter: 'check out '{{="{{title}} @ {{url}}"}}' }
if real parsing was going on here, this should work but probably the
template engine just uses regular expressions to find the ending
{{ mark after the beginning {{ and ignores everything else. So, it is
a fail...
Second try:
templates: { twitter: 'check out
'{{=chr(123)+chr(123)+'title'+chr(125)+chr(125)+' @
'+chr(123)+chr(123)+'url'+chr(125)+chr(125)}}' }
ok, this is sort of hacking the own framework but it works. It's ugly
but it works
Can we make it prettier without throwing this to a javascript file?