Annotation of MPIWGWeb/bibliography.py, revision 1.7.2.7
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.7 ! dwinter 10: def CRListToSemicolon(self,listStr,showall=False):
! 11: if listStr:
! 12: listStr.replace(";","\n")
! 13: list=listStr.split("\n")
! 14: if not showall: #filter eigentuemer der hoempage
! 15: for x in list:
! 16:
! 17: if x==self.title: # loesche den Eigentuemer der Hoempage aus der Liste
! 18: del(list[list.index(x)])
! 19:
! 20: if len(list)==0: # kein anderer Autor
! 21: return None
! 22: elif showall:
! 23: return "; ".join(list)
! 24: else:
! 25: return "(joint with %s)"%"; ".join(list)
1.7.2.2 dwinter 26: else:
27: return None
28:
1.1 dwinter 29: def getBib(value):
30: if value:
31: return value
32: else:
33: return ""
1.7.2.7 ! dwinter 34:
! 35: return ret
! 36: def cleanPunctuation(teststr):
! 37: """clean up punktuation"""
! 38: ret=""
! 39: signs="!:;.,?"
! 40: for x in teststr:
! 41: if x in signs:
! 42: if (len(ret)>0) and (ret[-1]==' '):
! 43: ret=ret[0:-1]
! 44: ret+=x
! 45: return ret
! 46:
1.7.2.1 dwinter 47: def formatBiblHelp(self,found,table,id,foundIB=None):
1.1 dwinter 48: ret=""
1.7.2.1 dwinter 49: if not foundIB:
50: try:
51: foundIB=self.ZSQLInlineSearch(_table=table,id=id)[0]
1.1 dwinter 52:
1.7.2.1 dwinter 53: except:
54: return ret
1.1 dwinter 55:
56: if foundIB.reference_type.lower()=='journal article':
1.7.2.7 ! dwinter 57: if CRListToSemicolon(foundIB.author):
! 58: ret+=getBib(CRListToSemicolon(foundIB.author))+". ""
! 59: ret+=getBib(foundIB.title)+". " "+"<i>%s</i>"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
1.1 dwinter 60: if not self.ZSQLisEmpty(foundIB.number):
61: ret+=foundIB.number+" "
1.7.2.4 dwinter 62:
63: if foundIB.year:
64: ret+=getattr(foundIB,'year','')
65: ret+=")"
1.5 dwinter 66: if foundIB.pages and (not foundIB.pages)=='':
1.1 dwinter 67: ret+=": "+foundIB.pages+"."
68:
69: elif foundIB.reference_type.lower()=='edited book':
1.7.2.7 ! dwinter 70: if CRListToSemicolon(self,foundIB.author):
! 71: ret+=CRListToSemicolon(self,foundIB.author)+" (Editor/s). ""
1.7.2.6 dwinter 72: if foundIB.title and (not foundIB.title==""):
1.7.2.5 dwinter 73: ret+="<i>"+foundIB.title+"</i>."
1.6 dwinter 74: if foundIB.place_published and (not foundIB.place_published==''):
1.1 dwinter 75: ret+=foundIB.place_published+": "
1.6 dwinter 76: if foundIB.publisher and (not foundIB.publisher==''):
1.1 dwinter 77: ret+=foundIB.publisher+", "
1.7.2.3 casties 78: ret+=getBib(foundIB.year)+"."
1.1 dwinter 79:
1.7.2.3 casties 80: elif foundIB.reference_type.lower()=='book section' or foundIB.reference_type.lower()=='in book':
1.7.2.7 ! dwinter 81: if CRListToSemicolon(self,foundIB.author):
! 82: ret+=getBib(CRListToSemicolon(self,foundIB.author))+". ""
! 83: ret+=getBib(foundIB.title)+"." In: <i>"+getBib(foundIB.secondary_title)+"</i>"
! 84: if (CRListToSemicolon(self,foundIB.secondary_author,showall=True)) and (not CRListToSemicolon(self,foundIB.secondary_author,showall=True)==''):
! 85: ret+=", eds.: "+CRListToSemicolon(self,foundIB.secondary_author,showall=True)
1.1 dwinter 86: ret+=". "
1.7.2.1 dwinter 87: if foundIB.pages and (not foundIB.pages)=='':
1.1 dwinter 88: ret+=foundIB.pages+". "
1.2 dwinter 89: if foundIB.place_published and (not foundIB.place_published==''):
1.1 dwinter 90: ret+=foundIB.place_published+": "
1.2 dwinter 91: if foundIB.publisher and (not foundIB.publisher==''):
1.1 dwinter 92: ret+=foundIB.publisher+", "
1.7.2.3 casties 93: ret+=getBib(foundIB.year)+"."
1.7.2.6 dwinter 94:
95:
1.1 dwinter 96: elif foundIB.reference_type.lower()=='book':
1.7.2.7 ! dwinter 97: if CRListToSemicolon(self,foundIB.author):
! 98: ret+=getBib(CRListToSemicolon(self,foundIB.author))+". "
! 99: ret+="<i>"+getBib(foundIB.title)+"</i>. "
1.3 dwinter 100: if foundIB.pages and (not foundIB.pages==''):
1.1 dwinter 101: ret+=foundIB.pages+". "
1.7.2.1 dwinter 102: if foundIB.place_published and (not foundIB.place_published==''):
1.1 dwinter 103: ret+=foundIB.place_published+": "
1.7.2.1 dwinter 104: if foundIB.publisher and (not foundIB.publisher==''):
1.1 dwinter 105: ret+=foundIB.publisher+", "
1.7.2.2 dwinter 106: ret+=getBib(foundIB.year)+"."
1.1 dwinter 107:
108: elif foundIB.reference_type.lower()=='newspaper article':
1.7.2.7 ! dwinter 109: if CRListToSemicolon(self,foundIB.author):
! 110: ret+=CRListToSemicolon(self,foundIB.author)+". ""
! 111: ret+=foundIB.title+"." <i>"+foundIB.secondary_title+"</i>, "
1.1 dwinter 112: ret+=foundIB.date+"."+foundIB.year+","
1.7.2.1 dwinter 113: if foundIB.pages and (not foundIB.pages==''):
1.1 dwinter 114: ret+=foundIB.pages+". "
115:
116:
117:
118:
1.7.2.7 ! dwinter 119: return cleanPunctuation(ret)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>