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'])
示例#2
0
 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'])
示例#3
0
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
示例#4
0
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
示例#5
0
 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
示例#6
0
 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