diff --git a/src/plugins/docgen/CairoDoc.py b/src/plugins/docgen/CairoDoc.py
index 605017d79..13411370e 100644
--- a/src/plugins/docgen/CairoDoc.py
+++ b/src/plugins/docgen/CairoDoc.py
@@ -1084,16 +1084,16 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self._active_element.add_child(GtkDocPagebreak())
def start_bold(self):
- self.write_text('', True)
+ self.__write_text('', markup=True)
def end_bold(self):
- self.write_text('', True)
+ self.__write_text('', markup=True)
def start_superscript(self):
- self.write_text('', True)
+ self.__write_text('', markup=True)
def end_superscript(self):
- self.write_text('', True)
+ self.__write_text('', markup=True)
def start_paragraph(self, style_name, leader=None):
style_sheet = self.get_style_sheet()
@@ -1164,19 +1164,30 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.write_text(line)
self.end_paragraph()
- def write_text(self, text, markup=False):
- """Write a normal piece of text according to the
- present style
- If markup=False, no markup is present, the
- text is escaped in writted
- If markup=True, some markup is present, so
- caller had to escape the text already
+ def __write_text(self, text, mark=None, markup=False):
"""
- if not markup:
- #no pango markup, escape the text as it
- #should not have happened yet
+ @param text: text to write.
+ @param mark: IndexMark to use for indexing (if supported)
+ @param markup: True if text already contains markup info.
+ Then text will no longer be escaped
+ Private method: reports should not add markup in text to override
+ the style
+ """
+ if not markup:
+ # We need to escape the text here for later pango.Layout.set_markup
+ # calls. This way we save the markup created by the report
+ # The markup in the note editor is not in the text so is not
+ # considered. It must be added by pango too
text = escape(text)
self._active_element.add_text(text)
+
+ def write_text(self, text, mark=None):
+ """Write a normal piece of text according to the
+ present style
+ @param text: text to write.
+ @param mark: IndexMark to use for indexing (if supported)
+ """
+ self. __write_text(text, mark)
def add_media_object(self, name, pos, x_cm, y_cm):
new_image = GtkDocPicture(pos, name, x_cm, y_cm)