doc2json/jats2json/pmc_utils/back_tag_utils.py
def parse_authors(authors_tag) -> List:
    """The PMC XML has a slightly different format than authors listed in front tag."""
    if not authors_tag:
        return []

    authors = []
    for name_tag in authors_tag.find_all('name', recursive=False):
        surname = name_tag.find('surname')
        given_names = name_tag.find('given-names')
        given_names = given_names.text.split(' ') if given_names else None
        suffix = name_tag.find('suffix')
        authors.append({
            'first': given_names[0] if given_names else '',
            'middle': given_names[1:] if given_names else [],
            'last': surname.text if surname else '',
            'suffix': suffix.text if suffix else ''
        })
    return authors
The PMC XML has a slightly different format than authors listed in front tag.
The PMC XML has a slightly different format than authors listed in front tag.
The PMC XML has a slightly different format than authors listed in front tag .
def parse_authors(authors_tag) -> List:
    if not authors_tag:
        return []
    authors = []
    for name_tag in authors_tag.find_all('name', recursive=False):
        surname = name_tag.find('surname')
        given_names = name_tag.find('given-names')
        given_names = given_names.text.split(' ') if given_names else None
        suffix = name_tag.find('suffix')
        authors.append({
            'first': given_names[0] if given_names else '',
            'middle': given_names[1:] if given_names else [],
            'last': surname.text if surname else '',
            'suffix': suffix.text if suffix else ''
        })
    return authors
def parse_authors ( authors_tag ) -> List : if not authors_tag : return [ ] authors = [ ] for name_tag in authors_tag . find_all ( 'name' , recursive = False ) : surname = name_tag . find ( 'surname' ) given_names = name_tag . find ( 'given-names' ) given_names = given_names . text . split ( ' ' ) if given_names else None suffix = name_tag . find ( 'suffix' ) authors . append ( { 'first' : given_names [ 0 ] if given_names else '' , 'middle' : given_names [ 1 : ] if given_names else [ ] , 'last' : surname . text if surname else '' , 'suffix' : suffix . text if suffix else '' } ) return authors
The PMC XML has a slightly different format than authors listed in front tag.
The PMC XML has a slightly different format than authors listed in front tag .
"""The PMC XML has a slightly different format than authors listed in front tag."""
authors_tag