self.out.write ("\n") pass def start (self, key, entry): if key is None: key = self.next_key () self.data = "" self.key = '[%s] ' % key extra = self.length - len (self.key) if extra > 0: self.key = self.key + ' ' * extra return def write (self, text, style = None): self.data = self.data + text return def separator (self): self.write (" ") return def end (self): self.data = string.strip (self.data) text = Utils.format (self.data, 79, self.length, self.length) self.out.write (self.key + text [self.length:] + '\n\n') return Autoload.register ('output', 'text', TextFormat)
self.out.write ('<i>%s</i>' % text) elif style == 'emph': self.out.write ('<em>%s</em>' % text) else: self.out.write (text) def start_group (self, id, table = None): self.out.write ('<dl>\n') return def end_group (self): self.out.write ('</dl>\n') self.out.write ('<p align="right"><small>') self.out.write ('Generated by Pybliographer') self.out.write ('</small></p>\n') return def start (self, key, entry): if key is None: key = self.next_key () self.out.write ('<dt>[%s]<dd>' % key) return def separator (self): self.out.write (" ") return Autoload.register ('output', 'HTML', HTML)
def first_last_full_authors (entry, coding): return author_desc (entry, coding, 0, -1) def full_authors (entry, coding): return author_desc (entry, coding, 0, 0) def initials_authors (entry, coding): return author_desc (entry, coding, 1, 0) def first_last_initials_authors (entry, coding): return author_desc (entry, coding, 1, -1) def last_first_initials_authors (entry, coding): return author_desc (entry, coding, 1, 1) Autoload.register ('style', 'abbrv', { 'first_last_full_authors' : first_last_full_authors, 'last_first_full_authors' : last_first_full_authors, 'full_authors' : full_authors, 'first_last_initials_authors' : first_last_initials_authors, 'last_first_initials_authors' : last_first_initials_authors, 'initials_authors' : initials_authors, 'string_keys' : create_string_key, 'bibdb_keys' : create_bibdb_key, 'authoryear_keys' : create_authoryear_key, 'unsrtnum_keys' : create_unsrtnum_key, 'european_date' : standard_date, })
return author_desc (entry, coding, 0, 1) def first_last_full_authors (entry, coding): return author_desc (entry, coding, 0, -1) def full_authors (entry, coding): return author_desc (entry, coding, 0, 0) def initials_authors (entry, coding): return author_desc (entry, coding, 1, 0) def first_last_initials_authors (entry, coding): return author_desc (entry, coding, 1, -1) def last_first_initials_authors (entry, coding): return author_desc (entry, coding, 1, 1) # Line below changed Autoload.register ('style', 'apa4e', { 'first_last_full_authors' : first_last_full_authors, 'last_first_full_authors' : last_first_full_authors, 'full_authors' : full_authors, 'first_last_initials_authors' : first_last_initials_authors, 'last_first_initials_authors' : last_first_initials_authors, 'initials_authors' : initials_authors, 'string_keys' : create_string_key, 'numeric_keys' : create_numeric_key, 'european_date' : standard_date, })
def opener (url, check): base = None if (not check) or (url.url [2] [-4:] == '.med'): base = Medline (url) return base def iterator (url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url [2] [-4:] != '.med': return return MedlineIterator (open (Open.url_to_local (url), 'r')) Autoload.register ('format', 'Medline', {'open' : opener, 'write' : writer, 'iter' : iterator}) ### Local Variables: ### Mode: python ### py-master-file : "test_medline.py" ### End:
return base def iterator(url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url[2][-5:] != '.ovid': return file = open(Open.url_to_local(url)) return OvidLike.OvidLike(file, Config.get('ovid/mapping').data, Config.get('ovid/deftype').data) def writer(iter, output, **argh): mapping = Config.get('ovid/mapping').data OvidLike.writer(iter, output, mapping) return Autoload.register('format', 'Ovid', { 'open': opener, 'write': writer, 'iter': iterator })
def full_authors(entry, coding): return author_desc(entry, coding, 0, 0) def initials_authors(entry, coding): return author_desc(entry, coding, 1, 0) def first_last_initials_authors(entry, coding): return author_desc(entry, coding, 1, -1) def last_first_initials_authors(entry, coding): return author_desc(entry, coding, 1, 1) # Line below changed Autoload.register( 'style', 'apa4e', { 'first_last_full_authors': first_last_full_authors, 'last_first_full_authors': last_first_full_authors, 'full_authors': full_authors, 'first_last_initials_authors': first_last_initials_authors, 'last_first_initials_authors': last_first_initials_authors, 'initials_authors': initials_authors, 'string_keys': create_string_key, 'numeric_keys': create_numeric_key, 'european_date': standard_date, })
if table.has_key (key): suff = ord ('a') while table.has_key (key): suff = suff + 1 if suff > ord ('z'): suff = ord ('a') base = base + 'a' key = Key.Key (table, base + chr (suff)) return Key.Key (table, key) Autoload.register ('key', 'Default', generate_key) class StringStream: ''' This class simulates a stream and stores it into a simple string. ''' def __init__ (self): self.text = '' return def write (self, text): self.text = self.text + text return
return base def iterator (url, check): ''' This methods returns an iterator that will parse the database on the fly (useful for merging or to parse broken databases ''' if check and url.url [2] [-4:] != '.bib': return None # Ouvrir le fichier associe parser = _bibtex.open_file (Open.url_to_local (url), Config.get ('bibtex/strict').data) # create a database to generate correct keys db = Base.DataBase (url) return BibtexIterator (db, parser) Autoload.register ('format', 'BibTeX', {'open' : opener, 'write' : writer, 'iter' : iterator}) ### Local Variables: ### Mode: python ### py-master-file : "ut_bibtex.py" ### End:
else: w = w + 1 if w > l: id = k l = w else: id = 'KEY99' self.out.write ('\\begin{thebibliography}{%s}\n' % id) return def separator (self): self.out.write ('\n\\newblock ') return def end_group (self): self.out.write ('\\end{thebibliography}\n') return def start (self, key, entry): if key is None: key = self.next_key () self.out.write ('\\bibitem[%s]{%s}\n' % (key, entry.key.key)) return Autoload.register ('output', 'LaTeX', LaTeX)
w = w + .5 else: w = w + 1 if w > l: id = k l = w else: id = 'KEY99' self.out.write('\\begin{thebibliography}{%s}\n' % id) return def separator(self): self.out.write('\n\\newblock ') return def end_group(self): self.out.write('\\end{thebibliography}\n') return def start(self, key, entry): if key is None: key = self.next_key() self.out.write('\\bibitem[%s]{%s}\n' % (key, entry.key.key)) return Autoload.register('output', 'LaTeX', LaTeX)