From 1968eaeeaf74d40260bfe6a7ebb9a9c09483cb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 18 Sep 2012 11:18:49 +0200 Subject: [PATCH] Fix closing tag in richtext box review515002 --- .../view_form/view/form_gtk/richtextbox.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/richtextbox.py b/tryton/gui/window/view_form/view/form_gtk/richtextbox.py index d5b8506757..0f06863a78 100644 --- a/tryton/gui/window/view_form/view/form_gtk/richtextbox.py +++ b/tryton/gui/window/view_form/view/form_gtk/richtextbox.py @@ -31,16 +31,16 @@ def formalize_text_markup(text): occurrence = 0 i += 1 if stack: - span_close = '<\\\span>' * stack[-1][2] + span_close = '' * stack[-1][2] data = re.search('^' + span_close, text[i:]) if data and stack[-1][2] > 1: span = stack.pop() - text = re.sub(span_close, text[:i] + '<\\span>', text[i:], 1) + text = re.sub(span_close, text[:i] + '', text[i:], 1) text = text[:span[0]] + re.sub('> tag lines = text.split('\n') align = "left" @@ -53,12 +53,12 @@ def formalize_text_markup(text): else: break actual_align = "

" % align - if re.search("(<\\\p>|<\\p>)", lines[i]): + if re.search("

", lines[i]): align = 'left' - lines[i] = re.sub('(<\\\p>|<\\p>)', '', lines[i]) + lines[i] = re.sub('

', '', lines[i]) # If not exists any line add paragraph if not re.search('^$', lines[i]): - lines[i] = actual_align + lines[i] + "<\\p>" + lines[i] = actual_align + lines[i] + "

" return '\n'.join(lines) @@ -259,7 +259,7 @@ class RichTextBox(TextBox): locks[tag] = True imark = text_buffer.get_iter_at_mark(end_mark) if imark.ends_tag(self.text_tags[tag]) and locks[tag]: - text_buffer.insert(imark, "<\\%s>" % tag[0]) + text_buffer.insert(imark, "" % tag[0]) locks[tag] = False for tag in ('left', 'right', 'center', 'fill'): imark = text_buffer.get_iter_at_mark(begin_mark) @@ -268,7 +268,7 @@ class RichTextBox(TextBox): locks[tag] = True imark = text_buffer.get_iter_at_mark(end_mark) if imark.ends_tag(self.text_tags[tag]) and locks[tag]: - text_buffer.insert(imark, "<\\p>") + text_buffer.insert(imark, "

") locks[tag] = False for tag in ('font_family', 'size', 'foreground', 'background'): for name, prop in self.font_props[tag].items(): @@ -281,7 +281,7 @@ class RichTextBox(TextBox): imark = text_buffer.get_iter_at_mark(end_mark) if imark.ends_tag(prop) and locks['%s %s' % (tag, name)]: locks['%s %s' % (tag, name)] = False - text_buffer.insert(imark, "<\\span>") + text_buffer.insert(imark, "") imark = text_buffer.get_iter_at_mark(end_mark) if not imark.forward_to_tag_toggle(None): break @@ -312,7 +312,7 @@ class RichTextBox(TextBox): text_buffer.delete(text_buffer.get_iter_at_offset( data_open.start()), text_buffer.get_iter_at_offset( data_open.end())) - close_re = '<\\\%s>' % tag + close_re = '' % tag data_close = re.search(close_re, text) if data_close: text = re.sub(close_re, '', text, 1)