fossasia / pslab-webapp

PSLab Web App https://pslab.io
Apache License 2.0
1.48k stars 42 forks source link

Json structured script outputs #55

Closed jithinbp closed 7 years ago

jithinbp commented 7 years ago

The API server returns a JSON object containing the output of a script retrieved via the submitted id. Previously, a string containing the console output was being returned, but in the interest of providing greater flexibility, a JSON object containing a list of various sections of the output will now be the return value. This will also ensure that no HTML/JS needs to be generated by the API, and all formatting will handled by the Ember App based on properties defined in the JSON object.

e.g. : print ('hello world') will be output as
{'status':True,
'Filename':script.title,
'Date':script.pub_date
'Id':script.id,
'result':[{"name":"print","type":"span","value":"hello world"}],
}

The various types implemented in the boilerplate code that this PR provides, includes 'span', and 'span-well'