def _get_authors(self):
     authors = []
     for tag in self.document.getElementsByTagName('dc:creator'):
         author = xml_to_text(tag)
         lastname = author.split()[-1]
         givenames = author.split()[:-1]
         lastname, givenames = fix_name_capitalization(lastname, givenames)
         givenames = collapse_initials(givenames)
         authors.append("%s, %s" % (lastname, givenames))
     return authors
 def _get_authors(self):
     authors = []
     for contrib in self.document.getElementsByTagName('contrib'):
         if contrib.getAttribute('contrib-type') == 'author':
             surname = get_value_in_tag(contrib, 'surname')
             given_names = get_value_in_tag(contrib, 'given-names')
             given_names = collapse_initials(given_names)
             surname, given_names = fix_name_capitalization(
                 surname, given_names.split()
             )
             name = '%s, %s' % (surname, given_names)
             affiliations = []
             for aff in contrib.getElementsByTagName('aff'):
                 affiliations.append(xml_to_text(aff))
             emails = []
             for email in contrib.getElementsByTagName('email'):
                 emails.append(xml_to_text(email))
             authors.append((name, affiliations, emails))
     return authors
Beispiel #3
0
 def test_fix_name_capitalization(self):
     self.assertEqual(fix_name_capitalization("NORTON", ["EDWARD"]), ("Norton", "Edward"))
     self.assertEqual(fix_name_capitalization("NORTON", ["E.", "A.", "S."]), ("Norton", "E. A. S."))
     self.assertEqual(fix_name_capitalization("EL-NORTON", ["EDWARD"]), ("El-Norton", "Edward"))
     self.assertEqual(fix_name_capitalization("VAN ASSCHE", ["WALTER"]), ("Van Assche", "Walter"))
 def test_fix_name_capitalization(self):
     self.assertEqual(fix_name_capitalization("NORTON", ["EDWARD"]), ("Norton", "Edward"))
     self.assertEqual(fix_name_capitalization("NORTON", ["E.", "A.", "S."]), ("Norton", "E. A. S."))
     self.assertEqual(fix_name_capitalization("EL-NORTON", ["EDWARD"]), ("El-Norton", "Edward"))