Skip to content

Commit

Permalink
improve documentation generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikjak committed Dec 19, 2024
1 parent de5b15e commit fab8f91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions api_class.mustache
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import zeep

{{#doc}}
# {{doc}}
{{/doc}}
class {{class_name}}:
__module__ = 'skautis'

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

{{#methods}}
{{#doc}}
# {{doc}}
{{/doc}}
def {{name}}({{def_args}}):
return self._client.service.{{name}}({{args}})

Expand Down
2 changes: 1 addition & 1 deletion skautis_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SkautisApi:
def __init__(self, appId, test=False):
self._appId = appId
self._test = test

{{#sections}}
self.{{module}} = {{class}}(test)
{{/sections}}
Expand Down
6 changes: 2 additions & 4 deletions skautis_api_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def parse_wsdl(section_url):

# extract service documentation
doc_tree = tree.find('wsdl:documentation', ns)
main_doc = "No documentation"
if doc_tree is not None:
main_doc = doc_tree.text
main_doc = doc_tree.text if doc_tree is not None else None

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

# load port name
name = port.attrib['name']
Expand Down

0 comments on commit fab8f91

Please sign in to comment.