def full_org_ascii_name(a): org = a.find('organization') if org == None: return '' if is_script(org.text, 'Latin'): org_name = org.text else: org_name = org.get('ascii') or '' return org_name
def short_author_name_set(a): name = short_author_name(a) if name: if is_script(name, 'Latin'): ascii = None else: ascii = short_author_ascii_name(a) if name == ascii: ascii = None return name, ascii
def ref_author_name_last(a): """ Returns a tuple, with the second set only if the first part has non-Latin codepoints. The initials and surname order is as needed for the last author name in a list of reference author names. """ name = short_author_name(a) if name: if is_script(name, 'Latin'): ascii = None else: ascii = short_author_ascii_name(a) else: name = short_org_name(a) if is_script(name, 'Latin'): ascii = None else: ascii = short_org_ascii_name() if name == ascii: ascii = None return name, ascii
def full_author_name(a, latin=False): if latin: return full_author_ascii_name(a) fullname = a.get('fullname') if fullname: return fullname else: initials = get_initials(a) surname = a.get('surname') if initials and not initials.endswith('.') and is_script( initials, 'Latin'): initials += '.' return ' '.join(n for n in [initials, surname] if n)
def ref_author_name_first(a): """ Returns a tuple, with the second set only if the first part has non-Latin codepoints. The initials and surname order is as needed for the first and following reference author names, but not for the last author. """ i, s = short_author_name_parts(a) name = ', '.join(p for p in [s, i] if p) if name: if is_script(name, 'Latin'): ascii = None else: i, s = short_author_ascii_name_parts(a) ascii = ', '.join(p for p in [s, i] if p) else: name = short_org_name(a) if is_script(name, 'Latin'): ascii = None else: ascii = short_org_ascii_name(a) if name == ascii: ascii = None return name, ascii
def short_author_name_parts(a): initials = get_initials(a) surname = a.get('surname') if initials != None and surname != None: if initials and not initials.endswith('.') and is_script( initials, 'Latin'): initials += '.' parts = [initials, surname] else: fullname = a.get('fullname') or '' if fullname: if len(fullname.split()) > 1: parts = fullname.split() initials = ' '.join(["%s." % n[0].upper() for n in parts[:-1]]) surname = parts[-1] parts = [initials, surname] else: parts = [None, fullname] else: parts = [None, None] return parts