Logo Search packages:      
Sourcecode: zope-cmfbibliographyat version File versions  Download package

def CMFBibliographyAT::tool::renderers::bibtex::BibtexRenderer::renderEntry (   self,
  entry 
)

renders a BibliographyEntry object in BiBTex format

Definition at line 65 of file bibtex.py.

00065                                 :
        """
        renders a BibliographyEntry object in BiBTex format
        """
        bib_key = self._validKey(entry)
        bibtex = "\n@%s{%s," % \
                 (entry.meta_type[:-9], bib_key)
        # [:-9] assumes we have a "...Reference" type 
        bibtex += "\n  author = {%s}," % \
                  entry.Authors(sep=' and ',
                                lastsep=' and ',
                                format="%F %M %L",
                                abbrev=0,
                                lastnamefirst=0)
        aURLs = self.AuthorURLs(entry)
        if aURLs.find('http') > -1:
            bibtex += "\n  authorURLs = {%s}," % aURLs
        bibtex += "\n  title = {%s}," % entry.Title()
        bibtex += "\n  year = {%s}," % entry.getPublication_year()
        url = entry.getURL()
        if url: bibtex += "\n  URL = {%s}," % url
        bibtex += "\n  abstract = {%s}," % entry.getAbstract()

        if hasattr(entry, 'source_fields') and entry.source_fields:
            source_fields = entry.source_fields
            field_values = [entry.getFieldValue(name) \
                            for name in source_fields]
            for key, value in zip(source_fields, field_values):
                if value:
                    bibtex += "\n  %s = {%s}," % (key, value)

        kws = ', '.join(entry.Subject())
        if kws:
            bibtex += "\n  keywords = {%s}," % kws
        note = entry.getNote()
        if note:
            bibtex += "\n  note = {%s}" % note
        else:
            bibtex = bibtex[:-1] # remove the trialing comma
        bibtex += "\n}\n"
        bibtex = self._normalize(bibtex)
##         bibtex = self._escapeSpecialCharacters(bibtex)


Generated by  Doxygen 1.6.0   Back to index