diff --git a/tailbone/diffs.py b/tailbone/diffs.py index f388cc3f..f179128f 100644 --- a/tailbone/diffs.py +++ b/tailbone/diffs.py @@ -35,12 +35,13 @@ class Diff(object): Core diff class. In sore need of documentation. """ - def __init__(self, old_data, new_data, columns=None, fields=None, render_value=None): + def __init__(self, old_data, new_data, columns=None, fields=None, render_value=None, monospace=False): self.old_data = old_data self.new_data = new_data self.columns = columns or ["field name", "old value", "new value"] self.fields = fields or self.make_fields() self.render_value = render_value or self.render_value_default + self.monospace = monospace def make_fields(self): return sorted(set(self.old_data) | set(self.new_data), key=lambda x: x.lower()) diff --git a/tailbone/static/css/diffs.css b/tailbone/static/css/diffs.css index 66bf4064..f76b336d 100644 --- a/tailbone/static/css/diffs.css +++ b/tailbone/static/css/diffs.css @@ -16,8 +16,8 @@ table.diff td { padding: 2px 5px; } -table.diff td.old-value, -table.diff td.new-value{ +table.diff.monospace td.old-value, +table.diff.monospace td.new-value{ font-family: monospace; white-space: pre; } diff --git a/tailbone/templates/diff.mako b/tailbone/templates/diff.mako index 2ac2796f..7f2132fd 100644 --- a/tailbone/templates/diff.mako +++ b/tailbone/templates/diff.mako @@ -1,5 +1,5 @@ ## -*- coding: utf-8; -*- - +
% for column in diff.columns: