'Headings start'

def s_text_h(self, tag, attrs):

    level = int(attrs[(TEXTNS, 'outline-level')])
    if (level > 6):
        level = 6
    if (level < 1):
        level = 1
    self.headinglevels[level] = (self.headinglevels[level] + 1)
    name = self.classname(attrs)
    for x in range((level + 1), 10):
        self.headinglevels[x] = 0
    special = special_styles.get(('P-' + name))
    if (special or (not self.generate_css)):
        self.opentag(('h%s' % level))
    else:
        self.opentag(('h%s' % level), {'class': ('P-%s' % name)})
    self.purgedata()
