[damned-lies] Highlight pofilter comments in quality check results
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Highlight pofilter comments in quality check results
- Date: Thu, 8 Mar 2018 08:52:03 +0000 (UTC)
commit 43acc747ae192c0890497f02bea4d30178e8c717
Author: Claude Paroz <claude 2xlibre net>
Date: Thu Mar 8 09:51:52 2018 +0100
Highlight pofilter comments in quality check results
templates/vertimus/quality-check.html | 2 +-
vertimus/views.py | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/templates/vertimus/quality-check.html b/templates/vertimus/quality-check.html
index 5e42f4e..fc7bbcc 100644
--- a/templates/vertimus/quality-check.html
+++ b/templates/vertimus/quality-check.html
@@ -6,7 +6,7 @@
{% block content-title %}{% trans "Quality check results" %}{% endblock %}
{% block content %}
-{{ results }}
+{{ results|linebreaksbr }}
{% endblock %}
{% block footer %}
diff --git a/vertimus/views.py b/vertimus/views.py
index 626cd87..182911d 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -1,5 +1,6 @@
import difflib
import os
+import re
from django.conf import settings
from django.contrib import messages
@@ -7,6 +8,8 @@ from django.db import IntegrityError
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
+from django.utils.html import escape
+from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from stats.models import Statistics, FakeLangStatistics, Module, Branch, Domain, Language
@@ -251,7 +254,9 @@ def quality_check(request, pk):
context['checks'] = ['xmltags']
results = action.check_po_file(context['checks'])
if results:
- context['results'] = results
+ context['results'] = mark_safe(re.sub(
+ r'^(# \(pofilter\) .*)', r'<span class="highlight">\1</span>', escape(results), flags=re.M
+ ))
else:
context['results'] = _('The po file looks good!')
return render(request, 'vertimus/quality-check.html', context)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]