7357: Adding link to a "Html code" note using the "Link" button has no effect

This commit is contained in:
Doug Blank 2014-01-07 10:35:30 -05:00
parent bc79cdf5db
commit 5fd1963855
2 changed files with 15 additions and 6 deletions

View File

@ -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 <b>text</b><i><b> here</b> not</i>
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):

View File

@ -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'):