[Synopsis-changes] Synopsis/Synopsis/Synopsis/Formatters/HTML/Parts Detail.py,1.1,1.2 Heading.py,1.2,1.3 Inheritance.py,1.2,1.3 Summary.py,1.2,1.3

Stefan Seefeld stefan at synopsis.fresco.org
Sun Nov 16 21:09:48 UTC 2003


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

Modified Files:
	Detail.py Heading.py Inheritance.py Summary.py 
Log Message:
more refactoring. It's starting to work again :-)

Index: Detail.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Parts/Detail.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Detail.py	15 Nov 2003 19:54:05 -0000	1.1
+++ Detail.py	16 Nov 2003 21:09:45 -0000	1.2
@@ -7,26 +7,19 @@
 # see the file COPYING for details.
 #
 
+from Synopsis.Processor import Parameter
 from Synopsis.Formatters.HTML.Part import Part
-
 from Synopsis.Formatters.HTML import FormatStrategy
 from Synopsis.Formatters.HTML.Tags import *
 from Synopsis.Formatters.HTML.DeclarationStyle import *
 
 class Detail(Part):
 
-   def register(self, page):
-
-      Part.register(self, page)
-      self._init_formatters('detail_formatters', 'detail')
-
-   def _init_default_formatters(self):
-
-      self.addFormatter( FormatStrategy.DetailAST )
-      #self.addFormatter( ClassHierarchySimple )
-      self.addFormatter( FormatStrategy.DetailCommenter )
+   formatters = Parameter([FormatStrategy.DetailAST(),
+                           FormatStrategy.DetailCommenter()],
+                          '')
 
-   def writeSectionStart(self, heading):
+   def write_section_start(self, heading):
       """Creates a table with one row. The row has a td of class 'heading'
       containing the heading string"""
 
@@ -34,7 +27,7 @@ class Detail(Part):
       self.write('<tr><td colspan="2" class="heading">' + heading + '</td></tr>\n')
       self.write('</table>')
 
-   def writeSectionItem(self, text):
+   def write_section_item(self, text):
       """Writes text and follows with a horizontal rule"""
 
       self.write(text + '\n<hr>\n')
@@ -63,8 +56,8 @@ class Detail(Part):
             # Check section heading
             if not started:
                started = 1
-               self.writeSectionStart(heading)
+               self.write_section_start(heading)
             child.accept(self)
          # Finish the section
-         if started: self.writeSectionEnd(heading)
+         if started: self.write_section_end(heading)
       self.write_end()

Index: Heading.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Parts/Heading.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -d -r1.2 -r1.3
--- Heading.py	16 Nov 2003 01:45:27 -0000	1.2
+++ Heading.py	16 Nov 2003 21:09:45 -0000	1.3
@@ -7,8 +7,8 @@
 # see the file COPYING for details.
 #
 
+from Synopsis.Processor import Parameter
 from Synopsis.Formatters.HTML.Part import Part
-
 from Synopsis.Formatters.HTML import FormatStrategy
 from Synopsis.Formatters.HTML.Tags import *
 
@@ -16,18 +16,12 @@ 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 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)
+   formatters = Parameter([FormatStrategy.Heading(),
+                           FormatStrategy.ClassHierarchyGraph(),
+                           FormatStrategy.DetailCommenter()],
+                          '')
 
-   def writeSectionItem(self, text):
+   def write_section_item(self, text):
       """Writes text and follows with a horizontal rule"""
 
       self.write(text + '\n<hr>\n')

Index: Inheritance.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Parts/Inheritance.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -d -r1.2 -r1.3
--- Inheritance.py	16 Nov 2003 01:45:27 -0000	1.2
+++ Inheritance.py	16 Nov 2003 21:09:45 -0000	1.3
@@ -7,23 +7,22 @@
 # see the file COPYING for details.
 #
 
+from Synopsis.Processor import Parameter
+from Synopsis import AST, Type, Util
 from Synopsis.Formatters.HTML.Part import Part
-
 from Synopsis.Formatters.HTML import FormatStrategy
 from Synopsis.Formatters.HTML.Tags import *
 
 class Inheritance(Part):
 
+   formatters = Parameter([FormatStrategy.Inheritance()],
+                          '')
+
    def register(self, page):
 
       Part.register(self, page)
-      self._init_formatters('inheritance_formatters', 'inheritance')
       self.__start_list = 0
 
