diff --git a/gramps/gen/plug/docbackend/docbackend.py b/gramps/gen/plug/docbackend/docbackend.py
index 3debce49e..20e3df62f 100644
--- a/gramps/gen/plug/docbackend/docbackend.py
+++ b/gramps/gen/plug/docbackend/docbackend.py
@@ -107,7 +107,7 @@ class DocBackend(object):
SUPPORTED_MARKUP = []
- ESCAPE_FUNC = lambda x: noescape
+ ESCAPE_FUNC = lambda: noescape
#Map between styletypes and internally used values. This map is needed
# to make TextDoc officially independant of gen.lib.styledtexttag
STYLETYPE_MAP = {
@@ -265,7 +265,7 @@ class DocBackend(object):
return None
return ('', '')
- def add_markup_from_styled(self, text, s_tags, split=''):
+ def add_markup_from_styled(self, text, s_tags, split='', escape=True):
"""
Input is plain text, output is text with markup added according to the
s_tags which are assumed to be styledtexttags.
@@ -289,6 +289,9 @@ class DocBackend(object):
returned is text here not
overwrite this method if this complexity is not needed.
"""
+ if not escape:
+ escape_func = self.ESCAPE_FUNC
+ self.ESCAPE_FUNC = lambda: (lambda text: text)
#unicode text must be sliced correctly
text = cuni(text)
FIRST = 0
@@ -380,7 +383,8 @@ class DocBackend(object):
otext += opentag[1]
else:
otext += self.ESCAPE_FUNC()(text[start:end])
-
+ if not escape:
+ self.ESCAPE_FUNC = escape_func
return otext
def format_link(self, value):
diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py
index 661c2e494..3b60c04f2 100644
--- a/gramps/plugins/webreport/narrativeweb.py
+++ b/gramps/plugins/webreport/narrativeweb.py
@@ -908,12 +908,17 @@ class BasePage(object):
return ''
s_tags = styledtext.get_tags()
- markuptext = self._backend.add_markup_from_styled(text, s_tags,
- split='\n')
htmllist = Html("div", class_="grampsstylednote")
if contains_html:
- htmllist += text
+ markuptext = self._backend.add_markup_from_styled(text,
+ s_tags,
+ split='\n',
+ escape=False)
+ htmllist += markuptext
else:
+ markuptext = self._backend.add_markup_from_styled(text,
+ s_tags,
+ split='\n')
linelist = []
linenb = 1
for line in markuptext.split('\n'):