changeset 2191:47a007f552b7

content diff macro
author Ana Balica <ana.balica@gmail.com>
date Sun, 15 Sep 2013 11:29:16 +0200
parents 52856b0d34bf
children 6f2291d304bd
files MoinMoin/templates/mail/content_diff.html
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/templates/mail/content_diff.html	Sun Sep 15 11:29:16 2013 +0200
@@ -0,0 +1,30 @@
+{% macro content_diff(diff) %}
+<table border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:1em;
+        width:100%; font-family:monospace; background-color:#F9F9F9;">
+{% for line in diff -%}
+{% if line[:2] == "+ " -%}
+    <tr style="color:#00B000; height:1.2em;">
+{% elif line[:2] == "- " -%}
+    <tr style="color:#991111; height:1.2em;">
+{% elif line[:2] == "@@" -%}
+    <tr style="color:#440088; height:1.2em;">
+{% else -%}
+    <tr style="color:#000000; height:1.2em;">
+{%- endif %}
+    {% if line[:2] == "+ " %}
+        <td style="font-family:monospace; width:1.2em; vertical-align:top;">{{ line[0] }}</td>
+        <td style="font-family:monospace;"><ins style="text-decoration:none;">{{ line[2:] }}</ins></td>
+    {% elif line[:2] == "- " -%}
+        <td style="font-family:monospace; width:1.2em; vertical-align:top;">{{ line[0] }}</td>
+        <td style="font-family:monospace;"><del style="text-decoration:none;">{{ line[2:] }}</del></td>
+    {% elif line[:2] == "@@" -%}
+        <td style="font-family:monospace; width:1.2em;"></td>
+        <td style="font-family:monospace;">{{ line }}</td>
+    {% else -%}
+        <td style="font-family:monospace; width:1.2em;"></td>
+        <td style="font-family:monospace;">{{ line[2:] }}</td>
+    {%- endif %}
+    </tr>
+{%- endfor %}
+</table>
+{% endmacro %}
\ No newline at end of file