Modules |
Files |
Inheritance Tree |
Inheritance Graph |
Name Index |
Config
File: Synopsis/Formatter/HTML/FramesIndex.py
1| # $Id: FramesIndex.py,v 1.8 2002/11/02 06:37:37 chalky Exp $
2| #
3| # This file is a part of Synopsis.
4| # Copyright (C) 2000, 2001 Stephen Davies
5| # Copyright (C) 2000, 2001 Stefan Seefeld
6| #
7| # Synopsis is free software; you can redistribute it and/or modify it
8| # under the terms of the GNU General Public License as published by
9| # the Free Software Foundation; either version 2 of the License, or
10| # (at your option) any later version.
11| #
12| # This program is distributed in the hope that it will be useful,
13| # but WITHOUT ANY WARRANTY; without even the implied warranty of
14| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15| # General Public License for more details.
16| #
17| # You should have received a copy of the GNU General Public License
18| # along with this program; if not, write to the Free Software
19| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20| # 02111-1307, USA.
21| #
22| # $Log: FramesIndex.py,v $
23| # Revision 1.8 2002/11/02 06:37:37 chalky
24| # Allow non-frames output, some refactoring of page layout, new modules.
25| #
26| # Revision 1.7 2002/11/01 03:39:21 chalky
27| # Cleaning up HTML after using 'htmltidy'
28| #
29| # Revision 1.6 2002/10/29 12:43:56 chalky
30| # Added flexible TOC support to link to things other than ScopePages
31| #
32| # Revision 1.5 2001/07/05 05:39:58 stefan
33| # advanced a lot in the refactoring of the HTML module.
34| # Page now is a truely polymorphic (abstract) class. Some derived classes
35| # implement the 'filename()' method as a constant, some return a variable
36| # dependent on what the current scope is...
37| #
38| # Revision 1.4 2001/06/28 07:22:18 stefan
39| # more refactoring/cleanup in the HTML formatter
40| #
41| # Revision 1.3 2001/06/26 04:32:16 stefan
42| # A whole slew of changes mostly to fix the HTML formatter's output generation,
43| # i.e. to make the output more robust towards changes in the layout of files.
44| #
45| # the rpm script now works, i.e. it generates source and binary packages.
46| #
47| # Revision 1.2 2001/02/01 15:23:24 chalky
48| # Copywritten brown paper bag edition.
49| #
50| #
51|
52| import os
53| import Page
54| from core import config
55| from Tags import *
56|
57| class FramesIndex (Page.Page):
58| """A class that creates an index with frames"""
59| # TODO figure out how to set the default frame contents
60| def __init__(self, manager):
61| Page.Page.__init__(self, manager)
62|
63| def filename(self): return config.files.nameOfIndex()
64| def title(self): return 'Synopsis - Generated Documentation'
65|
66| def register(self):
67| config.set_main_page(self.filename())
68|
69| def process(self, start):
70| """Creates a frames index file"""
71| me = config.files.nameOfIndex()
72| # TODO use project name..
73| self.start_file(body='')
74| fcontents = rel(me, config.page_contents)
75| findex = rel(me, config.page_index)
76| # Find something to link to
77| fglobal = findex
78| decls = [start]
79| while decls:
80| decl = decls.pop(0)
81| entry = config.toc[decl.name()]
82| if entry:
83| fglobal = rel(me, entry.link)
84| break
85| if hasattr(decl, 'declarations'):
86| # Depth-first search
87| decls = decl.declarations() + decls
88| frame1 = solotag('frame', name='contents', src=fcontents)
89| frame2 = solotag('frame', name='index', src=findex)
90| frame3 = solotag('frame', name='main', src=fglobal)
91| frameset1 = entity('frameset', frame1+frame2, rows="30%,*")
92| frameset2 = entity('frameset', frameset1+frame3, cols="200,*")
93| self.write(frameset2)
94| noframes = 'This document was configured to use frames.'
95| noframes = noframes + '<ul>'
96| noframes = noframes + entity('li', href(fcontents, 'The default Contents frame'))
97| noframes = noframes + entity('li', href(findex, 'The default Index frame'))
98| noframes = noframes + entity('li', href(fglobal, 'The default Main frame'))
99| noframes = noframes + '</ul>'
100| noframes = noframes + 'Generated by Synopsis.'
101| self.write(entity('noframes', noframes))
102| self.end_file(body='')
103|
104|
105| htmlPageClass = FramesIndex