From 3fe840b52e4d780587f14d06a46fcab523ba23c3 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 20 Aug 2018 17:35:55 +0530 Subject: Add syntax highlight for code answers in answerpaper --- yaksh/templates/yaksh/grade_user.html | 5 ++++- yaksh/templates/yaksh/user_data.html | 4 +++- yaksh/templates/yaksh/view_answerpaper.html | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 2e5a403..bc9ed87 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -298,7 +298,9 @@ Status : Failed
{% if question.type == "code" %} -
{{ ans.answer.answer.strip|safe }}
+ {% pygmentise_user_answer question.language ans.answer.answer.strip as user_answer %} + +
{{user_answer.0|safe}}
{% elif question.type == "mcc"%}
{% for testcases in question.get_test_cases %} @@ -327,6 +329,7 @@ Status : Failed
{% else %}
{{ ans.answer.answer.strip|safe }} +
{% endif %}
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 9449fcc..72397dc 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -233,7 +233,9 @@ User IP address: {{ paper.user_ip }} {{ answer.answer.answer.strip|safe }}
{% else %} -
{{ answer.answer.answer.strip|safe }}
+ {% pygmentise_user_answer question.language answer.answer.answer.strip as user_answer %} + +
{{user_answer.0|safe}}
{% endif %} diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 8f3fad7..e3f7df4 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -229,7 +229,9 @@ {% endfor %} {% endwith %}
-
{{ answer.answer.answer.strip }}
+ {% pygmentise_user_answer question.language answer.answer.answer.strip as user_answer %} + +
{{user_answer.0|safe}}
{% endif %} -- cgit From 4def423d573beceee07780f21bcd55836d50b558 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 13 Aug 2018 15:36:48 +0530 Subject: Allow new line to be added in an stdio testcase --- yaksh/templates/yaksh/add_question.html | 2 ++ yaksh/templates/yaksh/error_template.html | 11 +++++++++-- yaksh/templates/yaksh/moderator_dashboard.html | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'yaksh/templates') diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html index 692af48..c4cd8a7 100644 --- a/yaksh/templates/yaksh/add_question.html +++ b/yaksh/templates/yaksh/add_question.html @@ -50,7 +50,9 @@ {% for form in formset %} {% endfor %} diff --git a/yaksh/templates/yaksh/error_template.html b/yaksh/templates/yaksh/error_template.html index 5530844..00fa306 100644 --- a/yaksh/templates/yaksh/error_template.html +++ b/yaksh/templates/yaksh/error_template.html @@ -1,4 +1,11 @@ +{% block css%} + +{% endblock %} +{% block script %} + +{% endblock %} + {% load custom_filters %} {% if error_message %}
@@ -64,8 +71,8 @@ {% for expected,user in error.expected_output|zip:error.user_output %} {{forloop.counter}} - {{expected|default:""}} - {{user|default:""}} + {{expected|default:""|highlight_spaces|safe}} + {{user|default:""|highlight_spaces|safe}} {% if forloop.counter0 in error.error_line_numbers or not expected or not user %} {% else %} diff --git a/yaksh/templates/yaksh/moderator_dashboard.html b/yaksh/templates/yaksh/moderator_dashboard.html index 503cc72..59dd123 100644 --- a/yaksh/templates/yaksh/moderator_dashboard.html +++ b/yaksh/templates/yaksh/moderator_dashboard.html @@ -102,7 +102,11 @@ {% endfor %} -
+
+
{% endif %} -- cgit