Allowing judges to link to files in syntax highlighted code #4417
niknetniko
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some judges (I know of the Python judge, which is a special case, and TESTed) link to files when the filename appears in the input for a testcase:
In the example above, the "europe.txt" is clickable and opens the file.
Dodona supports syntax highlighting for pieces of code, such as the
$ migration '[europe.txt]
in the example above.However, there is no support for linking files.
TESTed currently works around this by not generating code, but generating HTML as the input: by using pygments, the outputted HTML is luckily compatible with Rouge, which is what Dodona uses to create syntax highlighting.
I propose moving this functionality to Dodona itself: a judge would generate input (with type
code
), and also provide an accompanying map of parts to be replaced with a link. This way, Dodona has full control on how this linking should be done (e.g. something like the popups of the Python judge would also be possible).A concrete proposal of the format (in the partial one) would be to add an attribute to the
start-testcase
command, which contains an object: the keys of which will be replaced by a link to the file given by the value of the object. The replacement would be simple: all occurrences of the keys would be replaced by the links. It is up to the exercise designer to then ensure that things that shouldn't be links have a different name.We could also make it simpler by just accepting an array of file names, and always automatically link
$FILE
tomedia/workdir/$FILE
.In TESTed, we handle the replacement with big 'ol regex, but in Dodona, I would suggest looking into subclassing a lexer from Rouge to handle this more cleanly.
Beta Was this translation helpful? Give feedback.
All reactions