Corrected the path for somerights20.gif.
Removed all trailing whitespace. Added a few spaces here and there to improve readability. * src/plugins/NarrativeWeb.py svn: r10225
This commit is contained in:
parent
d7317da933
commit
c7226e1c04
@ -130,33 +130,34 @@ _CHARACTER_SETS = [
|
||||
|
||||
_CC = [
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution" title="Creative '
|
||||
'Commons License - By attribution" src="somerights20.gif" /></a>',
|
||||
'<img alt="Creative Commons License - By attribution" '
|
||||
'title="Creative Commons License - By attribution" '
|
||||
'src="#PATH#images/somerights20.gif" /></a>',
|
||||
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by-nd/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution, No derivations" '
|
||||
'title="Creative Commons License - By attribution, No derivations" '
|
||||
'src="somerights20.gif" /></a>',
|
||||
'src="#PATH#images/somerights20.gif" /></a>',
|
||||
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution, Share-alike" '
|
||||
'title="Creative Commons License - By attribution, Share-alike" '
|
||||
'src="somerights20.gif" /></a>',
|
||||
'src="#PATH#images/somerights20.gif" /></a>',
|
||||
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution, Non-commercial" '
|
||||
'title="Creative Commons License - By attribution, Non-commercial" '
|
||||
'src="somerights20.gif" /></a>',
|
||||
'src="#PATH#images/somerights20.gif" /></a>',
|
||||
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution, Non-commercial, No '
|
||||
'derivations" title="Creative Commons License - By attribution, '
|
||||
'Non-commercial, No derivations" src="somerights20.gif" /></a>',
|
||||
'<img alt="Creative Commons License - By attribution, Non-commercial, No derivations" '
|
||||
'title="Creative Commons License - By attribution, Non-commercial, No derivations" '
|
||||
'src="#PATH#images/somerights20.gif" /></a>',
|
||||
|
||||
'<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/">'
|
||||
'<img alt="Creative Commons License - By attribution, Non-commerical, '
|
||||
'Share-alike" title="Creative Commons License - By attribution, '
|
||||
'Non-commerical, Share-alike" src="somerights20.gif" /></a>'
|
||||
'<img alt="Creative Commons License - By attribution, Non-commerical, Share-alike" '
|
||||
'title="Creative Commons License - By attribution, Non-commerical, Share-alike" '
|
||||
'src="#PATH#images/somerights20.gif" /></a>'
|
||||
]
|
||||
|
||||
_COPY_OPTIONS = [
|
||||
@ -175,21 +176,25 @@ wrapper = TextWrapper()
|
||||
wrapper.break_log_words = True
|
||||
wrapper.width = 20
|
||||
|
||||
# This list of characters defines which hexadecimal entity certain 'special characters' with be transformed into for valid HTML rendering.
|
||||
# The variety of quotes with spaces are to assist in appropriately typesetting curly quotes and apostrophes.
|
||||
# This list of characters defines which hexadecimal entity certain
|
||||
# 'special characters' with be transformed into for valid HTML
|
||||
# rendering. The variety of quotes with spaces are to assist in
|
||||
# appropriately typesetting curly quotes and apostrophes.
|
||||
html_escape_table = {
|
||||
"&": "&",
|
||||
' "': " “",
|
||||
'" ': "” ",
|
||||
" '": " ‘",
|
||||
"' ": "’ ",
|
||||
"&" : "&",
|
||||
' "' : " “",
|
||||
'" ' : "” ",
|
||||
" '" : " ‘",
|
||||
"' " : "’ ",
|
||||
"'s ": "’s ",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
">": ">",
|
||||
"<": "<",
|
||||
'"' : """,
|
||||
"'" : "'",
|
||||
">" : ">",
|
||||
"<" : "<",
|
||||
}
|
||||
# This command then defines the 'html_escape' option for escaping special characters for presentation in HTML based on the above list.
|
||||
|
||||
# This command then defines the 'html_escape' option for escaping
|
||||
# special characters for presentation in HTML based on the above list.
|
||||
def html_escape(text):
|
||||
"""Produce entities within text."""
|
||||
L=[]
|
||||
@ -197,6 +202,7 @@ def html_escape(text):
|
||||
L.append(html_escape_table.get(c,c))
|
||||
return "".join(L)
|
||||
|
||||
|
||||
class BasePage:
|
||||
def __init__(self, title, options, archive, photo_list, gid):
|
||||
self.title_str = title
|
||||
@ -501,12 +507,12 @@ class BasePage:
|
||||
divid = ' id="%s"' % divid
|
||||
of.write('<div%s class="content">\n' % divid)
|
||||
|
||||
def show_link(self,of,lpath,title,path):
|
||||
def show_link(self, of, lpath, title, path):
|
||||
if path:
|
||||
lpath = path + '/' + lpath
|
||||
of.write('<a href="%s%s">%s</a>\n' % (lpath,self.ext,title))
|
||||
of.write('<a href="%s%s">%s</a>\n' % (lpath, self.ext, title))
|
||||
|
||||
def show_navlink(self,of,lpath,title,path):
|
||||
def show_navlink(self, of, lpath, title, path):
|
||||
if path:
|
||||
lpath = path + '/' + lpath
|
||||
|
||||
@ -533,7 +539,7 @@ class BasePage:
|
||||
cs = True
|
||||
|
||||
cs = cs and ' id="CurrentSection"' or ''
|
||||
of.write('\t\t<li%s><a href="%s%s">%s</a></li>\n' % (cs,lpath,self.ext,title))
|
||||
of.write('\t\t<li%s><a href="%s%s">%s</a></li>\n' % (cs, lpath, self.ext, title))
|
||||
|
||||
def display_first_image_as_thumbnail( self, of, db, photolist=None):
|
||||
|
||||
@ -722,7 +728,7 @@ class BasePage:
|
||||
of.write('\t\t</ol>\n')
|
||||
of.write('\t</div>\n')
|
||||
|
||||
def build_path(self, handle,dirroot,up=False):
|
||||
def build_path(self, handle, dirroot, up=False):
|
||||
path = ""
|
||||
if up:
|
||||
path = '../../../%s/%s/%s' % (dirroot,
|
||||
@ -732,11 +738,11 @@ class BasePage:
|
||||
path = "%s/%s/%s" % (dirroot, handle[0].lower(), handle[1].lower())
|
||||
return path
|
||||
|
||||
def build_name(self,path,base):
|
||||
def build_name(self, path, base):
|
||||
name = base
|
||||
if path:
|
||||
return path + "/" + base + self.ext
|
||||
else:
|
||||
return base + self.ext
|
||||
name = path + "/" + name
|
||||
return name + self.ext
|
||||
|
||||
def person_link(self, of,path, name,gid="",up=True):
|
||||
if up:
|
||||
@ -751,23 +757,23 @@ class BasePage:
|
||||
handle = self.lnkfmt(name)
|
||||
dirpath = self.build_path(handle,'srn',up)
|
||||
|
||||
of.write('<a href="%s/%s%s">%s' % (dirpath, handle,self.ext, name))
|
||||
of.write('<a href="%s/%s%s">%s' % (dirpath, handle, self.ext, name))
|
||||
if opt_val != None:
|
||||
of.write(' (%d)' % opt_val)
|
||||
of.write('</a>')
|
||||
|
||||
def galleryNav_link(self,of,handle,name,up=False):
|
||||
dirpath = self.build_path(handle,'img',up)
|
||||
of.write('<a id="%s" href="%s/%s%s">%s</a>' % (html_escape(name),dirpath,handle,self.ext,html_escape(name)))
|
||||
of.write('<a id="%s" href="%s/%s%s">%s</a>' % (html_escape(name), dirpath, handle, self.ext, html_escape(name)))
|
||||
|
||||
def media_ref_link(self,of,handle,name,up=False):
|
||||
dirpath = self.build_path(handle,'img',up)
|
||||
of.write('<a href="%s/%s%s">%s</a>' % (dirpath,handle,self.ext,html_escape(name)))
|
||||
of.write('<a href="%s/%s%s">%s</a>' % (dirpath, handle, self.ext, html_escape(name)))
|
||||
|
||||
def media_link(self, of, handle,path, name,up,usedescr=True):
|
||||
dirpath = self.build_path(handle,'img',up)
|
||||
of.write('\t\t<div class="thumbnail">\n')
|
||||
of.write('\t\t\t<a href="%s/%s%s">' % (dirpath,handle,self.ext))
|
||||
of.write('\t\t\t<a href="%s/%s%s">' % (dirpath, handle, self.ext))
|
||||
of.write('<img src="../../../%s" ' % path)
|
||||
of.write('alt="%s" /></a>\n' % name)
|
||||
if usedescr:
|
||||
@ -776,9 +782,9 @@ class BasePage:
|
||||
|
||||
def doc_link(self, of, handle, name,up,usedescr=True):
|
||||
path = os.path.join('images','document.png')
|
||||
dirpath = self.build_path(handle,'img',up)
|
||||
dirpath = self.build_path(handle, 'img', up)
|
||||
of.write('\t\t<div class="thumbnail">\n')
|
||||
of.write('\t\t\t<a href="%s/%s%s">' % (dirpath,handle,self.ext))
|
||||
of.write('\t\t\t<a href="%s/%s%s">' % (dirpath, handle, self.ext))
|
||||
of.write('<img src="../../../%s" ' % path)
|
||||
of.write('alt="%s" /></a>\n' % html_escape(name))
|
||||
if usedescr:
|
||||
@ -786,16 +792,15 @@ class BasePage:
|
||||
of.write('\t\t</div>\n')
|
||||
|
||||
def source_link(self, of, handle, name,gid="",up=False):
|
||||
dirpath = self.build_path(handle,'src',up)
|
||||
of.write(' href="%s/%s%s">%s' % (dirpath,handle,self.ext,html_escape(name)))
|
||||
dirpath = self.build_path(handle, 'src', up)
|
||||
of.write(' href="%s/%s%s">%s' % (dirpath, handle, self.ext, html_escape(name)))
|
||||
if not self.noid and gid != "":
|
||||
of.write(' <span class="grampsid">[%s]</span>' % gid)
|
||||
of.write('</a>')
|
||||
|
||||
def place_link(self, of, handle, name,gid="",up=False):
|
||||
dirpath = self.build_path(handle,'plc',up)
|
||||
of.write('<a href="%s/%s%s">%s' % (
|
||||
dirpath,handle,self.ext,html_escape(name)))
|
||||
of.write('<a href="%s/%s%s">%s' % (dirpath, handle, self.ext, html_escape(name)))
|
||||
|
||||
if not self.noid and gid != "":
|
||||
of.write(' <span class="grampsid">[%s]</span>' % gid)
|
||||
@ -803,8 +808,7 @@ class BasePage:
|
||||
|
||||
def place_link_str(self, handle, name,gid="",up=False):
|
||||
dirpath = self.build_path(handle,'plc',up)
|
||||
retval = '<a href="%s/%s%s">%s' % (
|
||||
dirpath,handle,self.ext,html_escape(name))
|
||||
retval = '<a href="%s/%s%s">%s' % (dirpath, handle, self.ext, html_escape(name))
|
||||
|
||||
if not self.noid and gid != "":
|
||||
retval = retval + ' <span class="grampsid">[%s]</span>' % gid
|
||||
@ -1550,6 +1554,7 @@ class IntroductionPage(BasePage):
|
||||
of.write('alt="%s" />\n' % obj.get_description())
|
||||
except (IOError, OSError), msg:
|
||||
WarningDialog(_("Could not add photo to page"), str(msg))
|
||||
|
||||
if note_id:
|
||||
note_obj = db.get_note_from_gramps_id(note_id)
|
||||
text = note_obj.get(markup=True)
|
||||
@ -1584,11 +1589,10 @@ class HomePage(BasePage):
|
||||
|
||||
if pic_id:
|
||||
obj = db.get_object_from_gramps_id(pic_id)
|
||||
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
try:
|
||||
(newpath,thumb_path) = self.copy_media(obj,False)
|
||||
(newpath, thumb_path) = self.copy_media(obj, False)
|
||||
self.store_file(archive, self.html_dir,
|
||||
Utils.media_path_full(db,
|
||||
obj.get_path()),
|
||||
@ -1596,7 +1600,7 @@ class HomePage(BasePage):
|
||||
of.write('\t<img ')
|
||||
of.write('src="%s" ' % newpath)
|
||||
of.write('alt="%s" />\n' % obj.get_description())
|
||||
except (IOError,OSError),msg:
|
||||
except (IOError, OSError), msg:
|
||||
WarningDialog(_("Could not add photo to page"), str(msg))
|
||||
|
||||
if note_id:
|
||||
@ -1820,7 +1824,6 @@ class ContactPage(BasePage):
|
||||
if pic_id:
|
||||
obj = db.get_object_from_gramps_id(pic_id)
|
||||
mime_type = obj.get_mime_type()
|
||||
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
try:
|
||||
(newpath, thumb_path) = self.copy_media(obj, False)
|
||||
@ -1828,7 +1831,6 @@ class ContactPage(BasePage):
|
||||
Utils.media_path_full(db,
|
||||
obj.get_path()),
|
||||
newpath)
|
||||
|
||||
of.write('\t\t<img height="200" ')
|
||||
of.write('src="%s" ' % newpath)
|
||||
of.write('alt="%s" />\n' % obj.get_description())
|
||||
|
Loading…
Reference in New Issue
Block a user