diff --git a/gramps/gen/plug/docbackend/docbackend.py b/gramps/gen/plug/docbackend/docbackend.py
index c601fe427..481c1ee78 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 = {
@@ -263,7 +263,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.
@@ -287,6 +287,9 @@ class DocBackend(object):
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
@@ -378,7 +381,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 1b6b094e5..6273f10ee 100644
--- a/gramps/plugins/webreport/narrativeweb.py
+++ b/gramps/plugins/webreport/narrativeweb.py
@@ -918,12 +918,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'):