Skip to main content

Sphinx extension to handle Visual Basic Domain.

Project description

sphinx-vb-domain

Overview

Sphinx extension to handle Visual Basic function directive, and also create the directives from document comments in VB source code.

This project is really experimental. Only features below are working but without any assurance.

Installation

pip

pip install sphinx-vb-domain

rye

rye add --dev sphinx-vb-domain

Usage

conf.py

Add it to extensions.

# conf.py

extensions = [
    'sphinx_vb_domain',
]

Function directive

For example.

.. vb:function:: Private Function getId(ByVal name As String, ByVal age As Integer) As Integer
   :module: Module1

   A simple private function.

   :param name: Name
   :type name: String
   :param age: Age
   :type age: Integer
   :returns: Id
   :rtype: Integer

   Remarks here.

Autodoc

To creade document from VB document comments, following config is needed.

# conf.py

vb_autodoc_paths = [
    ('vb-src-dir', 'page-path', 'page-title'),
]
  • vb-src-dir
    • Path to directory contains VB source, relative from conf.py (e.g. '../../macros').
  • page-path
    • Path to reST file tobe created, relative from Sphinx source directory (e.g. 'modules' will create 'modules.rst').
  • page-title
    • Title (level-1 headline) added to e.g. modules.rst.

Then, run sphinx-build with -D vb_autodoc=1 parameter.

In file at page-path (e.g. 'modules.rst'), Module (level-2 headline) is created per vb file in vb-src-dir, and function directives under the Modules.

Cross-references

When function directives are rendered, they come with a headline so that the directives appear in toctree.
Also, the headline will be a cross-reference target.

reStructuredText

* :vb:function:`module_name.function_name`
* :any:`module_name.function_name`
* :any:`Link text <module_name.function_name>`

MyST

- {vb:function}`module_name.function_name`
- <project:#module_name.function_name>
- [Link text](#module_name.function_name)

[!NOTE] module_name and function_name are encoded if they contain characters invalid as target name.

Known issues

  • Function directive always rendered in Japanese like follows.
    Private Function getId(ByVal name As String, ByVal age As Integer) As Integer
    
        A simple private function.
    
        パラメータ: ・name (String) -- Name
                    ・age (Integer) -- Age
        戻り値: Id
        戻り値の型: Integer
    
        Remarks here.
    
    • You can change doc_field_types definition of VBFunction class.

Project details


Download files

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

Source Distribution

sphinx_vb_domain-0.3.1.tar.gz (816.8 kB view details)

Uploaded Source

Built Distribution

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

sphinx_vb_domain-0.3.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_vb_domain-0.3.1.tar.gz.

File metadata

  • Download URL: sphinx_vb_domain-0.3.1.tar.gz
  • Upload date:
  • Size: 816.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for sphinx_vb_domain-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ed37b06438598be8dfdf5fc070d4ad9dc1bf3abf627ecd12bf946b6f69669401
MD5 f7a935d32d8957dd94b7796cf8eec761
BLAKE2b-256 45bd27c4e2b0165ac54ceaff84a2e976f101ca28e4d1c4499571d53a25225716

See more details on using hashes here.

File details

Details for the file sphinx_vb_domain-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_vb_domain-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d43bce26f8a1b7bd3b65d4ba0bcdb8655b76a0517aaf3fa1002b30717aacdc8f
MD5 ad77df9df302a52cc91adfaafcdb54c5
BLAKE2b-256 8a5c1d4d8f567289cc398baed38d9583ae725fc81cf1615d22c5e9b6d0307533

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 Pingdom Monitoring Sentry Error logging StatusPage Status page