diff --git a/secretary.py b/secretary.py
index 2a21714..bc828e2 100644
--- a/secretary.py
+++ b/secretary.py
@@ -439,6 +439,21 @@ class Renderer(object):
return xml_text
+ @staticmethod
+ def get_escaped_var_value(value):
+ """
+ Encodes XML reserved chars in value (eg. &, <, >) and also replaces
+ the control chars \n and \t control chars to their ODF counterparts.
+ """
+ value = Markup.escape(value)
+ return (
+ value.replace('\n', Markup(''))
+ .replace('\t', Markup(''))
+ .replace('\x0b', '')
+ .replace('\x0c', '')
+ )
+
+
def add_media_to_archive(self, media, mime, name=''):
"""
Adds to "Pictures" archive folder the file in `media` and register