Annotation of MPIWGWeb/bibliography.py, revision 1.7.2.10

1.7.2.2   dwinter     1: #TO DO author_semi_kolon etc. ersetzen durch Funktionen
1.1       dwinter     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: 
1.7.2.8   dwinter    10: def CRListToSemicolon(list):
                     11:     if list:
                     12:         return "; ".join(list.split("\n"))
1.7.2.2   dwinter    13:     else:
                     14:         return None
                     15:     
1.1       dwinter    16: def getBib(value):
                     17:     if value:
                     18:         return value
                     19:     else:
                     20:         return ""
1.7.2.8   dwinter    21:     
1.7.2.1   dwinter    22: def formatBiblHelp(self,found,table,id,foundIB=None):
1.1       dwinter    23:     ret=""
1.7.2.1   dwinter    24:     if not foundIB:
                     25:         try:
1.7.2.9   dwinter    26:             foundIB=self.ZSQLInlineSearch(_table=table,id=id,_op_id="eq")[0]
1.1       dwinter    27: 
1.7.2.1   dwinter    28:         except:
                     29:             return ret
1.1       dwinter    30:     
                     31:     if foundIB.reference_type.lower()=='journal article':
1.7.2.8   dwinter    32:         ret+=getBib(CRListToSemicolon(foundIB.author))+". &quot;"+getBib(foundIB.title)+". &quot; "+"<i>%s</i>"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
1.1       dwinter    33:         if not self.ZSQLisEmpty(foundIB.number):
                     34:             ret+=foundIB.number+"&nbsp;"
1.7.2.4   dwinter    35: 
                     36:         if foundIB.year:
                     37:             ret+=getattr(foundIB,'year','')
                     38:         ret+=")"
1.5       dwinter    39:         if foundIB.pages and (not foundIB.pages)=='':
1.1       dwinter    40:             ret+=": "+foundIB.pages+"."
                     41: 
                     42:     elif foundIB.reference_type.lower()=='edited book':
1.7.2.8   dwinter    43:         if foundIB.author:
                     44:             ret+=CRListToSemicolon(foundIB.author)+" (Editor/s). " 
1.7.2.6   dwinter    45:         if foundIB.title and (not foundIB.title==""):
1.7.2.8   dwinter    46:             ret+="<i>"+foundIB.title+"</i>. "
1.6       dwinter    47:         if foundIB.place_published and (not foundIB.place_published==''):
1.1       dwinter    48:             ret+=foundIB.place_published+": "
1.6       dwinter    49:         if foundIB.publisher and (not foundIB.publisher==''):
1.1       dwinter    50:             ret+=foundIB.publisher+", "
1.7.2.3   casties    51:         ret+=getBib(foundIB.year)+"."
1.1       dwinter    52: 
1.7.2.3   casties    53:     elif foundIB.reference_type.lower()=='book section' or foundIB.reference_type.lower()=='in book':
1.7.2.8   dwinter    54:         ret+=getBib(CRListToSemicolon(foundIB.author))+". &quot;"+getBib(foundIB.title)+".&quot; In: <i>"+getBib(foundIB.secondary_title)+"</i>"
                     55:         if (CRListToSemicolon(foundIB.secondary_author)) and (not CRListToSemicolon(foundIB.secondary_author)==''):
                     56:             ret+=", eds.: "+CRListToSemicolon(foundIB.secondary_author)
1.1       dwinter    57:         ret+=". "
1.7.2.1   dwinter    58:         if foundIB.pages and (not foundIB.pages)=='':
1.1       dwinter    59:             ret+=foundIB.pages+". "
1.2       dwinter    60:         if foundIB.place_published and (not foundIB.place_published==''):
1.1       dwinter    61:             ret+=foundIB.place_published+": "
1.2       dwinter    62:         if foundIB.publisher and (not foundIB.publisher==''):
1.1       dwinter    63:             ret+=foundIB.publisher+", "
1.7.2.3   casties    64:         ret+=getBib(foundIB.year)+"."
1.7.2.6   dwinter    65: 
                     66:    
1.1       dwinter    67:     elif foundIB.reference_type.lower()=='book':
1.7.2.8   dwinter    68:         ret+=getBib(CRListToSemicolon(foundIB.author))+". <i>"+getBib(foundIB.title)+"</i>. "
                     69: #       if foundIB.pages and (not foundIB.pages==''):
                     70: #%            ret+=foundIB.pages+". "
1.7.2.1   dwinter    71:         if foundIB.place_published and (not foundIB.place_published==''):
1.1       dwinter    72:             ret+=foundIB.place_published+": "
1.7.2.1   dwinter    73:         if foundIB.publisher and (not foundIB.publisher==''):
1.1       dwinter    74:             ret+=foundIB.publisher+", "
1.7.2.2   dwinter    75:         ret+=getBib(foundIB.year)+"."
1.1       dwinter    76: 
                     77:     elif foundIB.reference_type.lower()=='newspaper article':
1.7.2.8   dwinter    78:         ret+=CRListToSemicolon(foundIB.author)+". &quot;"+foundIB.title+".&quot; <i>"+foundIB.secondary_title+"</i>, "
1.1       dwinter    79:         ret+=foundIB.date+"."+foundIB.year+","
1.7.2.1   dwinter    80:         if foundIB.pages and (not foundIB.pages==''):
1.1       dwinter    81:             ret+=foundIB.pages+". "
1.7.2.10! dwinter    82:     elif foundIB.reference_type.lower()=='magazine article':
        !            83:         ret+=CRListToSemicolon(foundIB.author)+". &quot;"+foundIB.title+".&quot; <i>"+foundIB.secondary_title+"</i>, "
        !            84:         ret+=foundIB.date+"."+foundIB.year+","
        !            85:         if foundIB.pages and (not foundIB.pages==''):
        !            86:             ret+=foundIB.pages+". "
1.1       dwinter    87: 
                     88: 
                     89:             
                     90:             
1.7.2.8   dwinter    91:     return ret

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