[PATCH 2/3] printing_templates: mark 'dive.notes' as 'safe'

Lubomir I. Ivanov neolit123 at gmail.com
Sun Nov 15 13:01:49 PST 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

Grantlee has a way to display a variable as HTML by
marking it as 'safe' e.g.:
{{ dive.notes|safe }}

This allows any HTML to be preserved when printing.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---

the unfortunate part here is that we don't know if the user has
modified a bundled template or not, because we just copy them to a
writable location and don't do diffs or checksums.

for this update to work for users that already have Subsurface
installed, they will have to manually do the update from the
install package to the user directory/printing_templates.
---
 printing_templates/Flowlayout.html | 2 +-
 printing_templates/One Dive.html   | 2 +-
 printing_templates/Six Dives.html  | 2 +-
 printing_templates/Two Dives.html  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/printing_templates/Flowlayout.html b/printing_templates/Flowlayout.html
index 2615c35..21691c2 100644
--- a/printing_templates/Flowlayout.html
+++ b/printing_templates/Flowlayout.html
@@ -197,7 +197,7 @@
 							<tr>
 								<td class="fieldData">
 									<div class="textArea">
-										<p> {{ dive.notes }} </p>
+										<p> {{ dive.notes|safe }} </p>
 									</div>
 								</td>
 							</tr>
diff --git a/printing_templates/One Dive.html b/printing_templates/One Dive.html
index 020c67b..3884eca 100644
--- a/printing_templates/One Dive.html	
+++ b/printing_templates/One Dive.html	
@@ -210,7 +210,7 @@
 							<tr>
 								<td class="fieldData">
 									<div class="textArea">
-										<p> {{ dive.notes }} </p>
+										<p> {{ dive.notes|safe }} </p>
 									</div>
 								</td>
 							</tr>
diff --git a/printing_templates/Six Dives.html b/printing_templates/Six Dives.html
index 9d4d134..1d4bb5b 100644
--- a/printing_templates/Six Dives.html	
+++ b/printing_templates/Six Dives.html	
@@ -171,7 +171,7 @@
 								<tr>
 									<td>
 										<div class="textArea">
-											<p> {{ dive.notes }} </p>
+											<p> {{ dive.notes|safe }} </p>
 										</div>
 									</td>
 								</tr>
diff --git a/printing_templates/Two Dives.html b/printing_templates/Two Dives.html
index 95cc9a0..5d2e1f6 100644
--- a/printing_templates/Two Dives.html	
+++ b/printing_templates/Two Dives.html	
@@ -221,7 +221,7 @@
 							<tr>
 								<td class="fieldData">
 									<div class="textArea">
-										<p> {{ dive.notes }} </p>
+										<p> {{ dive.notes|safe }} </p>
 									</div>
 								</td>
 							</tr>
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list