File:  [Repository] / MPIWGWeb / bibliography.py
Revision 1.7.2.2: download - view: text, annotated - select for diffs - revision graph
Tue Oct 11 13:14:01 2005 UTC (18 years, 8 months ago) by dwinter
Branches: r2
editing publications added

    1: #TO DO author_semi_kolon etc. ersetzen durch Funktionen
    2: def formatBibliography(self,found):
    3:     ret=""
    4:     if found.id_institutsbibliographie and (not found.id_institutsbibliographie==''):
    5:         ret+=formatBiblHelp(self,found,table='institutsbiblio',id=found.id_institutsbibliographie)
    6:     else:
    7:         ret+=formatBiblHelp(self,found,table='bibliography',id=found.id_gen_bib)
    8:     return ret
    9: 
   10: def CRListToSemicolon(list):
   11:     if list:
   12:         return "; ".join(list.split("\n"))
   13:     else:
   14:         return None
   15:     
   16: def getBib(value):
   17:     if value:
   18:         return value
   19:     else:
   20:         return ""
   21: def formatBiblHelp(self,found,table,id,foundIB=None):
   22:     ret=""
   23:     if not foundIB:
   24:         try:
   25:             foundIB=self.ZSQLInlineSearch(_table=table,id=id)[0]
   26: 
   27:         except:
   28:             return ret
   29:     
   30:     if foundIB.reference_type.lower()=='journal article':
   31:         
   32:         ret+=getBib(CRListToSemicolon(foundIB.author))+". &quot;"+getBib(foundIB.title)+". &quot; "+"<i>%s</i>"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
   33:         if not self.ZSQLisEmpty(foundIB.number):
   34:             ret+=foundIB.number+"&nbsp;"
   35:         ret+=foundIB.year+")"
   36:         if foundIB.pages and (not foundIB.pages)=='':
   37:             ret+=": "+foundIB.pages+"."
   38: 
   39:     elif foundIB.reference_type.lower()=='edited book':
   40:         ret+=CRListToSemicolon(foundIB.author)+" (Editor/s). <i>"+foundIB.title+"</i>."
   41:         if foundIB.place_published and (not foundIB.place_published==''):
   42:             ret+=foundIB.place_published+": "
   43:         if foundIB.publisher and (not foundIB.publisher==''):
   44:             ret+=foundIB.publisher+", "
   45:         ret+=foundIB.year+"."
   46: 
   47:     elif foundIB.reference_type.lower()=='book section':
   48:         ret+=getBib(CRListToSemicolon(foundIB.author))+". &quot;"+getBib(foundIB.title)+".&quot; In <i>"+getBib(foundIB.secondary_title)+"</i>"
   49:         if (CRListToSemicolon(foundIB.secondary_author)) and (not CRListToSemicolon(foundIB.secondary_author)==''):
   50:             ret+=", eds.: "+CRListToSemicolon(foundIB.secondary_author)
   51:         ret+=". "
   52:         if foundIB.pages and (not foundIB.pages)=='':
   53:             ret+=foundIB.pages+". "
   54:         if foundIB.place_published and (not foundIB.place_published==''):
   55:             ret+=foundIB.place_published+": "
   56:         if foundIB.publisher and (not foundIB.publisher==''):
   57:             ret+=foundIB.publisher+", "
   58:         ret+=foundIB.year+"."
   59:     elif foundIB.reference_type.lower()=='book':
   60:         ret+=getBib(CRListToSemicolon(foundIB.author))+". <i>"+getBib(foundIB.title)+"</i>. "
   61:         if foundIB.pages and (not foundIB.pages==''):
   62:             ret+=foundIB.pages+". "
   63:         if foundIB.place_published and (not foundIB.place_published==''):
   64:             ret+=foundIB.place_published+": "
   65:         if foundIB.publisher and (not foundIB.publisher==''):
   66:             ret+=foundIB.publisher+", "
   67:         ret+=getBib(foundIB.year)+"."
   68: 
   69:     elif foundIB.reference_type.lower()=='newspaper article':
   70:         ret+=CRListToSemicolon(foundIB.author)+". &quot;"+foundIB.title+".&quot; <i>"+foundIB.secondary_title+"</i>, "
   71:         ret+=foundIB.date+"."+foundIB.year+","
   72:         if foundIB.pages and (not foundIB.pages==''):
   73:             ret+=foundIB.pages+". "
   74: 
   75: 
   76:             
   77:             
   78:     return ret

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>