Ejemplo n.º 1
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     content = Rest(Title(fullpath, abovechar="=", belowchar="="), Directive("contents"))
     if path:
         content.add(Paragraph(Link("back to parent", path + ".html")))
     content.join(
         Title("Basic Option Information"),
         ListItem(Strong("name:"), self._name),
         ListItem(Strong("description:"), self.doc),
         Title("Sub-Options"),
     )
     stack = []
     prefix = fullpath
     curr = content
     config = Config(self)
     for ending in self.getpaths(include_groups=True):
         subpath = fullpath + "." + ending
         while not (subpath.startswith(prefix) and subpath[len(prefix)] == "."):
             curr, prefix = stack.pop()
         print subpath, fullpath, ending, curr
         sub, step = config._cfgimpl_get_home_by_path(ending)
         doc = getattr(sub._cfgimpl_descr, step).doc
         if doc:
             new = curr.add(ListItem(Link(subpath + ":", subpath + ".html"), Em(doc)))
         else:
             new = curr.add(ListItem(Link(subpath + ":", subpath + ".html")))
         stack.append((curr, prefix))
         prefix = subpath
         curr = new
     return content
Ejemplo n.º 2
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     result = Rest(Title(fullpath, abovechar="=", belowchar="="),
                   ListItem(Strong("name:"), self._name),
                   ListItem(Strong("description:"), self.doc))
     if self.cmdline is not None:
         cmdline = get_cmdline(self.cmdline, fullpath)
         result.add(ListItem(Strong("command-line:"), cmdline))
     return result
Ejemplo n.º 3
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     result = Rest(
         Title(fullpath, abovechar="=", belowchar="="),
         ListItem(Strong("name:"), self._name),
         ListItem(Strong("description:"), self.doc))
     if self.cmdline is not None:
         cmdline = get_cmdline(self.cmdline, fullpath)
         result.add(ListItem(Strong("command-line:"), cmdline))
     return result
Ejemplo n.º 4
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     result = Rest(Title(fullpath, abovechar="=", belowchar="="),
                   Directive("contents"),
                   Paragraph(Link("back to parent", path + ".html")),
                   Title("Basic Option Information"),
                   ListItem(Strong("name:"), self._name),
                   ListItem(Strong("description:"), self.doc))
     if self.cmdline is not None:
         cmdline = get_cmdline(self.cmdline, fullpath)
         result.add(ListItem(Strong("command-line:"), cmdline))
     return result
Ejemplo n.º 5
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     content = Rest(Title(fullpath, abovechar="=", belowchar="="))
     toctree = []
     for child in self._children:
         subpath = fullpath + "." + child._name
         toctree.append(subpath)
     content.add(Directive("toctree", *toctree, **{"maxdepth": 4}))
     content.join(ListItem(Strong("name:"), self._name), ListItem(Strong("description:"), self.doc))
     stack = []
     curr = content
     config = Config(self)
     return content
Ejemplo n.º 6
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     result = Rest(
         Title(fullpath, abovechar="=", belowchar="="),
         Directive("contents"),
         Paragraph(Link("back to parent", path + ".html")),
         Title("Basic Option Information"),
         ListItem(Strong("name:"), self._name),
         ListItem(Strong("description:"), self.doc),
     )
     if self.cmdline is not None:
         cmdline = get_cmdline(self.cmdline, fullpath)
         result.add(ListItem(Strong("command-line:"), cmdline))
     return result
Ejemplo n.º 7
0
def make_cmdline_overview(descr, title=True):
    content = Rest()
    if title:
        content.add(
            Title("Overview of Command Line Options for '%s'" %
                  (descr._name, ),
                  abovechar="=",
                  belowchar="="))
    cmdlines = []
    config = Config(descr)
    for path in config.getpaths(include_groups=False):
        subconf, step = config._cfgimpl_get_home_by_path(path)
        fullpath = (descr._name + "." + path)
        subdescr = getattr(subconf._cfgimpl_descr, step)
        cmdline = get_cmdline(subdescr.cmdline, fullpath)
        if cmdline is not None:
            header = _get_section_header(cmdline, fullpath, subdescr)
            cmdlines.append((header, cmdline, fullpath, subdescr))
    cmdlines.sort(key=lambda x: (x[0], x[1].strip("-")))
    currheader = ""
    curr = content
    for header, cmdline, fullpath, subdescr in cmdlines:
        if header != currheader:
            content.add(Title(header, abovechar="", belowchar="="))
            curr = content.add(Paragraph())
            currheader = header
        curr.add(
            ListItem(Link(cmdline + ":", fullpath + ".html"),
                     Text(subdescr.doc)))
    return content
Ejemplo n.º 8
0
def make_cmdline_overview(descr, title=True):
    content = Rest()
    if title:
        content.add(Title("Overview of Command Line Options for '%s'" % (descr._name,), abovechar="=", belowchar="="))
    cmdlines = []
    config = Config(descr)
    for path in config.getpaths(include_groups=False):
        subconf, step = config._cfgimpl_get_home_by_path(path)
        fullpath = descr._name + "." + path
        prefix = fullpath.rsplit(".", 1)[0]
        subdescr = getattr(subconf._cfgimpl_descr, step)
        cmdline = get_cmdline(subdescr.cmdline, fullpath)
        if cmdline is not None:
            header = _get_section_header(cmdline, fullpath, subdescr)
            cmdlines.append((header, cmdline, fullpath, subdescr))
    cmdlines.sort(key=lambda x: (x[0], x[1].strip("-")))
    currheader = ""
    curr = content
    for header, cmdline, fullpath, subdescr in cmdlines:
        if header != currheader:
            content.add(Title(header, abovechar="", belowchar="="))
            curr = content.add(Paragraph())
            currheader = header
        curr.add(ListItem(Link(cmdline + ":", fullpath + ".html"), Text(subdescr.doc)))
    return content
Ejemplo n.º 9
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     content = Rest(Title(fullpath, abovechar="=", belowchar="="),
                    Directive("contents"))
     if path:
         content.add(Paragraph(Link("back to parent", path + ".html")))
     content.join(Title("Basic Option Information"),
                  ListItem(Strong("name:"), self._name),
                  ListItem(Strong("description:"), self.doc),
                  Title("Sub-Options"))
     stack = []
     prefix = fullpath
     curr = content
     config = Config(self)
     for ending in self.getpaths(include_groups=True):
         subpath = fullpath + "." + ending
         while not (subpath.startswith(prefix)
                    and subpath[len(prefix)] == "."):
             curr, prefix = stack.pop()
         print subpath, fullpath, ending, curr
         sub, step = config._cfgimpl_get_home_by_path(ending)
         doc = getattr(sub._cfgimpl_descr, step).doc
         if doc:
             new = curr.add(
                 ListItem(Link(subpath + ":", subpath + ".html"), Em(doc)))
         else:
             new = curr.add(ListItem(Link(subpath + ":",
                                          subpath + ".html")))
         stack.append((curr, prefix))
         prefix = subpath
         curr = new
     return content
Ejemplo n.º 10
0
 def make_rest_doc(self, path=""):
     fullpath = get_fullpath(self, path)
     content = Rest(Title(fullpath, abovechar="=", belowchar="="))
     toctree = []
     for child in self._children:
         subpath = fullpath + "." + child._name
         toctree.append(subpath)
     content.add(Directive("toctree", *toctree, **{'maxdepth': 4}))
     content.join(ListItem(Strong("name:"), self._name),
                  ListItem(Strong("description:"), self.doc))
     return content