Clean up work on media_link() and doc_link(). Corrected a lot of single quatation marks to double quoteations.

svn: r13379
This commit is contained in:
Rob G. Healey 2009-10-17 20:54:17 +00:00
parent a5ac560552
commit 054acb7337

View File

@ -125,27 +125,27 @@ from libhtmlbackend import HtmlBackend
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Translatable strings for variables within this plugin # Translatable strings for variables within this plugin
# gettext carries a huge footprint with it. # gettext carries a huge footprint with it.
AHEAD = _('Attributes') AHEAD = _("Attributes")
CITY = _('City') CITY = _("City")
COUNTY = _('County') COUNTY = _("County")
COUNTRY = _('Country') COUNTRY = _("Country")
DHEAD = _('Date') DHEAD = _("Date")
DESCRHEAD = _('Description') DESCRHEAD = _("Description")
LATITUDE = _('Latitude') LATITUDE = _("Latitude")
LOCATIONS = _('Alternate Locations') LOCATIONS = _("Alternate Locations")
LONGITUDE = _('Longitude') LONGITUDE = _("Longitude")
NHEAD = _('Notes') NHEAD = _("Notes")
PARISH = _('Church Parish') PARISH = _("Church Parish")
PHEAD = _('Place') PHEAD = _("Place")
PHONE = _('Phone') PHONE = _("Phone")
POSTAL = _('Postal Code') POSTAL = _("Postal Code")
SHEAD = _('Sources') SHEAD = _("Sources")
ST = _('Status') ST = _("Status")
STATE = _('State/ Province') STATE = _("State/ Province")
STREET = _('Street') STREET = _("Street")
THEAD = _("Type") THEAD = _("Type")
TMPL = _('Temple') TMPL = _("Temple")
VHEAD = _('Value') VHEAD = _("Value")
# define clear blank line for proper styling # define clear blank line for proper styling
fullclear = Html("div", class_ = "fullclear", inline = True) fullclear = Html("div", class_ = "fullclear", inline = True)
@ -415,7 +415,7 @@ class BasePage(object):
#FIXME: following split should be regex to match \n\s*\n instead? #FIXME: following split should be regex to match \n\s*\n instead?
markuptext = self._backend.add_markup_from_styled(text, s_tags, markuptext = self._backend.add_markup_from_styled(text, s_tags,
split='\n\n') split='\n\n')
htmllist = Html("div", id="grampsstylednote") htmllist = Html("div", id = "grampsstylednote")
if format == 1: if format == 1:
#preformatted, retain whitespace. #preformatted, retain whitespace.
#so use \n\n for paragraph detection #so use \n\n for paragraph detection
@ -510,7 +510,7 @@ class BasePage(object):
# if event pages are being created, then hyperlink the event type # if event pages are being created, then hyperlink the event type
if self.inc_events: if self.inc_events:
evt_hyper = Html('a', eventtype, href=url, title=eventtype) evt_hyper = Html("a", eventtype, href=url, title=eventtype)
if not self.noid and gid: if not self.noid and gid:
evt_hyper += Html("span", " [%s] " % gid, class_ = "grampsid", evt_hyper += Html("span", " [%s] " % gid, class_ = "grampsid",
inline = True) inline = True)
@ -603,17 +603,17 @@ class BasePage(object):
trow = Html("tr") trow = Html("tr")
header_row = [ header_row = [
[THEAD, 'LDSType' ], [THEAD, "LDSType"],
[DHEAD, 'LDSDate' ], [DHEAD, "LDSDate"],
[TMPL, 'LDSTemple' ], [TMPL, "LDSTemple"],
[PHEAD, 'LDSPlace' ], [PHEAD, "LDSPlace"],
[ST, 'LDSStatus' ], [ST, "LDSStatus"],
[_('Sealed to '), 'LDSSealed'], [_("Sealed to "), "LDSSealed"],
[SHEAD, 'LDSSources'] [SHEAD, "LDSSources"]
] ]
# finish the label's missing piece # finish the label's missing piece
header_row[5][0] += _('Parents') if LDSType == 'Person' else _('Spouse') header_row[5][0] += _("Parents") if LDSType == "Person" else _("Spouse")
for (label, colclass) in header_row: for (label, colclass) in header_row:
trow += Html("th", label, class_ = "Column%s" % colclass, inline = True) trow += Html("th", label, class_ = "Column%s" % colclass, inline = True)
@ -721,7 +721,7 @@ class BasePage(object):
return trow return trow
# begin summaryarea division # begin summaryarea division
with Html("div", id="summaryarea") as summaryarea: with Html("div", id = "summaryarea") as summaryarea:
# begin address table # begin address table
with Html("table") as table: with Html("table") as table:
@ -838,8 +838,8 @@ class BasePage(object):
return None return None
# begin attributes division and section title # begin attributes division and section title
with Html("div", class_ = "ubsection", id="attributes") as section: with Html("div", class_ = "ubsection", id = "attributes") as section:
section += Html('h4', _('Attributes'), inline = True) section += Html("h4", _("Attributes"), inline = True)
# begin attributes table # begin attributes table
with Html("table", class_ = "infolist attrlist") as table: with Html("table", class_ = "infolist attrlist") as table:
@ -880,7 +880,7 @@ class BasePage(object):
db = self.report.database db = self.report.database
# begin footer division # begin footer division
with Html("div", id="footer") as footer: with Html("div", id = "footer") as footer:
footer_note = self.report.options['footernote'] footer_note = self.report.options['footernote']
if footer_note: if footer_note:
@ -959,7 +959,7 @@ class BasePage(object):
del page[0] del page[0]
# add narrative specific body id # add narrative specific body id
body.attr = 'id="NarrativeWeb"' body.attr = 'id = "NarrativeWeb"'
# create additional meta tags # create additional meta tags
meta = (Html("meta", attr = _META1) + meta = (Html("meta", attr = _META1) +
@ -1030,17 +1030,17 @@ class BasePage(object):
inc_repos = False inc_repos = False
navs = [ navs = [
(self.report.index_fname, _('html|Home'), self.report.use_home), (self.report.index_fname, _("Html|Home"), self.report.use_home),
(self.report.intro_fname, _('Introduction'), self.report.use_intro), (self.report.intro_fname, _("Introduction"), self.report.use_intro),
(self.report.surname_fname, _('Surnames'), True), (self.report.surname_fname, _("Surnames"), True),
('individuals', _('Individuals'), True), ('individuals', _("Individuals"), True),
('places', _('Places'), True), ('places', _("Places"), True),
('events', _('Events'), self.report.inc_events), ('events', _("Events"), self.report.inc_events),
('media', _('Media'), self.create_media), ('media', _("Media"), self.create_media),
('download', _('Download'), self.report.inc_download), ('download', _("Download"), self.report.inc_download),
('contact', _('Contact'), self.report.use_contact), ('contact', _("Contact"), self.report.use_contact),
('sources', _('Sources'), True), ('sources', SHEAD, True),
('repositories', _('Repositories'), inc_repos), ('repositories', _("Repositories"), inc_repos),
] ]
navigation = Html("div", id='navigation') navigation = Html("div", id='navigation')
@ -1063,30 +1063,30 @@ class BasePage(object):
cs = False cs = False
if nav_text == currentsection: if nav_text == currentsection:
cs = True cs = True
elif nav_text == _('Surnames'): elif nav_text == _("Surnames"):
if "srn" in self.report.cur_fname: if "srn" in self.report.cur_fname:
cs = True cs = True
elif _('Surnames') in currentsection: elif _("Surnames") in currentsection:
cs = True cs = True
elif nav_text == _('Individuals'): elif nav_text == _("Individuals"):
if "ppl" in self.report.cur_fname: if "ppl" in self.report.cur_fname:
cs = True cs = True
elif nav_text == _('Sources'): elif nav_text == SHEAD:
if "src" in self.report.cur_fname: if "src" in self.report.cur_fname:
cs = True cs = True
elif nav_text == _('Places'): elif nav_text == _("Places"):
if "plc" in self.report.cur_fname: if "plc" in self.report.cur_fname:
cs = True cs = True
elif nav_text == _('Events'): elif nav_text == _("Events"):
if 'evt' in self.report.cur_fname: if 'evt' in self.report.cur_fname:
cs = True cs = True
elif nav_text == _('Media'): elif nav_text == _("Media"):
if "img" in self.report.cur_fname: if "img" in self.report.cur_fname:
cs = True cs = True
cs = cs and 'class="CurrentSection"' or '' cs = cs and 'class="CurrentSection"' or ''
ul += (Html('li', attr=cs, inline = True) + ul += (Html("li", attr = cs, inline = True) +
Html('a', nav_text, href=url) Html("a", nav_text, href=url)
) )
navigation += ul navigation += ul
@ -1150,11 +1150,9 @@ class BasePage(object):
return None return None
db = self.report.database db = self.report.database
# begin individualgallery division # begin individualgallery division and section title
with Html("div", class_ = "subsection", id="indivgallery") as section: with Html("div", class_ = "subsection", id = "indivgallery") as section:
section += Html("h4", _("Gallery"), inline = True)
# begin section title
section += Html('h4', _('Gallery'), inline = True)
displayed = [] displayed = []
for mediaref in photolist: for mediaref in photolist:
@ -1214,7 +1212,7 @@ class BasePage(object):
db = self.report.database db = self.report.database
# begin narrative division # begin narrative division
with Html("div", class_ = "subsection", id="narrative") as section: with Html("div", class_ = "subsection", id = "narrative") as section:
for notehandle in notelist: for notehandle in notelist:
note = db.get_note_from_handle(notehandle) note = db.get_note_from_handle(notehandle)
@ -1227,7 +1225,7 @@ class BasePage(object):
note_text = unicode(str(note_text), errors='replace') note_text = unicode(str(note_text), errors='replace')
# add section title # add section title
section += Html('h4', _('Narrative'), inline = True) section += Html("h4", _("Narrative"), inline = True)
# attach note # attach note
section += note_text section += note_text
@ -1241,10 +1239,10 @@ class BasePage(object):
return None return None
# begin web links division # begin web links division
with Html("div", class_ = "subsection", id="weblinks") as section: with Html("div", class_ = "subsection", id = "weblinks") as section:
# begin web title # begin web title
title = Html('h4', _('Weblinks'), inline = True) title = Html("h4", _("Web Links"), inline = True)
section += title section += title
# ordered list # ordered list
@ -1257,15 +1255,15 @@ class BasePage(object):
if not descr: if not descr:
descr = uri descr = uri
if url.get_type() == UrlType.EMAIL and not uri.startswith("mailto:"): if url.get_type() == UrlType.EMAIL and not uri.startswith("mailto:"):
ordered += Html('li') + Html('a',descr, href='mailto:%s' % url) ordered += Html("li") + Html("a",descr, href='mailto:%s' % url)
elif url.get_type() == UrlType.WEB_HOME and not uri.startswith("http://"): elif url.get_type() == UrlType.WEB_HOME and not uri.startswith("http://"):
ordered += Html('li') + Html('a', descr, href='http://%s' % url) ordered += Html("li") + Html("a", descr, href='http://%s' % url)
elif url.get_type() == UrlType.WEB_FTP and not uri.startswith("ftp://"): elif url.get_type() == UrlType.WEB_FTP and not uri.startswith("ftp://"):
ordered += Html('li') + Html('a', descr, href='ftp://%s' % url) ordered += Html("li") + Html("a", descr, href='ftp://%s' % url)
else: else:
ordered += Html('li') + Html('a', descr, href=url) ordered += Html("li") + Html("a", descr, href=url)
# return web links to its caller # return web links to its caller
return section return section
@ -1275,7 +1273,7 @@ class BasePage(object):
return None return None
db = self.report.database db = self.report.database
with Html("div", id="sourcerefs", class_ = "subsection") as section: with Html("div", id = "sourcerefs", class_ = "subsection") as section:
section += Html("h4", _("Source References"), inline = True) section += Html("h4", _("Source References"), inline = True)
# begin ordered list # begin ordered list
@ -1311,18 +1309,18 @@ class BasePage(object):
tmp = [] tmp = []
confidence = Utils.confidence.get(sref.confidence, _('Unknown')) confidence = Utils.confidence.get(sref.confidence, _('Unknown'))
if confidence == _('Normal'): if confidence == _("Normal"):
confidence = None confidence = None
for (label, data) in [(_('Date'), _dd.display(sref.date)), for (label, data) in [(DHEAD, _dd.display(sref.date)),
(_('Page'), sref.page), (_("Page"), sref.page),
(_('Confidence'), confidence)]: (_("Confidence"), confidence)]:
if data: if data:
tmp.append("%s: %s" % (label, data)) tmp.append("%s: %s" % (label, data))
notelist = sref.get_note_list() notelist = sref.get_note_list()
for notehandle in notelist: for notehandle in notelist:
note = db.get_note_from_handle(notehandle) note = db.get_note_from_handle(notehandle)
note_text = self.get_note_format(note) note_text = self.get_note_format(note)
tmp.append("%s: %s" % (_('Text'), note_text)) tmp.append("%s: %s" % (_("Text"), note_text))
if len(tmp) > 0: if len(tmp) > 0:
list2 = Html("li") + ( list2 = Html("li") + (
Html("a", ';   '.join(tmp), name = "sref%d%s" % (cindex, key), inline = True) Html("a", ';   '.join(tmp), name = "sref%d%s" % (cindex, key), inline = True)
@ -1338,15 +1336,15 @@ class BasePage(object):
return None return None
# begin references division and title # begin references division and title
with Html("div", class_ = "subsection", id="references") as section: with Html("div", class_ = "subsection", id = "references") as section:
section += Html('h4', _('References'), inline = True) section += Html("h4", _("References"), inline = True)
ordered = Html('ol') ordered = Html('ol')
section += ordered section += ordered
sortlist = sorted(handlelist, key=lambda x:locale.strxfrm(x[1])) sortlist = sorted(handlelist, key=lambda x:locale.strxfrm(x[1]))
for (path, name, gid) in sortlist: for (path, name, gid) in sortlist:
list = Html('li') list = Html("li")
ordered += list ordered += list
# Note. 'path' already has a filename extension # Note. 'path' already has a filename extension
@ -1380,7 +1378,7 @@ class BasePage(object):
person_name = person person_name = person
# 1. start building link to image or person # 1. start building link to image or person
hyper = Html('a', href=url) hyper = Html("a", href=url)
# 2. insert thumbnail if there is one, otherwise insert class = "noThumb" # 2. insert thumbnail if there is one, otherwise insert class = "noThumb"
if thumbnailUrl: if thumbnailUrl:
@ -1411,14 +1409,13 @@ class BasePage(object):
with Html("div", class_ = "thumbnail") as thumbnail: with Html("div", class_ = "thumbnail") as thumbnail:
# begin hyperlink # begin hyperlink
hyper = (Html('a', href=url, title=name) + hyper = (Html("a", href=url, title=name) +
Html('img', src=img_url, alt=name) + Html('img', src=img_url, alt=name) )
(Html("p", inline = True) +
html_escape(name) if usedescr else '')
)
# add hyperlink and description to thumbnail division
thumbnail += hyper thumbnail += hyper
if usedescr:
hyper += Html("p", html_escape(name), inline = True)
# return thumbnail division to its callers # return thumbnail division to its callers
return thumbnail return thumbnail
@ -1430,16 +1427,14 @@ class BasePage(object):
thumbnail = Html("div", class_ = "thumbnail") thumbnail = Html("div", class_ = "thumbnail")
# begin hyperlink # begin hyperlink
hyper = Html('a', href=url, title=name) hyper = Html("a", href = url, title = name)
url = self.report.build_url_image('document.png', 'images', up) thumbnail += hyper
hyper += Html('img', src=url, alt=html_escape(name))
if usedescr:
descr = Html("p", html_escape(name), inline = True)
else:
descr = ''
# add hyperlink and description to thumbnail division url = self.report.build_url_image("document.png", "images", up)
thumbnail += (hyper, descr) hyper += Html("img", src = url, alt = html_escape(name))
if usedescr:
hyper += Html("p", html_escape(name), inline = True)
# return thumbnail division to its callers # return thumbnail division to its callers
return thumbnail return thumbnail
@ -1448,7 +1443,7 @@ class BasePage(object):
url = self.report.build_url_fname_html(handle, 'repo', up) url = self.report.build_url_fname_html(handle, 'repo', up)
# begin hyperlink # begin hyperlink
hyper = Html('a', html_escape(name), href=url, title=name) hyper = Html("a", html_escape(name), href=url, title=name)
if not self.noid and gid: if not self.noid and gid:
hyper += Html("span", '[%s]' % gid, class_ = "grampsid", inline = True) hyper += Html("span", '[%s]' % gid, class_ = "grampsid", inline = True)
@ -1458,7 +1453,7 @@ class BasePage(object):
def place_link(self, handle, name, gid=None, up=False): def place_link(self, handle, name, gid=None, up=False):
url = self.report.build_url_fname_html(handle, 'plc', up) url = self.report.build_url_fname_html(handle, 'plc', up)
hyper = Html('a', html_escape(name), href=url, title=name) hyper = Html("a", html_escape(name), href=url, title=name)
if not self.noid and gid: if not self.noid and gid:
hyper += Html("span", " [%s] " % gid, class_ = "grampsid", inline = True) hyper += Html("span", " [%s] " % gid, class_ = "grampsid", inline = True)
@ -1501,10 +1496,10 @@ class IndividualListPage(BasePage):
showparents = report.options['showparents'] showparents = report.options['showparents']
of = self.report.create_file("individuals") of = self.report.create_file("individuals")
indlistpage, body = self.write_header(_('Individuals')) indlistpage, body = self.write_header(_("Individuals"))
# begin Individuals division # begin Individuals division
with Html("div", class_ = "content", id="Individuals") as individuallist: with Html("div", class_ = "content", id = "Individuals") as individuallist:
body += individuallist body += individuallist
# Individual List page message # Individual List page message
@ -1688,10 +1683,10 @@ class SurnamePage(BasePage):
of = self.report.create_file(name_to_md5(surname), 'srn') of = self.report.create_file(name_to_md5(surname), 'srn')
self.up = True self.up = True
surnamepage, body = self.write_header("%s - %s" % (_('Surname'), surname)) surnamepage, body = self.write_header("%s - %s" % (_("Surname"), surname))
# begin SurnameDetail division # begin SurnameDetail division
with Html("div", class_ = "content", id="SurnameDetail") as surnamedetail: with Html("div", class_ = "content", id = "SurnameDetail") as surnamedetail:
body += surnamedetail body += surnamedetail
# section title # section title
@ -1840,10 +1835,10 @@ class PlaceListPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("places") of = self.report.create_file("places")
placelistpage, body = self.write_header(_('Places')) placelistpage, body = self.write_header(_("Places"))
# begin places division # begin places division
with Html("div", class_ = "content", id="Places") as placelist: with Html("div", class_ = "content", id = "Places") as placelist:
body += placelist body += placelist
# place list page message # place list page message
@ -1866,8 +1861,8 @@ class PlaceListPage(BasePage):
table += thead table += thead
trow = Html("tr") + ( trow = Html("tr") + (
Html("th", _('Letter'), class_ = "ColumnLetter", inline = True), Html("th", _("Letter"), class_ = "ColumnLetter", inline = True),
Html("th", _('Place name|Name'), class_ = "ColumnName", inline = True) Html("th", _("Place name |Name"), class_ = "ColumnName", inline = True)
) )
thead += trow thead += trow
@ -1894,7 +1889,7 @@ class PlaceListPage(BasePage):
last_letter = letter last_letter = letter
trow.attr = 'class = "BeginLetter" ' trow.attr = 'class = "BeginLetter" '
tcell = Html("td", class_ = "olumnLetter", inline = True) + ( tcell = Html("td", class_ = "olumnLetter", inline = True) + (
Html('a', last_letter, name=last_letter, Html("a", last_letter, name=last_letter,
title="Places beginning with letter %s" % last_letter) title="Places beginning with letter %s" % last_letter)
) )
else: else:
@ -1926,10 +1921,10 @@ class PlacePage(BasePage):
of = self.report.create_file(place.get_handle(), 'plc') of = self.report.create_file(place.get_handle(), 'plc')
self.up = True self.up = True
self.page_title = ReportUtils.place_name(db, place_handle) self.page_title = ReportUtils.place_name(db, place_handle)
placepage, body = self.write_header(_('Places')) placepage, body = self.write_header(_("Places"))
# begin PlaceDetail Division # begin PlaceDetail Division
with Html("div", class_ = "content", id="PlaceDetail") as placedetail: with Html("div", class_ = "content", id = "PlaceDetail") as placedetail:
body += placedetail body += placedetail
media_list = place.get_media_list() media_list = place.get_media_list()
@ -1949,7 +1944,7 @@ class PlacePage(BasePage):
if not self.noid: if not self.noid:
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", _('GRAMPS ID'), class_ = "ColumnAttribute", inline = True), Html("td", _("GRAMPS ID"), class_ = "ColumnAttribute", inline = True),
Html("td", place.gramps_id, class_ = "ColumnValue", inline = True) Html("td", place.gramps_id, class_ = "ColumnValue", inline = True)
) )
table += trow table += trow
@ -2017,10 +2012,10 @@ class EventListPage(BasePage):
db = report.database db = report.database
of = self.report.create_file("events") of = self.report.create_file("events")
eventslistpage, body = self.write_header(_('Events')) eventslistpage, body = self.write_header(_("Events"))
# begin events list division # begin events list division
with Html("div", class_ = "content", id="EventList") as eventlist: with Html("div", class_ = "content", id = "EventList") as eventlist:
body += eventlist body += eventlist
msg = _("This page contains an index of all the events in the " msg = _("This page contains an index of all the events in the "
@ -2029,7 +2024,7 @@ class EventListPage(BasePage):
"will take you to that event’s page. Clicking on a " "will take you to that event’s page. Clicking on a "
"person’s name will take you to that person’s page. " "person’s name will take you to that person’s page. "
"The person’s name will only be shown once for their events.") "The person’s name will only be shown once for their events.")
eventlist += Html("p", msg, id="description") eventlist += Html("p", msg, id = "description")
# begin event list table and table head # begin event list table and table head
with Html("table", class_ = "infolist eventlist") as table: with Html("table", class_ = "infolist eventlist") as table:
@ -2137,14 +2132,14 @@ class EventPage(BasePage):
subdirs = True subdirs = True
of = self.report.create_file(evt_ref.ref, 'evt') of = self.report.create_file(evt_ref.ref, 'evt')
eventpage, body = self.write_header(_('Events')) eventpage, body = self.write_header(_("Events"))
# start event page division # start event page division
with Html("div", class_ = "content", id="EventDetail") as eventdetail: with Html("div", class_ = "content", id = "EventDetail") as eventdetail:
body += eventdetail body += eventdetail
# display page itle # display page itle
title = _('%(type)s of %(name)s') % {'type' : evt_type.lower(), title = _("%(type)s of %(name)s") % {'type' : evt_type.lower(),
'name' : self.get_name(person) } 'name' : self.get_name(person) }
# line is in place for Peter Lundgren # line is in place for Peter Lundgren
@ -2317,7 +2312,7 @@ class MediaPage(BasePage):
mediapage, body = self.write_header("%s - %s" % (_('Media'), self.page_title)) mediapage, body = self.write_header("%s - %s" % (_('Media'), self.page_title))
# begin GalleryDetail division # begin GalleryDetail division
mediadetail = Html("div", class_ = "content", id="GalleryDetail") mediadetail = Html("div", class_ = "content", id = "GalleryDetail")
body += mediadetail body += mediadetail
# gallery navigation # gallery navigation
@ -2325,8 +2320,8 @@ class MediaPage(BasePage):
mediadetail += gallerynav mediadetail += gallerynav
if prev: if prev:
gallerynav += self.gallery_nav_link(prev, _('Previous'), True) gallerynav += self.gallery_nav_link(prev, _('Previous'), True)
data = _('<strong id="GalleryCurrent">%(page_number)d</strong> of ' data = _('<strong id = "GalleryCurrent">%(page_number)d</strong> of '
'<strong id="GalleryTotal">%(total_pages)d</strong>' ) % { '<strong id = "GalleryTotal">%(total_pages)d</strong>' ) % {
'page_number' : page_number, 'total_pages' : total_pages } 'page_number' : page_number, 'total_pages' : total_pages }
gallerynav += Html("span", data, id='GalleryPages') gallerynav += Html("span", data, id='GalleryPages')
if next: if next:
@ -2396,15 +2391,15 @@ class MediaPage(BasePage):
mediadisplay += ordered mediadisplay += ordered
while len(_region_items) > 0: while len(_region_items) > 0:
(name, x, y, w, h, linkurl) = _region_items.pop() (name, x, y, w, h, linkurl) = _region_items.pop()
ordered += Html('li', style='left:%d%%; top:%d%%; width:%d%%; height:%d%%;' ordered += Html("li", style='left:%d%%; top:%d%%; width:%d%%; height:%d%%;'
% (x, y, w, h)) +( % (x, y, w, h)) +(
Html('a', name, href=linkurl) Html("a", name, href=linkurl)
) )
# display the image # display the image
if initial_image_path != newpath: if initial_image_path != newpath:
url = self.report.build_url_fname(newpath, None, self.up) url = self.report.build_url_fname(newpath, None, self.up)
mediadisplay += Html('a', href=url) + ( mediadisplay += Html("a", href=url) + (
Html('img', width=new_width, height=new_height, src=url, Html('img', width=new_width, height=new_height, src=url,
alt=html_escape(self.page_title)) alt=html_escape(self.page_title))
) )
@ -2432,7 +2427,7 @@ class MediaPage(BasePage):
if target_exists: if target_exists:
# TODO. Convert disk path to URL # TODO. Convert disk path to URL
url = self.report.build_url_fname(newpath, None, self.up) url = self.report.build_url_fname(newpath, None, self.up)
hyper = Html('a', href=url) hyper = Html("a", href=url)
# TODO. Mixup url and path # TODO. Mixup url and path
# path = convert_disk_path_to_url(path) # path = convert_disk_path_to_url(path)
url = self.report.build_url_fname(path, None, self.up) url = self.report.build_url_fname(path, None, self.up)
@ -2504,7 +2499,7 @@ class MediaPage(BasePage):
mediadetail += fullclear mediadetail += fullclear
# add exif title header # add exif title header
mediadetail += Html('h4', _('Image Exif Tags'), inline = True) mediadetail += Html("h4", _('Image Exif Tags'), inline = True)
# begin exif table # begin exif table
with Html("table", class_ = "exifdata") as table: with Html("table", class_ = "exifdata") as table:
@ -2551,7 +2546,7 @@ class MediaPage(BasePage):
url = self.report.build_url_fname_html(handle, 'img', up) url = self.report.build_url_fname_html(handle, 'img', up)
name = html_escape(name) name = html_escape(name)
hyper = Html('a', name, id=name, href=url, title=name, inline = True) hyper = Html("a", name, id=name, href=url, title=name, inline = True)
# return hyperlink to its callers # return hyperlink to its callers
return hyper return hyper
@ -2624,7 +2619,7 @@ class SurnameListPage(BasePage):
surnamelistpage, body = self.write_header(_('Surnames by person count')) surnamelistpage, body = self.write_header(_('Surnames by person count'))
# begin surnames division # begin surnames division
with Html("div", class_ = "content", id="surnames") as surnamelist: with Html("div", class_ = "content", id = "surnames") as surnamelist:
body += surnamelist body += surnamelist
# page message # page message
@ -2661,13 +2656,13 @@ class SurnameListPage(BasePage):
fname = self.report.surname_fname + self.ext fname = self.report.surname_fname + self.ext
tcell = Html("th", class_ = "ColumnSurname", inline = True) tcell = Html("th", class_ = "ColumnSurname", inline = True)
trow += tcell trow += tcell
hyper = Html('a', _('Surname'), href=fname) hyper = Html("a", _('Surname'), href=fname)
tcell += hyper tcell += hyper
fname = "surnames_count" + self.ext fname = "surnames_count" + self.ext
tcell = Html("th", class_ = "ColumnQuantity", inline = True) tcell = Html("th", class_ = "ColumnQuantity", inline = True)
trow += tcell trow += tcell
hyper = Html('a', _('Number of People'), href=fname) hyper = Html("a", _('Number of People'), href=fname)
tcell += hyper tcell += hyper
# begin table body # begin table body
@ -2701,7 +2696,7 @@ class SurnameListPage(BasePage):
trow.attr = ' class="BeginLetter" ' trow.attr = ' class="BeginLetter" '
tcell = Html("td", class_ = "ColumnLetter", inline = True) + ( tcell = Html("td", class_ = "ColumnLetter", inline = True) + (
Html('a', last_letter, name=last_letter, Html("a", last_letter, name=last_letter,
title="Surnames starting with letter %s" % last_letter) ) title="Surnames starting with letter %s" % last_letter) )
trow += tcell trow += tcell
@ -2729,7 +2724,7 @@ class SurnameListPage(BasePage):
def surname_link(self, fname, name, opt_val=None, up=False): def surname_link(self, fname, name, opt_val=None, up=False):
url = self.report.build_url_fname_html(fname, 'srn', up) url = self.report.build_url_fname_html(fname, 'srn', up)
hyper = Html('a', name, href=url, title=name) hyper = Html("a", name, href=url, title=name)
if opt_val is not None: if opt_val is not None:
hyper += opt_val hyper += opt_val
@ -2749,7 +2744,7 @@ class IntroductionPage(BasePage):
intropage, body = self.write_header(_('Introduction')) intropage, body = self.write_header(_('Introduction'))
# begin Introduction division # begin Introduction division
with Html("div", class_ = "content", id="Introduction") as section: with Html("div", class_ = "content", id = "Introduction") as section:
body += section body += section
introimg = report.add_image('introimg') introimg = report.add_image('introimg')
@ -2786,7 +2781,7 @@ class HomePage(BasePage):
homepage, body = self.write_header(_('html|Home')) homepage, body = self.write_header(_('html|Home'))
# begin home division # begin home division
with Html("div", class_ = "content", id="Home") as section: with Html("div", class_ = "content", id = "Home") as section:
body += section body += section
homeimg = report.add_image('homeimg') homeimg = report.add_image('homeimg')
@ -2823,7 +2818,7 @@ class SourceListPage(BasePage):
sourcelistpage, body = self.write_header(_("Sources")) sourcelistpage, body = self.write_header(_("Sources"))
# begin source list division # begin source list division
with Html("div", class_ = "content", id="Sources") as sourceslist: with Html("div", class_ = "content", id = "Sources") as sourceslist:
body += sourceslist body += sourceslist
# Sort the sources # Sort the sources
@ -2892,7 +2887,7 @@ class SourcePage(BasePage):
sourcepage, body = self.write_header(_('Sources')) sourcepage, body = self.write_header(_('Sources'))
# begin source detail division # begin source detail division
with Html("div", class_ = "content", id="SourceDetail") as section: with Html("div", class_ = "content", id = "SourceDetail") as section:
body += section body += section
media_list = source.get_media_list() media_list = source.get_media_list()
@ -2960,7 +2955,7 @@ class MediaListPage(BasePage):
medialistpage, body = self.write_header(_('Media')) medialistpage, body = self.write_header(_('Media'))
# begin gallery division # begin gallery division
with Html("div", class_ = "content", id="Gallery") as section: with Html("div", class_ = "content", id = "Gallery") as section:
body += section body += section
msg = _("This page contains an index of all the media objects " msg = _("This page contains an index of all the media objects "
@ -3028,7 +3023,7 @@ class MediaListPage(BasePage):
name = html_escape(name) name = html_escape(name)
# begin hyper link # begin hyper link
hyper = Html('a', name, href=url, title=name) hyper = Html("a", name, href=url, title=name)
# return hyperlink to its callers # return hyperlink to its callers
return hyper return hyper
@ -3068,14 +3063,14 @@ class DownloadPage(BasePage):
downloadpage, body = self.write_header(_('Download')) downloadpage, body = self.write_header(_('Download'))
# begin download page and table # begin download page and table
with Html("div", class_ = "content", id="Download") as download: with Html("div", class_ = "content", id = "Download") as download:
body += download body += download
# download page note # download page note
if downloadnote: if downloadnote:
note = db.get_note_from_gramps_id(downloadnote) note = db.get_note_from_gramps_id(downloadnote)
note_text = self.get_note_format(note) note_text = self.get_note_format(note)
download += Html("p", note_text, id="description") download += Html("p", note_text, id = "description")
# begin download table and table head # begin download table and table head
with Html("table", class_ = "infolist download") as table: with Html("table", class_ = "infolist download") as table:
@ -3106,7 +3101,7 @@ class DownloadPage(BasePage):
fname = os.path.basename(dlfname1) fname = os.path.basename(dlfname1)
tcell = Html("td", class_ = "Filename") + ( tcell = Html("td", class_ = "Filename") + (
Html('a', fname, href=dlfname1, alt=dldescr1) Html("a", fname, href=dlfname1, alt=dldescr1)
) )
trow += tcell trow += tcell
@ -3134,7 +3129,7 @@ class DownloadPage(BasePage):
fname = os.path.basename(dlfname2) fname = os.path.basename(dlfname2)
tcell = Html("td", class_ = "Filename") + ( tcell = Html("td", class_ = "Filename") + (
Html('a', fname, href=dlfname2, alt=dldescr2) Html("a", fname, href=dlfname2, alt=dldescr2)
) )
trow += tcell trow += tcell
@ -3172,7 +3167,7 @@ class ContactPage(BasePage):
contactpage, body = self.write_header(_('Contact')) contactpage, body = self.write_header(_('Contact'))
# begin contact division # begin contact division
with Html("div", class_ = "content", id="Contact") as section: with Html("div", class_ = "content", id = "Contact") as section:
body += section body += section
# begin summaryarea division # begin summaryarea division
@ -3203,7 +3198,7 @@ class ContactPage(BasePage):
researcher += Html("span", r.country, id='country', inline = True) researcher += Html("span", r.country, id='country', inline = True)
if r.email: if r.email:
researcher += Html("span", id='email') + ( researcher += Html("span", id='email') + (
Html('a', r.email, href='mailto:%s?subject="from GRAMPS Web Site"' Html("a", r.email, href='mailto:%s?subject="from GRAMPS Web Site"'
% r.email, inline = True) % r.email, inline = True)
) )
@ -3443,9 +3438,9 @@ class IndividualPage(BasePage):
max_size = _HEIGHT*max_in_col + _VGAP*(max_in_col+1) max_size = _HEIGHT*max_in_col + _VGAP*(max_in_col+1)
center = int(max_size/2) center = int(max_size/2)
with Html("div", id="tree", class_ = "subsection") as tree: with Html("div", id = "tree", class_ = "subsection") as tree:
tree += Html('h4', _('Ancestors'), inline = True) tree += Html("h4", _('Ancestors'), inline = True)
with Html("div", id="treeContainer", with Html("div", id = "treeContainer",
style="width:%dpx; height:%dpx;" % style="width:%dpx; height:%dpx;" %
(_XOFFSET+(generations)*_WIDTH+(generations-1)*_HGAP, (_XOFFSET+(generations)*_WIDTH+(generations-1)*_HGAP,
max_size) max_size)
@ -3510,8 +3505,8 @@ class IndividualPage(BasePage):
""" """
# begin Associations division # begin Associations division
with Html("div", class_ = "subsection", id="Associations") as section: with Html("div", class_ = "subsection", id = "Associations") as section:
section += Html('h4', _('Associations'), inline = True) section += Html("h4", _('Associations'), inline = True)
with Html("table", class_ = "infolist assoclist") as table: with Html("table", class_ = "infolist assoclist") as table:
section += table section += table
@ -3571,13 +3566,13 @@ class IndividualPage(BasePage):
child_ped(ol) child_ped(ol)
else: else:
child = db.get_person_from_handle(child_handle) child = db.get_person_from_handle(child_handle)
ol += Html('li') + self.pedigree_person(child) ol += Html("li") + self.pedigree_person(child)
else: else:
child_ped(ol) child_ped(ol)
return ol return ol
def child_ped(ol): def child_ped(ol):
ol += Html('li', class_ = "thisperson", inline = True) + self.name ol += Html("li", class_ = "thisperson", inline = True) + self.name
family = self.pedigree_family() family = self.pedigree_family()
if family: if family:
ol += Html('ol', class_ = "spouselist") + family ol += Html('ol', class_ = "spouselist") + family
@ -3598,25 +3593,25 @@ class IndividualPage(BasePage):
father = None father = None
mother = None mother = None
with Html("div", id="pedigree", class_ = "subsection") as ped: with Html("div", id = "pedigree", class_ = "subsection") as ped:
ped += Html('h4', _('Pedigree'), inline = True) ped += Html("h4", _('Pedigree'), inline = True)
with Html('ol', class_ = "pedigreegen") as pedol: with Html('ol', class_ = "pedigreegen") as pedol:
ped += pedol ped += pedol
if father and mother: if father and mother:
pedfa = Html('li') + self.pedigree_person(father) pedfa = Html("li") + self.pedigree_person(father)
pedol += pedfa pedol += pedfa
with Html('ol') as pedma: with Html('ol') as pedma:
pedfa += pedma pedfa += pedma
pedma += (Html('li', class_ = "spouse") + pedma += (Html("li", class_ = "spouse") +
self.pedigree_person(mother) + self.pedigree_person(mother) +
children_ped(Html('ol')) children_ped(Html('ol'))
) )
elif father: elif father:
pedol += (Html('li') + self.pedigree_person(father) + pedol += (Html("li") + self.pedigree_person(father) +
children_ped(Html('ol')) children_ped(Html('ol'))
) )
elif mother: elif mother:
pedol += (Html('li') + self.pedigree_person(mother) + pedol += (Html("li") + self.pedigree_person(mother) +
children_ped(Html('ol')) children_ped(Html('ol'))
) )
else: else:
@ -3758,8 +3753,8 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
# begin events division and section title # begin events division and section title
with Html("div", class_ = "subsection", id="events") as section: with Html("div", class_ = "subsection", id = "events") as section:
section += Html('h4', _('Events'), inline = True) section += Html("h4", _('Events'), inline = True)
# begin events table # begin events table
with Html("table", class_ = "infolist eventlist") as table: with Html("table", class_ = "infolist eventlist") as table:
@ -3809,8 +3804,8 @@ class IndividualPage(BasePage):
return None return None
# begin addresses division and title # begin addresses division and title
with Html("div", class_ = "subsection", id="Addresses") as section: with Html("div", class_ = "subsection", id = "Addresses") as section:
section += Html('h4', _('Addresses'), inline = True) section += Html("h4", _('Addresses'), inline = True)
# write out addresses() # write out addresses()
section += self.dump_addresses(self.person) section += self.dump_addresses(self.person)
@ -3829,8 +3824,8 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
# begin LDS Ordinance division and section title # begin LDS Ordinance division and section title
with Html("div", class_ = "subsection", id="LDSOrdinance") as section: with Html("div", class_ = "subsection", id = "LDSOrdinance") as section:
section += Html('h4', _('Latter-Day Saints (LDS) Ordinance'), inline = True) section += Html("h4", _('Latter-Day Saints (LDS) Ordinance'), inline = True)
# ump individual LDS ordinance list # ump individual LDS ordinance list
section += self.dump_ordinance(db, self.person) section += self.dump_ordinance(db, self.person)
@ -3846,7 +3841,7 @@ class IndividualPage(BasePage):
child = db.get_person_from_handle(child_handle) child = db.get_person_from_handle(child_handle)
gid = child.gramps_id gid = child.gramps_id
list = Html('li') list = Html("li")
if child_handle in self.ind_list: if child_handle in self.ind_list:
url = self.report.build_url_fname_html(child_handle, 'ppl', True) url = self.report.build_url_fname_html(child_handle, 'ppl', True)
list += self.person_link(url, child, True, gid=gid) list += self.person_link(url, child, True, gid=gid)
@ -3894,8 +3889,8 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
# begin parents division # begin parents division
with Html("div", class_ = "subsection", id="parents") as section: with Html("div", class_ = "subsection", id = "parents") as section:
section += Html('h4', _('Parents'), inline = True) section += Html("h4", _('Parents'), inline = True)
# begin parents table # begin parents table
with Html("table", class_ = "infolist") as table: with Html("table", class_ = "infolist") as table:
@ -4134,8 +4129,8 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
# begin families division and section title # begin families division and section title
with Html("div", class_ = "subsection", id="families") as section: with Html("div", class_ = "subsection", id = "families") as section:
section += Html('h4', _('Families'), inline = True) section += Html("h4", _('Families'), inline = True)
# begin families table # begin families table
with Html("table", class_ = "infolist") as table: with Html("table", class_ = "infolist") as table:
@ -4270,7 +4265,7 @@ class IndividualPage(BasePage):
spouse_handle = ReportUtils.find_spouse(self.person, rel_family) spouse_handle = ReportUtils.find_spouse(self.person, rel_family)
if spouse_handle: if spouse_handle:
spouse = db.get_person_from_handle(spouse_handle) spouse = db.get_person_from_handle(spouse_handle)
pedsp = (Html('li', class_ = "spouse") + pedsp = (Html("li", class_ = "spouse") +
self.pedigree_person(spouse) self.pedigree_person(spouse)
) )
ped += [pedsp] ped += [pedsp]
@ -4282,7 +4277,7 @@ class IndividualPage(BasePage):
pedsp += [childol] pedsp += [childol]
for child_ref in childlist: for child_ref in childlist:
child = db.get_person_from_handle(child_ref.ref) child = db.get_person_from_handle(child_ref.ref)
childol += (Html('li') + childol += (Html("li") +
self.pedigree_person(child) self.pedigree_person(child)
) )
return ped return ped
@ -4376,7 +4371,7 @@ class RepositoryListPage(BasePage):
repolistpage, body = self.write_header(_('Repositories')) repolistpage, body = self.write_header(_('Repositories'))
# begin RepositoryList division # begin RepositoryList division
with Html("div", class_ = "content", id="RepositoryList") as repositorylist: with Html("div", class_ = "content", id = "RepositoryList") as repositorylist:
body += repositorylist body += repositorylist
msg = _("This page contains an index of all the repositories in the " msg = _("This page contains an index of all the repositories in the "
@ -4454,7 +4449,7 @@ class RepositoryPage(BasePage):
repositorypage, body = self.write_header(_('Repositories')) repositorypage, body = self.write_header(_('Repositories'))
# begin RepositoryDetail division and page title # begin RepositoryDetail division and page title
with Html("div", class_ = "content", id="RepositoryDetail") as repositorydetail: with Html("div", class_ = "content", id = "RepositoryDetail") as repositorydetail:
body += repositorydetail body += repositorydetail
# repository name # repository name
@ -5749,7 +5744,7 @@ def alphabet_navigation(db, handle_list, key):
return None return None
# begin alphabet division # begin alphabet division
with Html("div", id="alphabet") as alphabet_nav: with Html("div", id = "alphabet") as alphabet_nav:
num_ltrs = len(sorted_alpha_index) num_ltrs = len(sorted_alpha_index)
nrows = ((num_ltrs // 34) + 1) nrows = ((num_ltrs // 34) + 1)