Exemple #1
0
def generate_library(lib):
    """Returns a list of (filename, filecontents) tuples representing the generated files to
    be written to disk"""

    # "escape" param disables html-escaping
    stache = pystache.Renderer(search_dirs=TEMPLATES_DIR, escape=lambda u: u)

    tome_imports = [ImportView.from_qualified_name(lib, util.qualified_name(spec.namespace, spec.name)) for spec in lib.tomes]

    library_view = {
        "tome_imports": sorted(set(tome_imports)),
        "header": lib.header_text}

    class_contents = stache.render(stache.load_template(LIBRARY_FILENAME), library_view)

    path = util.namespace_to_path(lib.namespace)

    return [(os.path.join(path, LIBRARY_FILENAME), class_contents)]
Exemple #2
0
 def interface_filename(self):
     return os.path.join(util.namespace_to_path(self.namespace), self.interface_name + ".as")
Exemple #3
0
 def class_filename(self):
     return os.path.join(util.namespace_to_path(self.namespace), self.class_name + ".as")