Reuse 'answer' code from other question

Re: Reuse 'answer' code from other question

by Andreas Dedner -
Number of replies: 1

It's not really an issue. I just thought that  having the description highlighted might be nice for the students to focus on it. But of course I don't know how difficult it is to actually add something like that.

In my setting the issue came up that I would need to have the description twice (once for the matlab block and once for the python block). Or  somehow make it possible for the grader to split off a description and add it to the output independent of the language. But that is of course specific to my setting.

I tried to use the 'Extra template data' field available for each test. From the documentation I wasn't quite sure if this is like 'global extra', i.e. a text field or like 'template params' i.e. a json structure where I can add multiple fields? I guess my question just I be able  to write {{  Test.params.description }} in my grader and add  { "description": "Super test" } into the extra template data field - I tried that but it didn't work that way.

In reply to Andreas Dedner

Re: Reuse 'answer' code from other question

by Richard Lobb -

I do need to clarify how the template parameters and twig expansion works, I admit. In the development version that I'm working on I've refactored the template parameter code to allow other preprocessors than Twig, so now would be a good time to rewrite the documentation.

For now I don't have a solution to your wish to display the test description highlighted. But I've just updated the code in the development version so that it allows the use of '%h' column format specifiers (i.e. raw html) in the "For example" table as well as the result table. The development version also allows you to define Twig macros in the prototype. The combination of those two features should allow you to format your tests in a better way. But you'll have to wait another month or so :)