Commit 8337f6ff authored by Geoff Simmons's avatar Geoff Simmons

Add the $Synopsis directive to vmod.vcc sources.

Vaild values are 'auto' or 'manual', default 'auto'. With 'auto' you
get the auto-generated SYNOPSIS in the VMOD docs. With 'manual', the
SYNOPSIS is just skipped, so the VMOD author has to write it.
parent 29c0c571
......@@ -602,15 +602,16 @@ class s_module(stanza):
fo.write("\n")
fo.write(":Manual section: " + self.vcc.mansection + "\n")
fo.write("\n")
write_rst_hdr(fo, "SYNOPSIS", "=")
fo.write("\n")
fo.write("\n::\n\n")
fo.write(' import %s [from "path"] ;\n' % self.vcc.modname)
fo.write(" \n")
for c in self.vcc.contents:
c.synopsis(fo, man)
fo.write("\n")
if self.vcc.auto_synopsis:
fo.write("\n")
write_rst_hdr(fo, "SYNOPSIS", "=")
fo.write("\n")
fo.write("\n::\n\n")
fo.write(' import %s [from "path"] ;\n' % self.vcc.modname)
fo.write(" \n")
for c in self.vcc.contents:
c.synopsis(fo, man)
fo.write("\n")
def rsttail(self, fo, man):
......@@ -652,6 +653,15 @@ class s_prefix(stanza):
self.vcc.contents.append(self)
class s_synopsis(stanza):
def parse(self):
if self.line[1] not in ('auto', 'manual'):
err("Valid Synopsis values are 'auto' or 'manual', got '%s'\n" %
self.line[1])
self.vcc.auto_synopsis = self.line[1] == 'auto'
self.vcc.contents.append(self)
class s_event(stanza):
def parse(self):
self.event_func = self.line[1]
......@@ -814,6 +824,7 @@ dispatch = {
"Function": s_function,
"Object": s_object,
"Method": s_method,
"Synopsis": s_synopsis,
}
......@@ -828,6 +839,7 @@ class vcc(object):
self.copyright = ""
self.enums = {}
self.strict_abi = True
self.auto_synopsis = True
def openfile(self, fn):
self.commit_files.append(fn)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment