'Extract and set title and header from content or context.'

def set_title_and_header(self, context):

    if (not (u'no_header' in context)):
        if (u'<!--    no-header    -->' in context.main_section):
            context.no_header = 1
    if (not context.title):
        context.title = extract_title(context.main_section, context.path_name)
    if (context.no_header and (u'header' in context)):
        context.header = u''
    if (not context.no_header):
        if ((not context.header) and (u'<h1' not in context.main_section)):
            context.header = context.title
        if (context.get(u'header') and (not re.findall(u'<h.>', context.header))):
            context.header = ((u'<h1>' + context.header) + u'</h1>')
    if ((not context.title) and context.header):
        context.title = strip_html(context.header)
