--- MPIWGWeb/bibliography.py 2006/09/07 11:06:41 1.7.2.7
+++ MPIWGWeb/bibliography.py 2009/02/18 13:01:17 1.8
@@ -7,22 +7,9 @@ def formatBibliography(self,found):
ret+=formatBiblHelp(self,found,table='bibliography',id=found.id_gen_bib)
return ret
-def CRListToSemicolon(self,listStr,showall=False):
- if listStr:
- listStr.replace(";","\n")
- list=listStr.split("\n")
- if not showall: #filter eigentuemer der hoempage
- for x in list:
-
- if x==self.title: # loesche den Eigentuemer der Hoempage aus der Liste
- del(list[list.index(x)])
-
- if len(list)==0: # kein anderer Autor
- return None
- elif showall:
- return "; ".join(list)
- else:
- return "(joint with %s)"%"; ".join(list)
+def CRListToSemicolon(list):
+ if list:
+ return "; ".join(list.split("\n"))
else:
return None
@@ -31,32 +18,18 @@ def getBib(value):
return value
else:
return ""
-
- return ret
-def cleanPunctuation(teststr):
- """clean up punktuation"""
- ret=""
- signs="!:;.,?"
- for x in teststr:
- if x in signs:
- if (len(ret)>0) and (ret[-1]==' '):
- ret=ret[0:-1]
- ret+=x
- return ret
-
+
def formatBiblHelp(self,found,table,id,foundIB=None):
ret=""
if not foundIB:
try:
- foundIB=self.ZSQLInlineSearch(_table=table,id=id)[0]
+ foundIB=self.ZSQLInlineSearch(_table=table,id=id,_op_id="eq")[0]
except:
return ret
if foundIB.reference_type.lower()=='journal article':
- if CRListToSemicolon(foundIB.author):
- ret+=getBib(CRListToSemicolon(foundIB.author))+". ""
- ret+=getBib(foundIB.title)+". " "+"%s"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
+ ret+=getBib(CRListToSemicolon(foundIB.author))+". ""+getBib(foundIB.title)+". " "+"%s"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
if not self.ZSQLisEmpty(foundIB.number):
ret+=foundIB.number+" "
@@ -67,10 +40,10 @@ def formatBiblHelp(self,found,table,id,f
ret+=": "+foundIB.pages+"."
elif foundIB.reference_type.lower()=='edited book':
- if CRListToSemicolon(self,foundIB.author):
- ret+=CRListToSemicolon(self,foundIB.author)+" (Editor/s). ""
+ if foundIB.author:
+ ret+=CRListToSemicolon(foundIB.author)+" (Editor/s). "
if foundIB.title and (not foundIB.title==""):
- ret+=""+foundIB.title+"."
+ ret+=""+foundIB.title+". "
if foundIB.place_published and (not foundIB.place_published==''):
ret+=foundIB.place_published+": "
if foundIB.publisher and (not foundIB.publisher==''):
@@ -78,11 +51,9 @@ def formatBiblHelp(self,found,table,id,f
ret+=getBib(foundIB.year)+"."
elif foundIB.reference_type.lower()=='book section' or foundIB.reference_type.lower()=='in book':
- if CRListToSemicolon(self,foundIB.author):
- ret+=getBib(CRListToSemicolon(self,foundIB.author))+". ""
- ret+=getBib(foundIB.title)+"." In: "+getBib(foundIB.secondary_title)+""
- if (CRListToSemicolon(self,foundIB.secondary_author,showall=True)) and (not CRListToSemicolon(self,foundIB.secondary_author,showall=True)==''):
- ret+=", eds.: "+CRListToSemicolon(self,foundIB.secondary_author,showall=True)
+ ret+=getBib(CRListToSemicolon(foundIB.author))+". ""+getBib(foundIB.title)+"." In: "+getBib(foundIB.secondary_title)+""
+ if (CRListToSemicolon(foundIB.secondary_author)) and (not CRListToSemicolon(foundIB.secondary_author)==''):
+ ret+=", eds.: "+CRListToSemicolon(foundIB.secondary_author)
ret+=". "
if foundIB.pages and (not foundIB.pages)=='':
ret+=foundIB.pages+". "
@@ -94,11 +65,9 @@ def formatBiblHelp(self,found,table,id,f
elif foundIB.reference_type.lower()=='book':
- if CRListToSemicolon(self,foundIB.author):
- ret+=getBib(CRListToSemicolon(self,foundIB.author))+". "
- ret+=""+getBib(foundIB.title)+". "
- if foundIB.pages and (not foundIB.pages==''):
- ret+=foundIB.pages+". "
+ ret+=getBib(CRListToSemicolon(foundIB.author))+". "+getBib(foundIB.title)+". "
+# if foundIB.pages and (not foundIB.pages==''):
+#% ret+=foundIB.pages+". "
if foundIB.place_published and (not foundIB.place_published==''):
ret+=foundIB.place_published+": "
if foundIB.publisher and (not foundIB.publisher==''):
@@ -106,14 +75,21 @@ def formatBiblHelp(self,found,table,id,f
ret+=getBib(foundIB.year)+"."
elif foundIB.reference_type.lower()=='newspaper article':
- if CRListToSemicolon(self,foundIB.author):
- ret+=CRListToSemicolon(self,foundIB.author)+". ""
- ret+=foundIB.title+"." "+foundIB.secondary_title+", "
+ ret+=CRListToSemicolon(foundIB.author)+". ""+foundIB.title+"." "+foundIB.secondary_title+", "
ret+=foundIB.date+"."+foundIB.year+","
if foundIB.pages and (not foundIB.pages==''):
ret+=foundIB.pages+". "
+ elif foundIB.reference_type.lower()=='magazine article':
+ ret+=CRListToSemicolon(foundIB.author)+". ""+foundIB.title+"." "+foundIB.secondary_title+", "
+ if foundIB.date:
+ ret+=foundIB.date+"."
+ if foundIB.year:
+ ret+=foundIB.year+","
+ if foundIB.pages and (not foundIB.pages==''):
+ ret+=foundIB.pages+". "
+
- return cleanPunctuation(ret)
+ return ret