Metadata-Version: 2.5
Name: sphinx-ub-directives
Version: 0.1.0
Summary: Define your own Sphinx directives: presets of existing directives, and Jinja template directives
Keywords: sphinx,directives,presets,templates,jinja,ubproject
Author-email: team useblocks <info@useblocks.com>
Requires-Python: >=3.11,<4
Description-Content-Type: text/markdown
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Sphinx
Classifier: Framework :: Sphinx :: Extension
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Documentation
Classifier: Topic :: Documentation :: Sphinx
Classifier: Topic :: Software Development :: Documentation
Classifier: Typing :: Typed
License-File: LICENSE
Requires-Dist: sphinx>=7.4,<10
Requires-Dist: docutils>=0.21
Requires-Dist: minijinja~=2.15
Requires-Dist: ub-project>=1.2.0,<2
Requires-Dist: furo>=2025.12.19 ; extra == "docs"
Requires-Dist: myst-parser>=4.0.0 ; extra == "docs"
Requires-Dist: sphinx-ai-index>=1.0.0,<2 ; extra == "docs"
Requires-Dist: sphinx-design>=0.6.1 ; extra == "docs"
Requires-Dist: sphinx-needs>=9.2,<10 ; extra == "needs"
Project-URL: Changelog, https://github.com/useblocks/sphinx-needs/blob/master/packages/sphinx-ub-directives/docs/changelog.rst
Project-URL: Documentation, https://sphinx-ub-directives.readthedocs.io
Project-URL: Homepage, https://sphinx-ub-directives.readthedocs.io
Project-URL: Issues, https://github.com/useblocks/sphinx-needs/issues
Project-URL: Repository, https://github.com/useblocks/sphinx-needs
Provides-Extra: docs
Provides-Extra: needs
Import-Name: sphinx_ub_directives

# sphinx-ub-directives

A Sphinx extension for defining your own directives, without writing Python:

- **directive presets**: a new directive name that is an existing directive with preset
  options, or project-wide defaults for an existing one;
- **template directives**: a directive of your own whose output is a Jinja template,
  rendered with its argument, options and body and with plain data you declare;
- **`ub-template`**, a generic template directive, switched on when you want it.

```python
# conf.py
extensions = ["sphinx_ub_directives"]

ub_directive_presets = {
    "callout": {"base": "note", "append_options": {"class": "callout"}},
}
```

Everything can be configured in `conf.py` or in `ubproject.toml`.

**With sphinx-needs** (optional): a preset can be based on a need type (sphinx-needs 9.2 or later), and every template
sees the project's variant data as `var`, the same values `.. if::` evaluates against.

**With [ubCode](https://ubcode.useblocks.com/)**: ubCode reads the same tables from
`ubproject.toml` and implements the same behaviour, so a project configured there renders the
same text and the same needs in both. The behaviour is specified by
[`design/directives-contract.md`](design/directives-contract.md), and its executable half is
the two conformance corpora in `tests/fixtures/`, which ubCode vendors. ubCode does not read
`conf.py`: settings written there apply to the Sphinx build only.

