'Generate content/ByDateRead.html.
Create self.bookmarked_books_by_date_read from self.bookmarked_books.
Loop through self.bookmarked_books_by_date_read, generate HTML.
Input:
bookmarked_books_by_date_read (list)
Output:
content/ByDateRead.html (file)'

def generate_html_by_date_read(self):

    def _add_books_to_html_by_day(todays_list, dtc):
        if len(todays_list):
            date_string = strftime(u'%A,    %B    %d', current_date.timetuple())
            pIndexTag = Tag(soup, 'p')
            pIndexTag['class'] = 'date_index'
            aTag = Tag(soup, 'a')
            aTag['name'] = ('bdr_%s-%s-%s' % (current_date.year, current_date.month, current_date.day))
            pIndexTag.insert(0, aTag)
            pIndexTag.insert(1, NavigableString(date_string))
            divTag.insert(dtc, pIndexTag)
            dtc += 1
            for new_entry in todays_list:
                pBookTag = Tag(soup, 'p')
                pBookTag['class'] = 'date_read'
                ptc = 0
                pBookTag.insert(ptc, NavigableString(new_entry['reading_progress']))
                ptc += 1
                aTag = Tag(soup, 'a')
                if self.opts.generate_descriptions:
                    aTag['href'] = ('book_%d.html' % int(float(new_entry['id'])))
                aTag.insert(0, escape(new_entry['title']))
                pBookTag.insert(ptc, aTag)
                ptc += 1
                pBookTag.insert(ptc, NavigableString('    &middot;    '))
                ptc += 1
                emTag = Tag(soup, 'em')
                aTag = Tag(soup, 'a')
                if self.opts.generate_authors:
                    aTag['href'] = ('%s.html#%s' % ('ByAlphaAuthor', self.generate_author_anchor(new_entry['author'])))
                aTag.insert(0, NavigableString(new_entry['author']))
                emTag.insert(0, aTag)
                pBookTag.insert(ptc, emTag)
                ptc += 1
                divTag.insert(dtc, pBookTag)
                dtc += 1
        return dtc
    def _add_books_to_html_by_date_range(date_range_list, date_range, dtc):
        if len(date_range_list):
            pIndexTag = Tag(soup, 'p')
            pIndexTag['class'] = 'date_index'
            aTag = Tag(soup, 'a')
            aTag['name'] = ('bdr_%s' % date_range.replace('    ', ''))
            pIndexTag.insert(0, aTag)
            pIndexTag.insert(1, NavigableString(date_range))
            divTag.insert(dtc, pIndexTag)
            dtc += 1
            for new_entry in date_range_list:
                pBookTag = Tag(soup, 'p')
                pBookTag['class'] = 'date_read'
                ptc = 0
                dots = int(((new_entry['percent_read'] + 5) / 10))
                dot_string = (self.SYMBOL_PROGRESS_READ * dots)
                empty_dots = (self.SYMBOL_PROGRESS_UNREAD * (10 - dots))
                pBookTag.insert(ptc, NavigableString(('%s%s' % (dot_string, empty_dots))))
                ptc += 1
                aTag = Tag(soup, 'a')
                if self.opts.generate_descriptions:
                    aTag['href'] = ('book_%d.html' % int(float(new_entry['id'])))
                aTag.insert(0, escape(new_entry['title']))
                pBookTag.insert(ptc, aTag)
                ptc += 1
                pBookTag.insert(ptc, NavigableString('    &middot;    '))
                ptc += 1
                emTag = Tag(soup, 'em')
                aTag = Tag(soup, 'a')
                if self.opts.generate_authors:
                    aTag['href'] = ('%s.html#%s' % ('ByAlphaAuthor', self.generate_author_anchor(new_entry['author'])))
                aTag.insert(0, NavigableString(new_entry['author']))
                emTag.insert(0, aTag)
                pBookTag.insert(ptc, emTag)
                ptc += 1
                divTag.insert(dtc, pBookTag)
                dtc += 1
        return dtc
    friendly_name = _('Recently    Read')
    self.update_progress_full_step(('%s    HTML' % friendly_name))
    if (not self.bookmarked_books):
        return
    soup = self.generate_html_empty_header(friendly_name)
    body = soup.find('body')
    btc = 0
    aTag = Tag(soup, 'a')
    aTag['name'] = 'section_start'
    body.insert(btc, aTag)
    btc += 1
    aTag = Tag(soup, 'a')
    anchor_name = friendly_name.lower()
    aTag['name'] = anchor_name.replace('    ', '')
    body.insert(btc, aTag)
    btc += 1
    divTag = Tag(soup, 'div')
    dtc = 0
    bookmarked_books = []
    for bm_book in self.bookmarked_books:
        book = self.bookmarked_books[bm_book]
        book[1]['bookmark_timestamp'] = book[0].timestamp
        try:
            book[1]['percent_read'] = min(float(((100 * book[0].last_read) / book[0].book_length)), 100)
        except:
            book[1]['percent_read'] = 0
        bookmarked_books.append(book[1])
    self.bookmarked_books_by_date_read = sorted(bookmarked_books, key=(lambda x: (x['bookmark_timestamp'], x['bookmark_timestamp'])), reverse=True)
    current_date = datetime.date.fromordinal(1)
    todays_list = []
    for book in self.bookmarked_books_by_date_read:
        bookmark_time = datetime.datetime.utcfromtimestamp(book['bookmark_timestamp'])
        if ((bookmark_time.day != current_date.day) or (bookmark_time.month != current_date.month) or (bookmark_time.year != current_date.year)):
            dtc = _add_books_to_html_by_day(todays_list, dtc)
            todays_list = []
            current_date = datetime.datetime.utcfromtimestamp(book['bookmark_timestamp']).date()
        todays_list.append(book)
    _add_books_to_html_by_day(todays_list, dtc)
    body.insert(btc, divTag)
    outfile_spec = ('%s/ByDateRead.html' % self.content_dir)
    outfile = open(outfile_spec, 'w')
    outfile.write(soup.prettify())
    outfile.close()
    self.html_filelist_2.append('content/ByDateRead.html')
