diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-04-16 17:46:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 17:46:20 (GMT) |
commit | ecba748f427f40cbae35dd0cd8ffca88c4840606 (patch) | |
tree | a76c01e291432a8e7b59e3164809498d9d58d427 /bin | |
parent | a74dc0c7ba1d5dd83f36b5ef91974f5fc89df267 (diff) | |
parent | 9ec99deef3afe9d6230b29cc87cfc5ecc9916186 (diff) | |
download | SCons-ecba748f427f40cbae35dd0cd8ffca88c4840606.zip SCons-ecba748f427f40cbae35dd0cd8ffca88c4840606.tar.gz SCons-ecba748f427f40cbae35dd0cd8ffca88c4840606.tar.bz2 |
Merge pull request #3613 from mwichmann/func-html-fmt
Update generation of scons-xml entities
Diffstat (limited to 'bin')
-rw-r--r-- | bin/scons-proc.py | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/bin/scons-proc.py b/bin/scons-proc.py index 9923ac1..4370004 100644 --- a/bin/scons-proc.py +++ b/bin/scons-proc.py @@ -251,6 +251,7 @@ class Proxy(object): ## return self.__dict__ < other.__dict__ class SConsThing(Proxy): + """Base class for the SConsDoc special elements""" def idfunc(self): return self.name @@ -260,6 +261,7 @@ class SConsThing(Proxy): return [e] class Builder(SConsThing): + """Generate the descriptions and entities for <builder> elements""" description = 'builder' prefix = 'b-' tag = 'function' @@ -269,20 +271,20 @@ class Builder(SConsThing): builders don't show a full signature, just func() """ + # build term for global function gterm = stf.newNode("term") - sig = stf.newSubNode(gterm, "literal") - func = stf.newSubNode(sig, "emphasis", role="bold") + func = stf.newSubNode(gterm, "function") stf.setText(func, self.name) stf.setTail(func, '()') + # build term for env. method mterm = stf.newNode("term") - sig = stf.newSubNode(mterm, "literal") - inst = stf.newSubNode(sig, "replaceable") + inst = stf.newSubNode(mterm, "parameter") stf.setText(inst, "env") stf.setTail(inst, ".") - func = stf.newSubNode(sig, "emphasis", role="bold") - stf.setText(func, self.name) - stf.setTail(func, '()') + meth = stf.newSubNode(mterm, "methodname") + stf.setText(meth, self.name) + stf.setTail(meth, '()') return [gterm, mterm] @@ -290,6 +292,7 @@ class Builder(SConsThing): return self.name class Function(SConsThing): + """Generate the descriptions and entities for <scons_function> elements""" description = 'function' prefix = 'f-' tag = 'function' @@ -311,23 +314,37 @@ class Function(SConsThing): signature = 'both' if stf.hasAttribute(arg, 'signature'): signature = stf.getAttribute(arg, 'signature') - s = stf.getText(arg).strip() + sig = stf.getText(arg).strip()[1:-1] # strip (), temporarily if signature in ('both', 'global'): + # build term for global function gterm = stf.newNode("term") - sig = stf.newSubNode(gterm, "literal") - func = stf.newSubNode(sig, "emphasis", role="bold") + func = stf.newSubNode(gterm, "function") stf.setText(func, self.name) - stf.setTail(func, s) + if sig: + # if there are parameters, use that entity + stf.setTail(func, "(") + s = stf.newSubNode(gterm, "parameter") + stf.setText(s, sig) + stf.setTail(s, ")") + else: + stf.setTail(func, "()") tlist.append(gterm) if signature in ('both', 'env'): + # build term for env. method mterm = stf.newNode("term") - sig = stf.newSubNode(mterm, "literal") - inst = stf.newSubNode(sig, "replaceable") + inst = stf.newSubNode(mterm, "replaceable") stf.setText(inst, "env") stf.setTail(inst, ".") - func = stf.newSubNode(sig, "emphasis", role="bold") - stf.setText(func, self.name) - stf.setTail(func, s) + meth = stf.newSubNode(mterm, "methodname") + stf.setText(meth, self.name) + if sig: + # if there are parameters, use that entity + stf.setTail(meth, "(") + s = stf.newSubNode(mterm, "parameter") + stf.setText(s, sig) + stf.setTail(s, ")") + else: + stf.setTail(meth, "()") tlist.append(mterm) if not tlist: @@ -338,6 +355,7 @@ class Function(SConsThing): return self.name class Tool(SConsThing): + """Generate the descriptions and entities for <tool> elements""" description = 'tool' prefix = 't-' tag = 'literal' @@ -349,6 +367,7 @@ class Tool(SConsThing): return self.name class Variable(SConsThing): + """Generate the descriptions and entities for <cvar> elements""" description = 'construction variable' prefix = 'cv-' tag = 'envar' |