timothycrosley / jiphy

Your client side done in a jiphy. Python to JavaScript 2-way converter.
MIT License
585 stars 73 forks source link

single-quotes inside strings #32

Open z33kz33k opened 4 years ago

z33kz33k commented 4 years ago

It seems jiphy does not escape quotes in strings properly. Is this correct? I'm using jiphy inside Python code (to.python() and to.javascript() methods).

Example in Python: some_dict = {"name": "AppWrapper.some_function(var_name='Some_Var_Name')"}

Then this dict gets translated to JS with: jiphy.to.javascript(repr(some_dict))

And the result is: {'name': 'AppWrapper.read_env_var(var_name='Some_Var_Name')'}

which is invalid, because browser will interpret the inside quotes as starting a new string which is not the case.

Any solutions barring regexing it?