Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config
module Synopsis::Formatter::HTML::ASTFormatter
class Part
Files: Synopsis/Formatter/HTML/ASTFormatter.py
Part-inheritance Scopes/Synopsis/Formatter/HTML/ASTFormatter/Summary.html Scopes/Synopsis/Formatter/HTML/ASTFormatter/Detail.html Scopes/Synopsis/Formatter/HTML/ASTFormatter/Inheritance.html Scopes/Synopsis/Formatter/HTML/ASTFormatter/Heading.html

Base class for formatting a Part of a Scope Page.

This class contains functionality for modularly formatting an AST node and its children for display. It is typically used to contruct Heading, Summary and Detail formatters. Strategy objects are added according to configuration, and this base class then checks which format methods each strategy implements. For each AST declaration visited, the Part asks all Strategies which implement the appropriate format method to generate output for that declaration. The final writing of the formatted html is delegated to the writeSectionStart, writeSectionEnd, and writeSectionItem methods, which myst be implemented in a subclass.


Operations Summary:
 __init__(self, page) [Source]
 page(self) [Source]
 filename(self) [Source]
 os(self) [Source]
 scope(self) [Source]
 write(self, text) [Source]
 _init_formatters(self, config_option, type_msg)
Loads strategies from config file [Source]
 addFormatter(self, formatterClass)
Adds the given formatter Class. [Source]
 type_ref(self) [Source]
 type_label(self) [Source]
 declarator(self) [Source]
 parameter(self) [Source]
 reference(self, name, label = None, **keys)
Returns a reference to the given name. [Source]
 label(self, name, label = None)
Create a label for the given name. [Source]
 formatDeclaration(self, decl, method)
Format decl using named method of each formatter. [Source]
 process(self, decl)
Formats the given decl, creating the output for this Part of the page. [Source]
 visitDeclaration(self, decl) [Source]
 visitForward(self, decl) [Source]
 visitGroup(self, decl) [Source]
 visitScope(self, decl) [Source]
 visitModule(self, decl) [Source]
 visitMetaModule(self, decl) [Source]
 visitClass(self, decl) [Source]
 visitTypedef(self, decl) [Source]
 visitEnum(self, decl) [Source]
 visitVariable(self, decl) [Source]
 visitConst(self, decl) [Source]
 visitFunction(self, decl) [Source]
 visitOperation(self, decl) [Source]
 formatType(self, typeObj, id_holder = None)
Returns a reference string for the given type object [Source]
 visitBaseType(self, type)
Sets the label to be a reference to the type's name [Source]
 visitUnknown(self, type)
Sets the label to be a reference to the type's link [Source]
 visitDeclared(self, type)
Sets the label to be a reference to the type's name [Source]
 visitDependent(self, type)
Sets the label to be the type's name (which has no proper scope) [Source]
 visitModifier(self, type)
Adds modifiers to the formatted label of the modifier's alias [Source]
 visitParametrized(self, type)
Adds the parameters to the template name in angle brackets [Source]
 visitTemplate(self, type)
Labs the template with the parameters [Source]
 visitFunctionType(self, type)
Labels the function type with return type, name and parameters [Source]
 write_start(self)
Abstract method to start the output, eg table headings [Source]
 writeSectionStart(self, heading)
Abstract method to start a section of declaration types [Source]
 writeSectionEnd(self, heading)
Abstract method to end a section of declaration types [Source]
 writeSectionItem(self, text)
Abstract method to write the output of one formatted declaration [Source]
 write_end(self)
Abstract method to end the output, eg close the table [Source]

Operation Details:
  addFormatter(self, formatterClass)

Adds the given formatter Class. An object is instantiated from the class passing self to the constructor. Stores the object, and stores which format methods it overrides


  reference(self, name, label = None, **keys)

Returns a reference to the given name. The name is a scoped name, and the optional label is an alternative name to use as the link text. The name is looked up in the TOC so the link may not be local. The optional keys are appended as attributes to the A tag.


  label(self, name, label = None)

Create a label for the given name. The label is an anchor so it can be referenced by other links. The name of the label is derived by looking up the name in the TOC and using the link in the TOC entry. The optional label is an alternative name to use as the displayed name. If the name is not found in the TOC then the name is not anchored and just label is returned (or name if no label is given).


  formatDeclaration(self, decl, method)

Format decl using named method of each formatter. Each formatter returns two strings - type and name. All the types are joined and all the names are joined separately. The consolidated type and name strings are then passed to writeSectionItem.


  process(self, decl)

Formats the given decl, creating the output for this Part of the page. This method is implemented in various subclasses in different ways, for example Summary and Detail iterate through the children of 'decl' section by section, whereas Heading only formats decl itself.