-   def _init_default_formatters(self):
-
-      self.addFormatter(FormatStrategy.Inheritance)
-
    def process(self, decl):
       "Walk the hierarchy to find inherited members to print."
 
@@ -65,10 +64,10 @@ class Inheritance(Part):
             # Check section heading
             if not started:
                started = 1
-               self.writeSectionStart(heading)
+               self.write_section_start(heading)
             child.accept(self)
          # Finish the section
-         if started: self.writeSectionEnd(heading)
+         if started: self.write_section_end(heading)
 	
       self._process_superclasses(clas, names + child_names)
     
@@ -91,7 +90,7 @@ class Inheritance(Part):
          #print "Ignoring", parent.__class__.__name__, "parent of", clas.name()
          pass #ignore
      
-   def writeSectionStart(self, heading):
+   def write_section_start(self, heading):
       """Creates a table with one row. The row has a td of class 'heading'
       containing the heading string"""
 
@@ -100,7 +99,7 @@ class Inheritance(Part):
       self.write('<tr><td class="inherited">')
       self.__start_list = 1
 
-   def writeSectionItem(self, text):
+   def write_section_item(self, text):
       """Adds a table row"""
 
       if self.__start_list:
@@ -109,7 +108,7 @@ class Inheritance(Part):
       else:
          self.write(',\n'+text)
 
-   def writeSectionEnd(self, heading):
+   def write_section_end(self, heading):
       """Closes the table entity and adds a break."""
       self.write('</td></tr></table>\n<br>\n')
 

Index: Summary.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/Synopsis/Formatters/HTML/Parts/Summary.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -d -r1.2 -r1.3
--- Summary.py	16 Nov 2003 01:45:27 -0000	1.2
+++ Summary.py	16 Nov 2003 21:09:45 -0000	1.3
@@ -7,8 +7,10 @@
 # see the file COPYING for details.
 #
 
+from Synopsis.Processor import Parameter
+from Synopsis import Util
 from Synopsis.Formatters.HTML.Part import Part
-
+from Synopsis.Formatters.HTML.DeclarationStyle import Style
 from Synopsis.Formatters.HTML import FormatStrategy
 from Synopsis.Formatters.HTML.Tags import *
 
@@ -17,23 +19,22 @@ class Summary(Part):
    declaration, with links to the details if there is one. All of this is
    controlled by the ASTFormatters."""
 
+   formatters = Parameter([FormatStrategy.SummaryAST(),
+                           FormatStrategy.SummaryCommenter()],
+                          '')
+
    def register(self, page):
 
       Part.register(self, page)
       self.__link_detail = 0
-      self._init_formatters('summary_formatters', 'summary')
-
-   def _init_default_formatters(self):
-
-      self.addFormatter( FormatStrategy.SummaryAST )
-      self.addFormatter( FormatStrategy.SummaryCommenter )
 
    def set_link_detail(self, boolean):
       """Sets link_detail flag to given value.
       @see label()"""
 
       self.__link_detail = boolean
-      config.link_detail = boolean
+      # FIXME: reenable this...
+      #config.link_detail = boolean
 
    def label(self, ref, label=None):
       """Override to check link_detail flag. If it's set, returns a reference
@@ -70,21 +71,23 @@ class Summary(Part):
    def process(self, decl):
       "Print out the summaries from the given decl"
 
-      decl_style = config.decl_style
-      SUMMARY = DeclStyle.SUMMARY
-      config.link_detail = 0
-	
-      config.sorter.set_scope(decl)
-      config.sorter.sort_section_names()
+      decl_style = self.processor.decl_style
+      SUMMARY = Style.SUMMARY
+      #FIXME : reenable this...
+      #config.link_detail = 0
+
+      sorter = self.processor.sorter
+      sorter.set_scope(decl)
+      sorter.sort_section_names()
 
       self.write_start()
-      for section in config.sorter.sections():
+      for section in sorter.sections():
          # Write a header for this section
          if section[-1] == 's': heading = section+'es Summary:'
          else: heading = section+'s Summary:'
          self.writeSectionStart(heading)
          # Iterate through the children in this section
-         for child in config.sorter.children(section):
+         for child in sorter.children(section):
             # Check if need to add to detail list
             if decl_style[child] != SUMMARY:
                # Setup the linking stuff





More information about the Synopsis-changes mailing list