2006-10-26 Alex Roitman <shura@gramps-project.org>

* help/gramps.pot: Regenerate manual template.
	* src/data/tips.xml.in (family): Escape quotes.
	* src/TipOfDay.py (TipParserescape): Remove: no need to escape here.
	(TipOfDay.escape): Escape here, to allow for gettext lookup. 
	(TipOfDay.next_tip_cb): Escape prior to gettext lookup.



svn: r7441
This commit is contained in:
Alex Roitman
2006-10-27 01:59:33 +00:00
parent 434fbdc38d
commit 00a28ef5c7
4 changed files with 1295 additions and 1289 deletions

View File

@@ -86,13 +86,20 @@ class TipOfDay(ManagedWindow.ManagedWindow):
window.show_all()
def next_tip_cb(self,dummy=None):
self.tip.set_text(_(self.tip_list[self.new_index[self.index]]))
tip_text = self.escape(self.tip_list[self.new_index[self.index]])
self.tip.set_text(_(tip_text))
self.tip.set_use_markup(True)
if self.index >= len(self.tip_list)-1:
self.index = 0
else:
self.index += 1
def escape(self,text):
text = text.replace('&','&amp;'); # Must be first
text = text.replace(' > ',' &gt; ') # Replace standalone > char
text = text.replace('"','&quot;') # quotes
return text
def close_cb(self,dummy=None):
Config.set(Config.USE_TIPS,self.use.get_active())
self.close()
@@ -151,7 +158,7 @@ class TipParser:
def endElement(self,tag):
if tag == "tip" and not self.skip:
text = self.escape(''.join(self.tlist))
text = ''.join(self.tlist)
self.mylist.append(' '.join(text.split()))
elif tag != "tips":
# let all the other tags through, except for the "tips" tag
@@ -159,11 +166,3 @@ class TipParser:
def characters(self, data):
self.tlist.append(data)
def escape(self,text):
"""
The tip's text will be interpreted as a markup, so we need to escape
some special chars.
"""
text = text.replace('&','&amp;'); # Must be first
return text