[Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters/HTML ASTFormatter.py,1.35,1.36 Formatter.py,1.5,1.6

Stefan Seefeld stefan at synopsis.fresco.org
Sat Nov 15 19:01:55 UTC 2003


Update of /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML
In directory frida:/tmp/cvs-serv3771/Synopsis/Formatters/HTML

Modified Files:
	ASTFormatter.py Formatter.py 
Log Message:
more work to get rid of core.py

Index: ASTFormatter.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/ASTFormatter.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -p -d -r1.35 -r1.36
--- ASTFormatter.py	14 Nov 2003 14:51:09 -0000	1.35
+++ ASTFormatter.py	15 Nov 2003 19:01:53 -0000	1.36
@@ -36,7 +36,11 @@ class Part(Type.Visitor, AST.Visitor):
    delegated to the writeSectionStart, writeSectionEnd, and writeSectionItem
    methods, which myst be implemented in a subclass.
    """
-   def __init__(self, page):
+
+   def __init__(self): pass
+
+   def register(self, page):
+
       self.processor = page.processor
       self.__page = page
       self.__formatters = []
@@ -270,15 +274,16 @@ class Heading(Part):
    """Heading page part. Displays a header for the page -- its strategies are
    only passed the object that the page is for; ie a Class or Module"""
 
-   def __init__(self, page):
-      Part.__init__(self, page)
+   def register(self, page):
+
+      Part.register(self, page)
       self._init_formatters('heading_formatters', 'heading')
 
    def _init_default_formatters(self):
 
-      self.addFormatter( FormatStrategy.Heading )
-      self.addFormatter( FormatStrategy.ClassHierarchyGraph )
-      self.addFormatter( FormatStrategy.DetailCommenter )
+      self.addFormatter(FormatStrategy.Heading)
+      self.addFormatter(FormatStrategy.ClassHierarchyGraph)
+      self.addFormatter(FormatStrategy.DetailCommenter)
 
    def writeSectionItem(self, text):
       """Writes text and follows with a horizontal rule"""
@@ -294,9 +299,10 @@ class Summary(Part):
    """Formatting summary visitor. This formatter displays a summary for each
    declaration, with links to the details if there is one. All of this is
    controlled by the ASTFormatters."""
-   def __init__(self, page):
 
-      Part.__init__(self, page)
+   def register(self, page):
+
+      Part.register(self, page)
       self.__link_detail = 0
       self._init_formatters('summary_formatters', 'summary')
 
@@ -377,9 +383,9 @@ class Summary(Part):
 
 class Detail(Part):
 
-   def __init__(self, page):
+   def register(self, page):
 
-      Part.__init__(self, page)
+      Part.register(self, page)
       self._init_formatters('detail_formatters', 'detail')
 
    def _init_default_formatters(self):
@@ -432,9 +438,9 @@ class Detail(Part):
      
 class Inheritance(Part):
 
-   def __init__(self, page):
+   def register(self, page):
 
-      Part.__init__(self, page)
+      Part.register(self, page)
       self._init_formatters('inheritance_formatters', 'inheritance')
       self.__start_list = 0
 

Index: Formatter.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Formatter.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -d -r1.5 -r1.6
--- Formatter.py	14 Nov 2003 17:39:04 -0000	1.5
+++ Formatter.py	15 Nov 2003 19:01:53 -0000	1.6
@@ -8,12 +8,15 @@
 
 from Synopsis.Processor import Processor, Parameter
 from Synopsis import AST
+from Synopsis.Formatters.TOC import TOC
+from Synopsis.Formatters.ClassTree import ClassTree
+from Synopsis.Formatters.XRef import CrossReferencer
 from FileLayout import *
 from TreeFormatter import *
 from CommentFormatter import *
 from Pages.FramesIndex import *
 from Pages.DirBrowse import *
-from Pages.ScopePages import *
+from Pages.Scope import *
 from Pages.ModuleListing import *
 from Pages.ModuleIndexer import *
 from Pages.FileListing import *
@@ -23,7 +26,7 @@ from Pages.InheritanceTree import *
 from Pages.InheritanceGraph import *
 from Pages.FileSource import *
 from Pages.NameIndex import *
-from Pages.XRefPages import *
+from Pages.XRef import *
 
 from core import *
 
@@ -44,10 +47,6 @@ class ConfigHTML:
       links_path = './%s-links'
       toc_files = []
       scope = ''
-   # Old name for FileSource:
-   FilePages = FileSource
-   class FileTree:
-      link_to_pages = 0
    class ScopePages:
       parts = ['Heading',
                'Summary',
@@ -75,7 +74,7 @@ class Formatter(Processor):
    toc_out = Parameter('', 'name of file into which to store the TOC')
 
    pages = Parameter([FramesIndex(), #DirBrowse()
-                      ScopePages(),
+                      Scope(),
                       ModuleListing(),
                       ModuleIndexer(),
                       FileListing(),
@@ -85,7 +84,7 @@ class Formatter(Processor):
                       InheritanceGraph(),
                       FileSource(),
                       NameIndex(),
-                      XRefPages()],
+                      XRef()],
                       '')
    
    #comment_formatters = ['javadoc', 'section']
@@ -122,12 +121,15 @@ class Formatter(Processor):
       self.comments = CommentFormatter(self)
 
       # Create the Class Tree (TODO: only if needed...)
-      self.classTree = ClassTree.ClassTree()
+      self.classTree = ClassTree()
 
       # Create the File Tree (TODO: only if needed...)
       self.fileTree = FileTree()
       self.fileTree.set_ast(ast)
 
+      self.xref = CrossReferencer()
+
+
       # Build class tree
       for d in declarations:
          d.accept(config.classTree)
@@ -183,11 +185,12 @@ class Formatter(Processor):
 
       return self.ast
 
-   def has_page(self, page_type):
+   def has_page(self, page_name):
       """test whether the given page is part of the pages list."""
 
       return reduce(lambda x, y: x or y,
-                    map(lambda x: isinstance(x, page_type), self.pages))
+                    map(lambda x: x.__class__.__name__ = page_name,
+                        self.pages))
 
    def get_toc(self, start):
       """Returns the table of content to link into from the outside"""





More information about the Synopsis-changes mailing list