From 557a1b1dc1b6a7b18b21166ab369ab2decfaa4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 26 Jan 2022 02:40:47 +0100 Subject: [PATCH] Make types optional in documentation generators. --- src/main/scripts/lib/lua/devices.lua | 10 ++++++++-- src/main/scripts/lib/micropython/devices.py | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/scripts/lib/lua/devices.lua b/src/main/scripts/lib/lua/devices.lua index d12efe03..e299a4f9 100644 --- a/src/main/scripts/lib/lua/devices.lua +++ b/src/main/scripts/lib/lua/devices.lua @@ -29,11 +29,17 @@ Device.__tostring = function(self) else doc = doc .. "arg" .. i end - doc = doc .. ": " .. p.type + if p.type then + doc = doc .. ": " .. p.type + end i = i + 1 end end - doc = doc .. "): " .. method.returnType .. "\n" + doc = doc .. ")" + if method.returnType then + doc = doc .. ": " .. method.returnType + end + doc = doc .. "\n" if method.description then doc = doc .. method.description .. "\n" diff --git a/src/main/scripts/lib/micropython/devices.py b/src/main/scripts/lib/micropython/devices.py index 49fb1c4a..9c7aeeb0 100644 --- a/src/main/scripts/lib/micropython/devices.py +++ b/src/main/scripts/lib/micropython/devices.py @@ -28,9 +28,13 @@ class Device: doc += p["name"] else: doc += "arg" + str(i) - doc += ": " + p["type"] + if "type" in p: + doc += ": " + p["type"] i += 1 - doc += "): " + method["returnType"] + "\n" + doc += ")" + if "returnType" in method: + doc += ": " + method["returnType"] + doc += "\n" if "description" in method and method["description"]: doc += method["description"] + "\n"