Synopsis - Synopsis/Formatters/HTML/FrameSet.py

File: Synopsis/Formatters/HTML/FrameSet.py

     1#
     2# Copyright (C) 2006 Stefan Seefeld
     3# All rights reserved.
     4# Licensed to the public under the terms of the GNU LGPL (>= 2),
     5# see the file COPYING for details.
     6#
     7
     8from Synopsis.Formatters.HTML.DirectoryLayout import open_file
     9from Synopsis.Formatters.HTML.Tags import *
    10import os
    11
    12class FrameSet:
    13    """A class that creates an index with frames"""
    14
    15    def process(self, output, filename, title, index, detail, content):
    16        """Creates a frames index file."""
    17
    18        out = open_file(os.path.join(output, filename))
    19        out.write('<?xml version="1.0"?>\n')
    20        out.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"\n')
    21        out.write('    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">\n')
    22        out.write('<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n')
    23        out.write('<head>\n')
    24        out.write('<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/>\n')
    25        out.write(element('title',title) + '\n')
    26        out.write(element('link', type='text/css', rel='stylesheet', href='style.css') + '\n')
    27        out.write('</head>\n')
    28
    29        index = rel(filename, index)
    30        detail = rel(filename, detail)
    31        content = rel(filename, content)
    32        frame1 = element('frame', name='index', src=index)
    33        frame2 = element('frame', name='detail', src=detail)
    34        frame3 = element('frame', name='content', src=content)
    35        frameset = element('frameset', '%s\n%s\n'%(frame1, frame2), rows="30%,*")
    36        noframes = 'This document was configured to use frames.\n'
    37        noframes += '<ul>\n'
    38        noframes += element('li', href(index, 'The default Index frame')) + '\n'
    39        noframes += element('li', href(detail, 'The default Detail frame')) + '\n'
    40        noframes += element('li', href(content, 'The default Content frame')) + '\n'
    41        noframes += '</ul>\n'
    42        noframes = element('body', noframes + 'Generated by Synopsis.') + '\n'
    43        noframes = element('noframes', noframes)
    44        frameset = element('frameset', '%s\n%s\n%s\n'%(frameset, frame3, noframes), cols="200,*")
    45        out.write(frameset)
    46        out.write('\n</html>\n')
    47        out.close()
    48

Generated on Thu Apr 16 16:27:14 2009 by
synopsis (version devel)