File:  [Repository] / MPIWGWeb / bibliography.py
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Fri Jul 30 10:33:01 2004 UTC (19 years, 9 months ago) by dwinter
Branches: MAIN
CVS tags: HEAD
minors


def formatBibliography(self,found):
    ret=""
    if found.id_institutsbibliographie and (not found.id_institutsbibliographie==''):
        ret+=formatBiblHelp(self,found,table='institutsbiblio',id=found.id_institutsbibliographie)
    else:
        ret+=formatBiblHelp(self,found,table='bibliography',id=found.id_gen_bib)
    return ret

def getBib(value):
    if value:
        return value
    else:
        return ""
def formatBiblHelp(self,found,table,id):
    ret=""
    try:
        foundIB=self.ZSQLInlineSearch(_table=table,id=id)[0]

    except:
        return ret
    
    if foundIB.reference_type.lower()=='journal article':
        
        ret+=getBib(foundIB.author_semi_colon)+". &quot;"+getBib(foundIB.title)+". &quot; "+"<i>%s</i>"%getBib(foundIB.secondary_title)+" "+getBib(foundIB.volume)+" ("
        if not self.ZSQLisEmpty(foundIB.number):
            ret+=foundIB.number+"&nbsp;"
        ret+=foundIB.year+")"
        if not foundIB.pages=='':
            ret+=": "+foundIB.pages+"."

    elif foundIB.reference_type.lower()=='edited book':
        ret+=foundIB.author_semi_colon+" (Editor/s). <i>"+foundIB.title+"</i>."
        if not foundIB.place_published=='':
            ret+=foundIB.place_published+": "
        if not foundIB.publisher=='':
            ret+=foundIB.publisher+", "
        ret+=foundIB.year+"."

    elif foundIB.reference_type.lower()=='book section':
        ret+=foundIB.author_semi_colon+". &quot;"+foundIB.title+".&quot; In <i>"+foundIB.secondary_title+"</i>"
        if not foundIB.secondary_author_semi_colon=='':
            ret+=", eds.: "+foundIB.secondary_author_semi_colon
        ret+=". "
        if 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==''):
            ret+=foundIB.publisher+", "
        ret+=foundIB.year+"."
    elif foundIB.reference_type.lower()=='book':
        ret+=foundIB.author_semi_colon+". <i>"+foundIB.title+"</i>. "
        if foundIB.pages and (not foundIB.pages==''):
            ret+=foundIB.pages+". "
        if not foundIB.place_published=='':
            ret+=foundIB.place_published+": "
        if not foundIB.publisher=='':
            ret+=foundIB.publisher+", "
        ret+=foundIB.year+"."

    elif foundIB.reference_type.lower()=='newspaper article':
        ret+=foundIB.author_semi_colon+". &quot;"+foundIB.title+".&quot; <i>"+foundIB.secondary_title+"</i>, "
        ret+=foundIB.date+"."+foundIB.year+","
        if not foundIB.pages=='':
            ret+=foundIB.pages+". "


            
            
    return ret

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