def test_appendix_supplement_ap(self): elements = title_parsing.appendix_supplement({ 'index': ['204', 'A2'], 'title': 'Appendix A2 to 204-First Appendix'}) self.assertTrue(elements['is_appendix']) elements = title_parsing.appendix_supplement({ 'index': ['204', 'A'], 'title': 'Appendix A to 204-First Appendix'}) self.assertTrue(elements['is_appendix'])
def test_appendix_supplement_ap(self): elements = title_parsing.appendix_supplement({ 'index': ['204', 'A2'], 'title': 'Appendix A2 to 204-First Appendix' }) self.assertTrue(elements['is_appendix']) elements = title_parsing.appendix_supplement({ 'index': ['204', 'A'], 'title': 'Appendix A to 204-First Appendix' }) self.assertTrue(elements['is_appendix'])
def toc_sect_appendix(data, so_far): """Transforms normal sections and appendices""" title_data = title_parsing.section(data) if title_data: data.update(title_data) title_data = title_parsing.appendix_supplement(data) if title_data: data.update(title_data) if 'label' not in data: data['label'] = data['title'] if data.get('is_appendix'): seen_appendix = any(el.get('is_appendix') for el in so_far) data['is_first_appendix'] = not seen_appendix return data
def toc_sect_appendix(data, so_far): """Transforms normal sections and appendices""" title_data = title_parsing.section(data) if title_data: data.update(title_data) title_data = title_parsing.appendix_supplement(data) if title_data: data.update(title_data) if 'label' not in data: data['label'] = data['title'] if data.get('is_appendix'): seen_appendix = any(el.get('is_appendix') for el in so_far) data['is_first_appendix'] = not seen_appendix return data
def appendix_supplement(element, data, seen_appendix=False): as_data = title_parsing.appendix_supplement(data) if as_data: element.update(as_data) if element.get('is_appendix'): element['is_first_appendix'] = not seen_appendix
def appendix_supplement(element, data, seen_appendix=False): as_data = title_parsing.appendix_supplement(data) if as_data: element.update(as_data) if element.get('is_appendix'): element['is_first_appendix'] = not seen_appendix