Skip to main content
https://img.shields.io/pypi/v/sphinx-lua.svg https://img.shields.io/pypi/pyversions/sphinx-lua.svg

A lua-autodoc tool for Sphinx. Generate a beautiful sphinx doc using lua doc comment.

It use emmylua as primary doc syntax but it is also compatible with some ldoc tags.

Installation

$ pip install sphinx-lua

Dependencies:

  • Jinja2 (to render rst template)

  • luadoc (to parse lua comments)

  • sphinxcontrib-luadomain (to add lua domain to sphinx)

Sphinx integration

Add the following to your conf.py:

extensions = [
    'sphinxcontrib.luadomain',
    'sphinx_lua'
    ]

# Available options and default values
lua_source_path = ["./"]
lua_source_encoding = 'utf8'
lua_source_comment_prefix = '---'
lua_source_use_emmy_lua_syntax = True
lua_source_private_prefix = '_'

The lua_source_path configuration value tells to sphinx-lua where to find lua source code.

With above configuration, if main.lua is located in ../src/lua/main.lua, and it’s content is:

--- Define a car.
--- @class MyOrg.Car
local cls = class()

--- @param foo number
function cls:test(foo)
end

You can autodoc it in sphinx with the following directive:

.. lua:autoclass:: MyOrg.Car

Troubleshooting

Sphinx-lua use the documentation model extracted from luadoc (https://github.com/boolangery/py-lua-doc)

So you can print this model out using the command line tool:

$ luadoc ../src/lua/my_problematic_source_file.lua

Available sphinx directives

The following directives are available:

.. lua:autoclass:: pl.List

.. lua:automodule:: pl.stringx

.. lua:autoclasssummary:: ^pl.

You can also use directive provided by sphinxcontrib.luadomain:

https://github.com/boolangery/sphinx-luadomain#available-sphinx-directives

Showing original source code

You can display method source code appending the flag show-source:

.. lua:autoclass:: pl.List
    :show-source:

Showing private members

By default, private members are hidden. You can display them by using the flag private-members:

.. lua:autoclass:: pl.List
    :private-members:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_lua-1.1.6.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_lua-1.1.6-py2.py3-none-any.whl (24.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sphinx_lua-1.1.6.tar.gz.

File metadata

  • Download URL: sphinx_lua-1.1.6.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sphinx_lua-1.1.6.tar.gz
Algorithm Hash digest
SHA256 87c298d116260423cf32e30c919dcfc9ea42ceb3a5fecccedb99506097286c21
MD5 b3a2ca90604c940f1ba00039982862e6
BLAKE2b-256 f5bc6f7b0690227582299b7125e250697c71671ee349262241cb5f4f3e56c53c

See more details on using hashes here.

File details

Details for the file sphinx_lua-1.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: sphinx_lua-1.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for sphinx_lua-1.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c82687d2ab8a6a8ed9e57a648deae690c76aba04c52619f05453018dd89a1179
MD5 9c6d544e2e0c5c4ac4bc3bc179d192ce
BLAKE2b-256 b475a200d1da263a6251b284f580451502c82ceb4486995093811827331d7f39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page