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
---
requirements/requirements-common.txt | 1 +
yaksh/templates/yaksh/grade_user.html | 5 ++++-
yaksh/templates/yaksh/user_data.html | 4 +++-
yaksh/templates/yaksh/view_answerpaper.html | 4 +++-
yaksh/templatetags/custom_filters.py | 13 +++++++++++++
5 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/requirements/requirements-common.txt b/requirements/requirements-common.txt
index 484111e..ceb9060 100644
--- a/requirements/requirements-common.txt
+++ b/requirements/requirements-common.txt
@@ -8,3 +8,4 @@ selenium==2.53.6
coverage
ruamel.yaml==0.15.23
markdown==2.6.9
+pygments==2.2.0
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
{{ 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"%}
{{ 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}}