File:  [Repository] / MPIWGWeb / bibliography.py
Revision 1.7.2.4: download - view: text, annotated - select for diffs - revision graph
Tue Nov 22 17:58:27 2005 UTC (18 years, 6 months ago) by dwinter
Branches: r2
minor

    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:     
   22: def formatBiblHelp(self,found,table,id,foundIB=None):
   23:     ret=""
   24:     if not foundIB:
   25:         try:
   26:             foundIB=self.ZSQLInlineSearch(_table=table,id=id)[0]
   27: 
   28:         except:
   29:             return ret
   30:     
   31:     if foundIB.reference_type.lower()=='journal article':
   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: 
   36:         if foundIB.year:
   37:             ret+=getattr(foundIB,'year','')
   38:         ret+=")"
   39:         if foundIB.pages and (not foundIB.pages)=='':
   40:             ret+=": "+foundIB.pages+"."
   41: 
   42:     elif foundIB.reference_type.lower()=='edited book':
   43:         ret+=CRListToSemicolon(foundIB.author)+" (Editor/s). <i>"+foundIB.title+"</i>."
   44:         if foundIB.place_published and (not foundIB.place_published==''):
   45:             ret+=foundIB.place_published+": "
   46:         if foundIB.publisher and (not foundIB.publisher==''):
   47:             ret+=foundIB.publisher+", "
   48:         ret+=getBib(foundIB.year)+"."
   49: 
   50:     elif foundIB.reference_type.lower()=='book section' or foundIB.reference_type.lower()=='in book':
   51:         ret+=getBib(CRListToSemicolon(foundIB.author))+". &quot;"+getBib(foundIB.title)+".&quot; In <i>"+getBib(foundIB.secondary_title)+"</i>"
   52:         if (CRListToSemicolon(foundIB.secondary_author)) and (not CRListToSemicolon(foundIB.secondary_author)==''):
   53:             ret+=", eds.: "+CRListToSemicolon(foundIB.secondary_author)
   54:         ret+=". "
   55:         if foundIB.pages and (not foundIB.pages)=='':
   56:             ret+=foundIB.pages+". "
   57:         if foundIB.place_published and (not foundIB.place_published==''):
   58:             ret+=foundIB.place_published+": "
   59:         if foundIB.publisher and (not foundIB.publisher==''):
   60:             ret+=foundIB.publisher+", "
   61:         ret+=getBib(foundIB.year)+"."
   62:         
   63:     elif foundIB.reference_type.lower()=='book':
   64:         ret+=getBib(CRListToSemicolon(foundIB.author))+". <i>"+getBib(foundIB.title)+"</i>. "
   65:         if foundIB.pages and (not foundIB.pages==''):
   66:             ret+=foundIB.pages+". "
   67:         if foundIB.place_published and (not foundIB.place_published==''):
   68:             ret+=foundIB.place_published+": "
   69:         if foundIB.publisher and (not foundIB.publisher==''):
   70:             ret+=foundIB.publisher+", "
   71:         ret+=getBib(foundIB.year)+"."
   72: 
   73:     elif foundIB.reference_type.lower()=='newspaper article':
   74:         ret+=CRListToSemicolon(foundIB.author)+". &quot;"+foundIB.title+".&quot; <i>"+foundIB.secondary_title+"</i>, "
   75:         ret+=foundIB.date+"."+foundIB.year+","
   76:         if foundIB.pages and (not foundIB.pages==''):
   77:             ret+=foundIB.pages+". "
   78: 
   79: 
   80:             
   81:             
   82:     return ret

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