[Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatter/HTML Formatter.py,NONE,1.1 __init__.py,1.6,1.7

Stefan Seefeld stefan at synopsis.fresco.org
Tue Nov 11 04:53:43 UTC 2003


Update of /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML
In directory frida:/tmp/cvs-serv9440/Synopsis/Formatter/HTML

Modified Files:
	__init__.py 
Added Files:
	Formatter.py 
Log Message:
move HTML formatter towards processor scheme

--- NEW FILE: Formatter.py ---
# $Id: Formatter.py,v 1.1 2003/11/11 04:53:41 stefan Exp $
#
# Copyright (C) 2003 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#

from Synopsis.Processor import Processor, Parameter
from Synopsis.Core import AST
from FramesIndex import *
from ScopePages import *
from ModuleListing import *
from ModuleIndexer import *
from FileListing import *
from FileIndexer import *
from FileDetails import *
from InheritanceTree import *
from InheritanceGraph import *
from FileSource import *
from NameIndex import *
from XRefPages import *
from FileLayout import *
from TreeFormatter import *
from CommentFormatter import *

from core import *

class ConfigHTML:
   """This is a verbatim copy of the HTML class in Config.py.
   It should serve temporarily here so we can incrementally
   refactor the HTML formatter. The goal is to get rid of this
   monster..."""
   
   name = 'HTML'
   # Defaults
   datadir = '/usr/local' + '/share/synopsis'
   stylesheet = 'style.css'
   stylesheet_file = datadir + '/html.css'
   file_layout = 'Synopsis.Formatter.HTML.FileLayout.FileLayout'
   pages = ['FramesIndex',
            'ScopePages',
            'ModuleListing',
            'ModuleIndexer',
            'FileListing',
            'FileIndexer',
            'FileDetails',
            'InheritanceTree',
            'InheritanceGraph',
            'NameIndex',
            'FramesIndex']
   comment_formatters = ['javadoc', 'section']
   tree_formatter = 'TreeFormatter.TreeFormatter'
   structs_as_classes = 0
   class FileSource:
      file_path = './%s'
      links_path = './%s-links'
      toc_files = []
      scope = ''
   # Old name for FileSource:
   FilePages = FileSource
   class FileTree:
      link_to_pages = 0
   class ScopePages:
      parts = ['Heading',
               'Summary',
               'Inheritance',
               'Detail']
      heading_formatters = ['Heading',
                            'ClassHierarchyGraph',
                            'DetailCommenter']
      summary_formatters = ['SummaryAST',
                            'SummaryCommenter']
      detail_formatters = ['DetailAST',
                           'DetailCommenter']
   class InheritanceGraph:
      min_size = 1
      min_group_size = 5
      direction = 'vertical'

   class ModuleListing:
      pass

   def __init__(self, verbose):
      self.verbose = verbose

class Formatter(Processor):

   stylesheet = Parameter('style.css', '')
   stylesheet_file = Parameter('../html.css', '')
   pages = Parameter(['FramesIndex', #these will become types, but that requires more refactoring
                      'ScopePages',
                      'ModuleListing',
                      'ModuleIndexer',
                      'FileListing',
                      'FileIndexer',
                      'FileDetails',
                      'InheritanceTree',
                      'InheritanceGraph',
                      'FileSource',
                      'NameIndex',
                      'XRefPages'],
                     '')
   
   comment_formatter = Parameter([QuoteHTML, SectionFormatter],
                                 '')

   # this should go away !
   datadir = Parameter('/usr/local/share/synopsis', '')
   file_layout = Parameter(NestedFileLayout, 'how to lay out the output files')
   tree_formatter = Parameter(TreeFormatter, 'define how to lay out tree views')
   structs_as_classes = Parameter(True, '')

   def process(self, ast, **kwds):

      self.set_parameters(kwds)
      self.ast = self.merge_input(ast)

      config_obj = ConfigHTML(self.verbose)
      format(['-o', self.output], self.ast, config_obj)

      return self.ast

Index: __init__.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatter/HTML/__init__.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- __init__.py	4 Jul 2001 08:17:48 -0000	1.6
+++ __init__.py	11 Nov 2003 04:53:41 -0000	1.7
@@ -1,40 +1,10 @@
 # $Id$
 #
-# This file is a part of Synopsis.
-# Copyright (C) 2000, 2001 Stephen Davies
-# Copyright (C) 2000, 2001 Stefan Seefeld
-#
-# Synopsis is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-#
-# $Log$
-# Revision 1.6  2001/07/04 08:17:48  uid20151
-# Comments
-#
-# Revision 1.5  2001/02/13 10:07:33  chalky
-# Fixed typo
-#
-# Revision 1.4  2001/02/13 06:55:23  chalky
-# Made synopsis -l work again
-#
-# Revision 1.3  2001/02/01 15:28:43  chalky
-# Imported usage so it works.
-#
-# Revision 1.2  2001/02/01 15:23:24  chalky
-# Copywritten brown paper bag edition.
-#
+# Copyright (C) 2000 Stephen Davies
+# Copyright (C) 2000 Stefan Seefeld
+# All rights reserved.
+# Licensed to the public under the terms of the GNU LGPL (>= 2),
+# see the file COPYING for details.
 #
 
 """HTML Formatter package.
@@ -48,22 +18,7 @@ include things like the file layout, the
 to use, etc.
 """
 
-#
-# __init__.py
-#
-# The formatter has been split into a very modular format.
-# The modules in the HTML package now contain the classes which may be
-# overridden by user-specified modules
-
-try:
-    import core
-
-    from core import format, usage
-
-except:
-    print "An error occurred loading the HTML module:"
-    import traceback
-    traceback.print_exc()
-    raise
+from Formatter import Formatter
 
-# THIS-IS-A-FORMATTER
+import core
+from core import format, usage





More information about the Synopsis-changes mailing list