LiaScript / LiaScript-Exporter

Export LiaScript courses into SCORM1.2 & 2004, IMS, PDF or a standalone WEB project ...
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Code output #39

Closed alexeygrinevich closed 1 year ago

alexeygrinevich commented 1 year ago

I want to have something like:

```js
// Some code


However I'm getting an error if <script> after code contains an output attribute. Removing output fixes it.

I understand that having output for script is incorrect in general, because coderunner is supposed to run async etc. But in my case it is javascript, execution is sync and having 'output' would be very handy.
andre-dietrich commented 1 year ago

Attached scripts behave differently than loose scripts, the output is currently only used to pass values between single scripts. The reason for this is, that associated with a script this might produce long streams of outputs, with console.log, HTML-content and others ...

ATM the only possibility is to store values in a global variable and release an click or change event within the script, as it is done in issue #37

However, I will discuss this option with my colleges.

alexeygrinevich commented 1 year ago

Hi Andre,

Let me explain my teaching goals so maybe it will give more insight for your discussion with colleagues.

I'm working on a course for testing automation engineers. The testing tool is 'scriptless', but sometimes you need to use things like JSON, XPath, css or JavaScript. In most cases it is copy-paste and, sometimes change some function a bit. Basically, the goal is to paste the function in a way that it is after all functions, and not in the middle of the other function. Change XPath in a way that you don't remove trailing ']'. Etc.

Recently, I have begun to detect the following trend, which has gotten worse.

Students have trouble understanding the meaning of parentheses, curly brackets, and quotation marks. A few years ago, the question "what's wrong with this code?"

function() 
}

was considered elementary. Now I may not get an answer at all.

What scared me even more, this same problem is not only with former manual testers, but also with developers. Even those who write in JavaScript have these problems. The feeling is that it's the impact of the power of modern editors like VSCode. As you write code, it puts brackets and formats everything on the fly.

So my goal is to make a quiz with a few dozen of these, primitive examples. At the same time it will help students not to be so helpless outside the usual VSCode and to use XPath freely outside the usual development environment.

So, my code will be very simple and primitive, will not require computational resources and will be elementary to check.

I hope my point makes sense. Br/Alexey

andre-dietrich commented 1 year ago

Basically you can add a script that does some more analysis, the following example shows how to put the @input into a string and do some further analysis:

image

Here is the code

As I understood, you don't want to execute the code, but analyze in different aspects. I don't know, if this helps, but you can have a look at the Textanalysis-Template this is an example that we used for teaching English ... The input is no code, it is just a simple text analyzed according to style, complexity, etc:

image

The implementation can be found here ...


I mean, the code does not has to executed directly, instead the script-tag tells LiaScript, what to do with the input from the editor. I hope this makes sense ;-)

alexeygrinevich commented 1 year ago

Thank you for hints. Actually, I was planning to to verify by executing, like that: https://liascript.github.io/LiveEditor/?/edit/VPlMKGPXjB8eBBTmFBF5IeJY

The built in editor actually does great job by giving hints when code parsing is not OK:

image

And this is one of the goals to let them watch on hints and warnings (they never do it!)

But additional parser/analysis may be helpful, it makes perfect sense!