'Generate content/ByAlphaTitle.html.
Generate HTML of books sorted by title.
Input:
books_by_title
Output:
content/ByAlphaTitle.html (file)'

def generate_html_by_title(self):

    self.update_progress_full_step(_('Titles    HTML'))
    soup = self.generate_html_empty_header('Books    By    Alpha    Title')
    body = soup.find('body')
    btc = 0
    pTag = Tag(soup, 'p')
    pTag['class'] = 'title'
    ptc = 0
    aTag = Tag(soup, 'a')
    aTag['id'] = 'section_start'
    pTag.insert(ptc, aTag)
    ptc += 1
    if (not self.generate_for_kindle_mobi):
        aTag = Tag(soup, 'a')
        aTag['id'] = 'bytitle'
        pTag.insert(ptc, aTag)
        ptc += 1
        pTag.insert(ptc, NavigableString(_('Titles')))
    body.insert(btc, pTag)
    btc += 1
    divTag = Tag(soup, 'div')
    dtc = 0
    current_letter = ''
    if (not self.use_series_prefix_in_titles_section):
        nspt = deepcopy(self.books_to_catalog)
        nspt = sorted(nspt, key=(lambda x: sort_key(x['title_sort'].upper())))
        self.books_by_title_no_series_prefix = nspt
    sort_equivalents = self.establish_equivalencies(self.books_by_title, key='title_sort')
    title_list = self.books_by_title
    if (not self.use_series_prefix_in_titles_section):
        title_list = self.books_by_title_no_series_prefix
    drtc = 0
    divRunningTag = None
    for (idx, book) in enumerate(title_list):
        if (self.letter_or_symbol(sort_equivalents[idx]) != current_letter):
            if (drtc and (divRunningTag is not None)):
                divTag.insert(dtc, divRunningTag)
                dtc += 1
            divRunningTag = Tag(soup, 'div')
            if (dtc > 0):
                divRunningTag['class'] = 'initial_letter'
            drtc = 0
            pIndexTag = Tag(soup, 'p')
            pIndexTag['class'] = 'author_title_letter_index'
            aTag = Tag(soup, 'a')
            current_letter = self.letter_or_symbol(sort_equivalents[idx])
            if (current_letter == self.SYMBOLS):
                aTag['id'] = (self.SYMBOLS + '_titles')
                pIndexTag.insert(0, aTag)
                pIndexTag.insert(1, NavigableString(self.SYMBOLS))
            else:
                aTag['id'] = (self.generate_unicode_name(current_letter) + '_titles')
                pIndexTag.insert(0, aTag)
                pIndexTag.insert(1, NavigableString(sort_equivalents[idx]))
            divRunningTag.insert(dtc, pIndexTag)
            drtc += 1
        pBookTag = Tag(soup, 'p')
        pBookTag['class'] = 'line_item'
        ptc = 0
        pBookTag.insert(ptc, self.format_prefix(book['prefix']))
        ptc += 1
        spanTag = Tag(soup, 'span')
        spanTag['class'] = 'entry'
        stc = 0
        aTag = Tag(soup, 'a')
        if self.opts.generate_descriptions:
            aTag['href'] = ('book_%d.html' % int(float(book['id'])))
        args = self.generate_format_args(book)
        if book['series']:
            formatted_title = self.formatter.safe_format(self.by_titles_series_title_template, args, (_('error    in') + '    by_titles_series_title_template:'), self.db.new_api.get_proxy_metadata(book['id']))
        else:
            formatted_title = self.formatter.safe_format(self.by_titles_normal_title_template, args, (_('error    in') + '    by_titles_normal_title_template:'), self.db.new_api.get_proxy_metadata(book['id']))
        aTag.insert(0, NavigableString(escape(formatted_title)))
        spanTag.insert(stc, aTag)
        stc += 1
        spanTag.insert(stc, NavigableString('    &middot;    '))
        stc += 1
        emTag = Tag(soup, 'em')
        aTag = Tag(soup, 'a')
        if self.opts.generate_authors:
            aTag['href'] = ('%s.html#%s' % ('ByAlphaAuthor', self.generate_author_anchor(book['author'])))
        aTag.insert(0, NavigableString(book['author']))
        emTag.insert(0, aTag)
        spanTag.insert(stc, emTag)
        stc += 1
        pBookTag.insert(ptc, spanTag)
        ptc += 1
        if (divRunningTag is not None):
            divRunningTag.insert(drtc, pBookTag)
        drtc += 1
    if (divRunningTag is not None):
        divTag.insert(dtc, divRunningTag)
        dtc += 1
    body.insert(btc, divTag)
    btc += 1
    outfile_spec = ('%s/ByAlphaTitle.html' % self.content_dir)
    outfile = open(outfile_spec, 'w')
    outfile.write(soup.prettify())
    outfile.close()
    self.html_filelist_1.append('content/ByAlphaTitle.html')
