My Python (Flask) application sends data to a Jinja2 template, which then renders it as HTML. Here's an example of the data:
--- a
+++ b
[
@@ -0 +0 @@
{
u'po': u'04312',
u'storage': [
@@ -2,1 +2,1 @@
@@ -2,1 +2 @@
+{u'type': u'FusionIO', u'capacity': 3000, u'number': 2, u'speed': u'N/A', u'total_capacity': 6000},
],
u'serial': u'YYZ666',
u'added_by': ObjectId('5208f7e054d79f70f9e13f7f'),
u'edited_by': ObjectId('5208f7e054d79f70f9e13f7f'),
-u'revision': 2,
+u'revision': 3,
u'status': u'Prod',
-u'edited_date': datetime.datetime(2013, 8, 19, 21, 40, 30, 275000),
+u'edited_date': datetime.datetime(2013, 8, 20, 13, 34, 25, 621000),
-u'memory': u'256',
+u'memory': u'1024',
u'racked': u'Yes',
@@ @@
},
]
This data in HTML format looks like this:
<div class="server-diff">
<h2 class="dashboard-heading">Diff</h2>
<p>--- a
+++ b
[
@@ -0 +0 @@
{
u'po': u'04312&##39;,
u'storage': [
@@ -2,1 +2,1 @@
@@ -2,1 +2 @@
+{u'type': u'FusionIO', u'capacity': 3000, u'number&#&nbs…
],
u'serial': u'YYZ666',
u'added_by': ObjectId('52...
</p>
I want to change the text color of lines that start with + to green and - to red. Can JavaScript or jQuery help achieve this using CSS?
If you have any insights on how to implement this feature, I would greatly appreciate your help.