Пример #1
0
 def _get_authors(self):
     authors = []
     for pextag in self.document.getElementsByTagName('pex-dc:creator'):
         affiliations = []
         for auttag in pextag.getElementsByTagName('pex-dc:name'):
             author = xml_to_text(auttag)
             lastname = author.split()[-1]
             givenames = " ".join(author.split()[:-1])
             givenames = collapse_initials(givenames)
             name = "%s, %s" % (lastname, givenames)
             name = safe_title(name)
             for afftag in pextag.getElementsByTagName('pex-dc:affiliation'):
                 affiliations.append(xml_to_text(afftag))
             authors.append((name, affiliations))
     return authors
Пример #2
0
 def _get_authors(self):
     authors = []
     for pextag in self.document.getElementsByTagName('pex-dc:creator'):
         affiliations = []
         for auttag in pextag.getElementsByTagName('pex-dc:name'):
             author = xml_to_text(auttag)
             lastname = author.split()[-1]
             givenames = " ".join(author.split()[:-1])
             givenames = collapse_initials(givenames)
             name = "%s, %s" % (lastname, givenames)
             name = safe_title(name)
             for afftag in pextag.getElementsByTagName(
                     'pex-dc:affiliation'):
                 if afftag:
                     affiliations.append(xml_to_text(afftag))
             authors.append((name, affiliations))
     return authors
Пример #3
0
 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)
             name = '%s, %s' % (surname, given_names)
             name = safe_title(name)
             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))
             collaborations = []
             for collaboration in contrib.getElementsByTagName("collab"):
                 collaborations.append(xml_to_text(collaboration))
             authors.append((name, affiliations, emails, collaborations))
     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)
             name = '%s, %s' % (surname, given_names)
             name = safe_title(name)
             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))
             collaborations = []
             for collaboration in contrib.getElementsByTagName("collab"):
                 collaborations.append(xml_to_text(collaboration))
             authors.append((name, affiliations, emails, collaborations))
     return authors
Пример #5
0
 def test_safe_title(self):
     """Test journal name handling."""
     self.assertEqual(safe_title("García"), "García")
     self.assertEqual(safe_title("a garcía"), "A García")
     self.assertEqual(safe_title("THIS IS A LONG"), "This Is A Long")