diff options
| author | Patrick Williams <patrick@stwcx.xyz> | 2016-10-09 16:22:49 -0500 |
|---|---|---|
| committer | Patrick Williams <patrick@stwcx.xyz> | 2016-10-13 08:07:57 -0500 |
| commit | 96683faf78a273b0838baad45de570e527e14781 (patch) | |
| tree | 630eb7594c708282274a0074ea2a03e9c44e429a /tools | |
| parent | 62c3f27d25809699bddc95254f5aeee59cb2ea0b (diff) | |
| download | sdbusplus-96683faf78a273b0838baad45de570e527e14781.tar.gz sdbusplus-96683faf78a273b0838baad45de570e527e14781.zip | |
method: render as markdown
Change-Id: Ie0344d632169ed779fd925d52e90299d586a0c35
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/sdbusplus/method.py | 4 | ||||
| -rw-r--r-- | tools/templates/interface.mako.md | 9 | ||||
| -rw-r--r-- | tools/templates/method.mako.md | 15 |
3 files changed, 28 insertions, 0 deletions
diff --git a/tools/sdbusplus/method.py b/tools/sdbusplus/method.py index d7635e1..b4142cb 100644 --- a/tools/sdbusplus/method.py +++ b/tools/sdbusplus/method.py @@ -10,3 +10,7 @@ class Method(NamedElement): self.errors = kwargs.pop('errors', []) super(Method, self).__init__(**kwargs) + + def markdown(self, loader): + template = loader.get_template("method.mako.md") + return template.render(method=self, loader=loader) diff --git a/tools/templates/interface.mako.md b/tools/templates/interface.mako.md index 41d2cce..a11320b 100644 --- a/tools/templates/interface.mako.md +++ b/tools/templates/interface.mako.md @@ -2,6 +2,15 @@ ${interface.description} +${"##"} Methods +% if len(interface.methods): + % for m in interface.methods: +${m.markdown(loader)} + % endfor +% else: +No methods. +% endif + ${"##"} Properties % if len(interface.properties): | name | type | description | diff --git a/tools/templates/method.mako.md b/tools/templates/method.mako.md new file mode 100644 index 0000000..4a2f9d6 --- /dev/null +++ b/tools/templates/method.mako.md @@ -0,0 +1,15 @@ +${"###"} ${method.name} + +${method.description} + +% if len(method.parameters) or len(method.returns): +${"####"} Parameters and Returns +| direction | name | type | description | +|:---------:|------|------|-------------| + % for p in method.parameters: +| in | ${p.markdown(loader)} | + % endfor + % for r in method.returns: +| out | ${r.markdown(loader)} | + % endfor +% endif |

