def get_note(data, doc_type): """Write and addendum/errata information to the BibTeX note field. Traverse publication_info looking for erratum and addendum in `publication_info.material` field and build a string of references to those publication entries. Returns: string: formatted list of the errata and addenda available for a given record """ notices = ('erratum', 'addendum') entries = [entry for entry in get_value(data, 'publication_info', []) if entry.get('material') in notices] if not entries: return None note_strings = [ text_type('{field}: {journal} {volume}, {pages} {year}').format( field=entry['material'].title(), journal=entry.get('journal_title'), volume=entry.get('journal_volume'), pages=LiteratureReader.get_page_artid_for_publication_info(entry, '--'), year='({})'.format(entry['year']) if 'year' in entry else '' ).strip() for entry in entries ] note_string = '[' + ', '.join(note_strings) + ']' note_string = re.sub(' +', ' ', note_string) # Remove possible multiple spaces return re.sub(',,', ',', note_string) # ... and commas
def get_note(data, doc_type): """Write and addendum/errata information to the BibTeX note field. Traverse publication_info looking for erratum and addendum in `publication_info.material` field and build a string of references to those publication entries. Returns: string: formatted list of the errata and addenda available for a given record """ notices = ('erratum', 'addendum') entries = [entry for entry in get_value(data, 'publication_info', []) if entry.get('material') in notices] if not entries: return None note_strings = [ text_type('{field}: {journal} {volume}, {pages} {year}').format( field=entry['material'].title(), journal=entry.get('journal_title'), volume=entry.get('journal_volume'), pages=LiteratureReader.get_page_artid_for_publication_info(entry, '--'), year='({})'.format(entry['year']) if 'year' in entry else '' ).strip() for entry in entries ] note_string = '[' + ', '.join(note_strings) + ']' note_string = re.sub(' +', ' ', note_string) # Remove possible multiple spaces return re.sub(',,', ',', note_string) # ... and commas
def get_pages(data, doc_type): pub_info = get_best_publication_info(data) return LiteratureReader.get_page_artid_for_publication_info(pub_info, '--')
def get_pages(data, doc_type): pub_info = get_best_publication_info(data) return LiteratureReader.get_page_artid_for_publication_info(pub_info, '--')