diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index 044cc2187..8bf5ead67 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -230,7 +230,7 @@ class BasePage: self.up = False # TODO. All of these attributes are not necessary, because we have - # als the options in self.options. Besides, we need to check which + # also the options in self.options. Besides, we need to check which # are still required. self.inc_download = options['incdownload'] self.html_dir = options['target'] @@ -255,34 +255,13 @@ class BasePage: self.photo_list = photo_list self.usegraph = options['graph'] self.graphgens = options['graphgens'] - self.use_home = self.options['homenote'] != "" or \ - self.options['homeimg'] != "" - - def store_file(self, archive, html_dir, from_path, to_path): - if archive: - archive.add(str(from_path), str(to_path)) - else: - dest = os.path.join(html_dir, to_path) - dirname = os.path.dirname(dest) - if not os.path.isdir(dirname): - os.makedirs(dirname) - if from_path != dest: - shutil.copyfile(from_path, dest) - elif self.warn_dir: - WarningDialog( - _("Possible destination error") + "\n" + - _("You appear to have set your target directory " - "to a directory used for data storage. This " - "could create problems with file management. " - "It is recommended that you consider using " - "a different directory to store your generated " - "web pages.")) - self.warn_dir = False + self.use_home = options['homenote'] != "" or \ + options['homeimg'] != "" def copy_media(self, photo, store_ref=True): handle = photo.get_handle() if store_ref: - lnk = (self.cur_name, self.page_title, self.gid) + lnk = (self.cur_fname, self.page_title, self.gid) if handle in self.photo_list: if lnk not in self.photo_list[handle]: self.photo_list[handle].append(lnk) @@ -295,13 +274,13 @@ class BasePage: return (real_path, thumb_path) def create_file(self, name): - self.cur_name = name + self.ext + self.cur_fname = name + self.ext if self.archive: self.string_io = StringIO() of = codecs.EncodedFile(self.string_io, 'utf-8', self.encoding, 'xmlcharrefreplace') else: - page_name = os.path.join(self.html_dir, self.cur_name) + page_name = os.path.join(self.html_dir, self.cur_fname) of = codecs.EncodedFile(open(page_name, "w"), 'utf-8', self.encoding, 'xmlcharrefreplace') return of @@ -320,7 +299,7 @@ class BasePage: """ path = self.build_path(path, name, up) return path + '/' + name + self.ext - + def link_path(self, path, name): path = "%s/%s/%s" % (path, name[0].lower(), name[1].lower()) return path + '/' + name + self.ext @@ -331,7 +310,7 @@ class BasePage: for the first two directory levels. For example 0/2/02c0d8f888f566ae95ffbdca64274b51 """ - self.cur_name = self.link_path(path, name) + self.cur_fname = self.link_path(path, name) if self.archive: self.string_io = StringIO() of = codecs.EncodedFile(self.string_io, 'utf-8', @@ -348,7 +327,7 @@ class BasePage: def close_file(self, of): if self.archive: - tarinfo = tarfile.TarInfo(self.cur_name) + tarinfo = tarfile.TarInfo(self.cur_fname) tarinfo.size = len(self.string_io.getvalue()) tarinfo.mtime = time.time() if os.sys.platform != "win32": @@ -359,7 +338,7 @@ class BasePage: of.close() else: of.close() - self.cur_name = None + self.cur_fname = None def lnkfmt(self, text): """This creates an MD5 hex string to be used as filename.""" @@ -372,7 +351,7 @@ class BasePage: note = db.get_note_from_gramps_id(self.footer) of.write('\t
\n') if self.copyright == 0: @@ -460,7 +439,7 @@ class BasePage: if self.header: note = db.get_note_from_gramps_id(self.header) of.write('\t') - of.write(note.get(markup=True)) + of.write(note.get()) of.write('
\n') of.write('\n\n') @@ -483,7 +462,7 @@ class BasePage: # Define 'self.currentsection' to correctly set navlink item CSS id # 'CurrentSection' for Navigation styling. - # Use 'self.cur_name' to determine 'CurrentSection' for individual + # Use 'self.cur_fname' to determine 'CurrentSection' for individual # elements for Navigation styling. self.currentsection = title @@ -507,33 +486,33 @@ class BasePage: # Because of how this script was originally written, the appropriate section # ID is determined by looking for a directory or HTML file name to associate # with that section. - if "index" in self.cur_name: + if "index" in self.cur_fname: divid = "Home" - elif "introduction" in self.cur_name: + elif "introduction" in self.cur_fname: divid = "Introduction" - elif "surnames" in self.cur_name: + elif "surnames" in self.cur_fname: divid = "Surnames" - elif "srn" in self.cur_name: + elif "srn" in self.cur_fname: divid = "SurnameDetail" - elif "individuals" in self.cur_name: + elif "individuals" in self.cur_fname: divid = "Individuals" - elif "ppl" in self.cur_name: + elif "ppl" in self.cur_fname: divid = "IndividualDetail" - elif "sources" in self.cur_name: + elif "sources" in self.cur_fname: divid = "Sources" - elif "src" in self.cur_name: + elif "src" in self.cur_fname: divid = "SourceDetail" - elif "places" in self.cur_name: + elif "places" in self.cur_fname: divid = "Places" - elif "plc" in self.cur_name: + elif "plc" in self.cur_fname: divid = "PlaceDetail" - elif "gallery" in self.cur_name: + elif "gallery" in self.cur_fname: divid = "Gallery" - elif "img" in self.cur_name: + elif "img" in self.cur_fname: divid = "GalleryDetail" - elif "download" in self.cur_name: + elif "download" in self.cur_fname: divid = "Download" - elif "contact" in self.cur_name: + elif "contact" in self.cur_fname: divid = "Contact" else: divid = '' @@ -556,28 +535,27 @@ class BasePage: if self.currentsection == title: cs = True elif title == "Surnames": - if "srn" in self.cur_name: + if "srn" in self.cur_fname: cs = True elif "Surnames" in self.currentsection: cs = True elif title == "Individuals": - if "ppl" in self.cur_name: + if "ppl" in self.cur_fname: cs = True elif title == "Sources": - if "src" in self.cur_name: + if "src" in self.cur_fname: cs = True elif title == "Places": - if "plc" in self.cur_name: + if "plc" in self.cur_fname: cs = True elif title == "Gallery": - if "img" in self.cur_name: + if "img" in self.cur_fname: cs = True cs = cs and ' id="CurrentSection"' or '' of.write('\t\t\n%s\n' % text) of.write('\t\n') @@ -1623,7 +1602,7 @@ class HomePage(BasePage): note_id = options['homenote'] if note_id: note_obj = db.get_note_from_gramps_id(note_id) - text = note_obj.get(markup=True) + text = note_obj.get() if note_obj.get_format(): of.write('\t
\n%s\n' % text) of.write('\t\n') @@ -1874,7 +1853,7 @@ class ContactPage(BasePage): note_id = options['contactnote'] if note_id: note_obj = db.get_note_from_gramps_id(note_id) - text = note_obj.get(markup=True) + text = note_obj.get() if note_obj.get_format(): text = u"\t\t
%s" % text else: @@ -1977,7 +1956,7 @@ class IndividualPage(BasePage): of.write('\t\t\t\t
%s" % note_text @@ -2570,7 +2548,7 @@ class IndividualPage(BasePage): def get_citation_links(self, source_ref_list): gid_list = [] - lnk = (self.cur_name, self.page_title, self.gid) + lnk = (self.cur_fname, self.page_title, self.gid) text = "" for sref in source_ref_list: