Class: FileDoc
Represents documentaion for an entire file. The constructor takes the source text for file, parses it, then provides a class wrapper around the parsed text.
Constructor
__init__ (self, file_name, file_text)
Construct a FileDoc. file_name is the name of the JavaScript file, file_text is its text.
Methods
keys (self)
Returns all legal names for doc comments.
>>> file = FileDoc('module.js', read_file('examples/module.js'))
>>> file.keys()[1]
'the_first_function'
>>> file.keys()[4]
'not_auto_discovered'
set_all_dependencies (self, dependencies)
Sets the all_dependencies property on the module documentation.
to_dict (self)
to_html (self, codebase)
values (self)
Same as list(file_doc).
>>> file = FileDoc('module.js', read_file('examples/module.js'))
>>> file.values()[0].doc[:30]
'This is the module documentati'
Properties
classes
Read only
Returns a generator of all classes in the file, in textual order.
>>> file = FileDoc('class.js', read_file('examples/class.js'))
>>> cls = file.classes.next()
>>> cls.name
'MyClass'
>>> cls.methods[0].name
'first_method'
doc
Read only
Shortcut for self.module.doc.
functions
Read only
Returns a generator of all standalone functions in the file, in textual order.
>>> file = FileDoc('module.js', read_file('examples/module.js'))
>>> list(file.functions)[0].name
'the_first_function'
>>> list(file.functions)[3].name
'not_auto_discovered'
methods
Read only
Returns a generator of all member functions in the file, in textual order.
>>> file = FileDoc('class.js', read_file('examples/class.js'))
>>> file.methods.next().name
'first_method'
module
Read only
Return the ModuleDoc comment for this file.
url
Read only