Skip to content

Commit fab8f91

Browse files
committed
improve documentation generation
1 parent de5b15e commit fab8f91

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

api_class.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import zeep
22

3+
{{#doc}}
34
# {{doc}}
5+
{{/doc}}
46
class {{class_name}}:
57
__module__ = 'skautis'
68

@@ -11,7 +13,9 @@ class {{class_name}}:
1113
self._client = zeep.Client('https://is.skaut.cz/JunakWebservice/{{class_name}}.asmx?wsdl')
1214

1315
{{#methods}}
16+
{{#doc}}
1417
# {{doc}}
18+
{{/doc}}
1519
def {{name}}({{def_args}}):
1620
return self._client.service.{{name}}({{args}})
1721

skautis_api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class SkautisApi:
66
def __init__(self, appId, test=False):
77
self._appId = appId
88
self._test = test
9-
9+
1010
{{#sections}}
1111
self.{{module}} = {{class}}(test)
1212
{{/sections}}

skautis_api_gen.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ def parse_wsdl(section_url):
6161

6262
# extract service documentation
6363
doc_tree = tree.find('wsdl:documentation', ns)
64-
main_doc = "No documentation"
65-
if doc_tree is not None:
66-
main_doc = doc_tree.text
64+
main_doc = doc_tree.text if doc_tree is not None else None
6765

6866
# load interesting parts of wsdl file
6967
ports = tree.find('wsdl:portType', ns)
@@ -81,7 +79,7 @@ def parse_wsdl(section_url):
8179
for port in ports:
8280
# load and check port documentation
8381
doc_tag = port.find('wsdl:documentation', ns)
84-
doc = doc_tag.text if doc_tag is not None else "No documentation"
82+
doc = doc_tag.text.strip() if doc_tag is not None else None
8583

8684
# load port name
8785
name = port.attrib['name']

0 commit comments

Comments
 (0)