Special char in place's name breaks xdot view

Issue #10174
This commit is contained in:
Paul Franklin 2017-09-24 11:57:35 -07:00
parent e1676aca6d
commit 2b42dd258e
3 changed files with 10 additions and 7 deletions

View File

@ -867,7 +867,8 @@ class FamilyLinesReport(Report):
label += '<TD>'
# at the very least, the label must have the person's name
label += name
name = name.replace('"', '&#34;')
label += name.replace('<', '&#60;').replace('>', '&#62;')
if self.includeid == 1: # same line
label += " (%s)" % p_id
elif self.includeid == 2: # own line
@ -1097,4 +1098,6 @@ class FamilyLinesReport(Report):
place_text = location.get(PlaceType.STATE)
elif location.get(PlaceType.COUNTRY):
place_text = location.get(PlaceType.COUNTRY)
place_text = place_text.replace('<', '&#60;')
place_text = place_text.replace('>', '&#62;')
return place_text

View File

@ -211,6 +211,8 @@ class HourGlassReport(Report):
"""
p_id = person.get_gramps_id()
name = self._name_display.display(person)
name = name.replace('"', '&#34;')
name = name.replace('<', '&#60;').replace('>', '&#62;')
birth_evt = get_birth_or_fallback(self.__db, person)
if birth_evt:

View File

@ -566,11 +566,8 @@ class RelGraphReport(Report):
# at the very least, the label must have the person's name
p_name = self._name_display.display(person)
if self.use_html_output:
# avoid < and > in the name, as this is html text
p_name = p_name.replace('"', '&#34;')
label += p_name.replace('<', '&#60;').replace('>', '&#62;')
else:
label += p_name
p_id = person.get_gramps_id()
if self.includeid == 1: # same line
label += " (%s)" % p_id
@ -719,7 +716,8 @@ class RelGraphReport(Report):
empty string
"""
if event and self.event_choice in [2, 3, 5, 6, 7]:
return _pd.display_event(self._db, event)
place = _pd.display_event(self._db, event)
return place.replace('<', '&#60;').replace('>', '&#62;')
return ''
#------------------------------------------------------------------------