Beispiel #1
0
 def write_years(self):
     for year in self.years:
         year_index = os.path.join(self.sermonlogdir,
                                   str(year),
                                   'index.txt')
         content = []
         content.append(str(year))
         content.append('#' * len(str(year)))
         content.append('')
         content.append('.. toctree::')
         content.append('    :maxdepth: 1')
         content.append('')
         sermons = self.years[year]
         sermons.sort()
         for sermon in sermons:
             content.append('    ' + sermon.year_link)
         conditional_write(year_index, '\n'.join(content))
Beispiel #2
0
 def write_index(self):
     total_index = os.path.join(self.sermonlogdir, 'index.txt')
     content = []
     title = "Reinout's preeksamenvattingen"
     content.append(title)
     content.append('=' * len(title))
     content.append('')
     content.append('Meest recente preken')
     content.append('--------------------')
     content.append('')
     content.append('.. toctree::')
     content.append('    :maxdepth: 1')
     content.append('')
     for sermon in self.recent_ten():
         content.append('    %s' % sermon.full_link)
     content.append('')
     content.append('Jaren')
     content.append('-----')
     content.append('')
     content.append('.. toctree::')
     content.append('    :maxdepth: 1')
     content.append('')
     for year in sorted(self.years.keys()):
         content.append('    %s/index' % year)
     content.append('')
     for info_type in INFO_TYPES:
         if info_type in ['datum', 'toegevoegd', 'tekst']:
             continue
         dirname = INFO_TYPES[info_type].lower()
         title = INFO_TYPES[info_type]
         content.append(title)
         content.append('-' * len(title))
         content.append('')
         info_items = getattr(self, info_type)
         content.append('.. toctree::')
         content.append('    :maxdepth: 1')
         content.append('')
         for info_item in sorted_by_size(info_items):
             content.append('    %s (%s) <%s/%s.txt>' % (
                     info_item, len(info_items[info_item]),
                     dirname, info_item))
         content.append('')
     conditional_write(total_index, '\n'.join(content))
Beispiel #3
0
 def write_overviews(self):
     for info_type in INFO_TYPES:
         if info_type in ['datum', 'toegevoegd', 'tekst']:
             continue
         info_items = getattr(self, info_type)
         for info_item in info_items:
             content = []
             title = info_item
             content.append(title)
             content.append('=' * len(title))
             content.append('')
             content.append('.. toctree::')
             content.append('    :maxdepth: 1')
             content.append('')
             sermons = info_items[info_item]
             sermons.sort()
             for sermon in sermons:
                 content.append('    %s' % sermon.tag_link)
             content.append('')
             filename = os.path.join(self.sermonlogdir,
                                     INFO_TYPES[info_type].lower(),
                                     info_item + '.txt')
             conditional_write(filename, '\n'.join(content))