diff --git a/py/apigen/apigen.py b/py/apigen/apigen.py index 69777b8e0..808dcd346 100644 --- a/py/apigen/apigen.py +++ b/py/apigen/apigen.py @@ -31,6 +31,11 @@ def get_documentable_items(pkgdir): Channel.__apigen_hide_from_nav__ = True return pkgname, pkgdict +def sourcedirfilter(p): + return ('.svn' not in str(p).split(p.sep) and + not p.basename.startswith('.') and + str(p).find('c-extension%sgreenlet%sbuild' % (p.sep, p.sep)) == -1) + def build(pkgdir, dsa, capture): # create a linker (link database) for cross-linking l = linker.TempLinker() @@ -51,7 +56,7 @@ def build(pkgdir, dsa, capture): apb = htmlgen.ApiPageBuilder(targetdir, l, dsa, pkgdir, namespace_tree, proj, capture, LayoutPage) spb = htmlgen.SourcePageBuilder(targetdir, l, pkgdir, proj, capture, - LayoutPage) + LayoutPage, dirfilter=sourcedirfilter) apb.build_namespace_pages() class_names = dsa.get_class_names() diff --git a/py/apigen/htmlgen.py b/py/apigen/htmlgen.py index 5debccbf3..af51eaf1e 100644 --- a/py/apigen/htmlgen.py +++ b/py/apigen/htmlgen.py @@ -81,7 +81,7 @@ def get_param_htmldesc(linker, func): return inspect.formatargspec(*inspect.getargspec(func)) # some helper functionality -def source_dirs_files(fspath): +def source_dirs_files(fspath, fil=None): """ returns a tuple (dirs, files) for fspath dirs are all the subdirs, files are the files which are interesting @@ -93,7 +93,7 @@ def source_dirs_files(fspath): """ dirs = [] files = [] - for child in fspath.listdir(): + for child in fspath.listdir(fil=fil): if child.basename.startswith('.'): continue if child.check(dir=True): @@ -203,13 +203,14 @@ class AbstractPageBuilder(object): class SourcePageBuilder(AbstractPageBuilder): """ builds the html for a source docs page """ def __init__(self, base, linker, projroot, project, capture=None, - pageclass=LayoutPage): + pageclass=LayoutPage, dirfilter=None): self.base = base self.linker = linker self.projroot = projroot self.project = project self.capture = capture self.pageclass = pageclass + self.dirfilter = dirfilter def build_navigation(self, fspath): nav = H.Navigation(class_='sidebar') @@ -240,7 +241,7 @@ class SourcePageBuilder(AbstractPageBuilder): else: # we're a file, build our parent's children only dirpath = fspath.dirpath() - diritems, fileitems = source_dirs_files(dirpath) + diritems, fileitems = source_dirs_files(dirpath, self.dirfilter) for dir in diritems: nav.append(H.NavigationItem(self.linker, dir.strpath, dir.basename, indent, False)) @@ -265,7 +266,7 @@ class SourcePageBuilder(AbstractPageBuilder): return tag, nav def build_dir_page(self, fspath): - dirs, files = source_dirs_files(fspath) + dirs, files = source_dirs_files(fspath, self.dirfilter) dirs = [(p.basename, self.linker.get_lazyhref(str(p))) for p in dirs] files = [(p.basename, self.linker.get_lazyhref(str(p))) for p in files] tag = H.DirList(dirs, files) @@ -281,7 +282,15 @@ class SourcePageBuilder(AbstractPageBuilder): return tag, nav def build_pages(self, base): - for fspath in [base] + list(base.visit()): + def visit(p): + dirs, files = source_dirs_files(p, self.dirfilter) + for d in dirs: + yield d + for sp in visit(d): + yield sp + for f in files: + yield f + for fspath in [base] + list(visit(base)): if fspath.ext in ['.pyc', '.pyo']: continue if self.capture: diff --git a/py/test/rsession/webdata/index.html b/py/test/rsession/webdata/index.html index fb03e2d08..e8af6ac05 100644 --- a/py/test/rsession/webdata/index.html +++ b/py/test/rsession/webdata/index.html @@ -62,10 +62,6 @@ border: 0px; } - #hosts { - width: 100%; - } -
@@ -114,12 +110,10 @@ - - - + +