py-lua-doc
A Lua documentation extraction tool written in Python that support emmy-lua and ldoc doc-comment.
It's both a development library and a command line tool.
Given a lua source file, it creates a documentation model.
Installation
The package can be installed through pip:
$ pip3 install luadoc
It will install the shell command 'luadoc'.
How to generate documentation ?
This project is part of a Sphinx documentation plugin: sphinx-lua
Node Structure
The node structure is for now only described in model.py
Command Line
The command line tool just serialize the tree to Json.
Given:
--- @class foo.Base
local Base = {}
--- @class foo.List: foo.Base
local List = {}
--- Apply a function to all elements.
--- Any extra arguments will be passed to the function.
--- @param fun fun(a:any):any a function of at least one argument
--- @vararg any @arbitrary extra arguments.
--- @return foo.List a new list: {f(x) for x in self}
function List:map(fun, ...) end
--- Split a string using a delim.
--- @param delim string the delim (default " ")
--- @overload fun()
function List:split(delim) end
return List
$ luadoc source.lua
The following output will be produced:
{
"filename": "test.lua",
"classes": [
{
"name": "foo.Base",
"name_in_source": "Base",
"methods": [],
"desc": "",
"usage": "",
"inherits_from": [],
"fields": []
},
{
"name": "foo.List",
"name_in_source": "List",
"methods": [
{
"name": "map",
"short_desc": "Apply a function to all elements.",
"desc": "Any extra arguments will be passed to the function.",
"params": [
{
"name": "fun",
"desc": "a function of at least one argument",
"type": {
"id": "callable",
"arg_types": [
{
"id": "any"
}
],
"return_types": [
{
"id": "any"
}
]
},
"is_opt": false,
"default_value": ""
},
{
"name": "...",
"desc": "arbitrary extra arguments.",
"type": {
"id": "any"
},
"is_opt": false,
"default_value": ""
}
],
"returns": [
{
"desc": "a new list: {f(x) for x in self}",
"type": {
"id": "custom",
"name": "foo.List"
}
}
],
"usage": "",
"is_virtual": false,
"is_abstract": false,
"is_deprecated": false,
"is_static": false,
"visibility": "public"
},
{
"name": "split",
"short_desc": "Split a string using a delim.",
"desc": "",
"params": [
{
"name": "delim",
"desc": "the delim (default \" \")",
"type": {
"id": "string"
},
"is_opt": false,
"default_value": ""
}
],
"returns": [],
"usage": "",
"is_virtual": false,
"is_abstract": false,
"is_deprecated": false,
"is_static": false,
"visibility": "public"
},
{
"name": "split",
"short_desc": "Split a string using a delim.",
"desc": "",
"params": [],
"returns": [],
"usage": "",
"is_virtual": false,
"is_abstract": false,
"is_deprecated": false,
"is_static": false,
"visibility": "public"
}
],
"desc": "",
"usage": "",
"inherits_from": [
"foo.Base"
],
"fields": []
}
],
"functions": [],
"data": [],
"name": "unknown",
"is_class_mod": false,
"short_desc": "",
"desc": "",
"usage": ""
}
Many other examples can be seen in luadoc/tests/source.
Release files for luadoc 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| luadoc-1.3.3.tar.gz | 31.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| luadoc-1.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.3 kB
Release files / luadoc-1.3.3.tar.gz
| Download URL | luadoc-1.3.3.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94ccc50f5f0f99ff17ba3f35593b4d123e835e9761f8e7a3f8b29c7e1c715103
|
|
BLAKE2b-256 checksum How to use checksums |
80db513b451d8dcc0ab47fae97de9bee27b7700e22771c6a3e1bf85bc8daeab4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / luadoc-1.3.3-py3-none-any.whl
| Download URL | luadoc-1.3.3-py3-none-any.whl |
|---|---|
| Size | 32.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
957d62e16e83dcb982dac3282e5f2156a509e64377d9712292d4ca60f5a27e33
|
|
BLAKE2b-256 checksum How to use checksums |
6468f4268702b7826f745450441c0ed537842c6327c23103c5aada10e17b2d50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|