mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-17 09:59:39 +00:00
Added 'Extra Anchors:' section to doce generation.
This commit is contained in:
parent
7c32fb2927
commit
30af11d7be
1 changed files with 24 additions and 0 deletions
|
@ -247,6 +247,7 @@ class LeafNode(object):
|
||||||
self.description = []
|
self.description = []
|
||||||
self.usages = []
|
self.usages = []
|
||||||
self.arguments = []
|
self.arguments = []
|
||||||
|
self.anchors = []
|
||||||
self.side_effects = []
|
self.side_effects = []
|
||||||
self.examples = []
|
self.examples = []
|
||||||
|
|
||||||
|
@ -315,6 +316,17 @@ class LeafNode(object):
|
||||||
argname = argname.strip()
|
argname = argname.strip()
|
||||||
argdesc = argdesc.strip()
|
argdesc = argdesc.strip()
|
||||||
self.arguments.append([argname, argdesc])
|
self.arguments.append([argname, argdesc])
|
||||||
|
if line.startswith("Extra Anchors:"):
|
||||||
|
lines, block = get_comment_block(lines, prefix)
|
||||||
|
for line in block:
|
||||||
|
if "=" not in line:
|
||||||
|
print("Error: bad anchor line:")
|
||||||
|
print(line)
|
||||||
|
sys.exit(2)
|
||||||
|
anchorname, anchordesc = line.split("=", 1)
|
||||||
|
anchorname = anchorname.strip()
|
||||||
|
anchordesc = anchordesc.strip()
|
||||||
|
self.anchors.append([anchorname, anchordesc])
|
||||||
if line.startswith("Side Effects:"):
|
if line.startswith("Side Effects:"):
|
||||||
lines, block = get_comment_block(lines, prefix)
|
lines, block = get_comment_block(lines, prefix)
|
||||||
self.side_effects.extend(block)
|
self.side_effects.extend(block)
|
||||||
|
@ -370,6 +382,18 @@ class LeafNode(object):
|
||||||
for sfx in self.side_effects:
|
for sfx in self.side_effects:
|
||||||
out.append("- " + mkdn_esc(sfx))
|
out.append("- " + mkdn_esc(sfx))
|
||||||
out.append("")
|
out.append("")
|
||||||
|
if self.anchors:
|
||||||
|
out.append("Anchor Name | Description")
|
||||||
|
out.append("--------------- | ------------------------------")
|
||||||
|
for anchorname, anchordesc in self.anchors:
|
||||||
|
anchorname = anchorname.replace(" / ", "` / `")
|
||||||
|
out.append(
|
||||||
|
"{0:15s} | {1}".format(
|
||||||
|
"`{0}`".format(anchorname),
|
||||||
|
mkdn_esc(anchordesc)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
out.append("")
|
||||||
exnum = 0
|
exnum = 0
|
||||||
for title, excode, extype in self.examples:
|
for title, excode, extype in self.examples:
|
||||||
exnum += 1
|
exnum += 1
|
||||||
|
|
Loading…
Reference in a new issue