Sphinx extension to generate a list or table from a sequence of items
Project description
sphinxcontrib-itemlist
Sphinx extension to create a list or table of different items marked with a
special .. item:: directive.
This extension is quite similar to the .. contents:: directive, since its
purpose is to create a list of shortcuts to different targets.
The main differences with contents are:
- possibility to create a summary table or a list, not only a list
- not restricted to list sections, so not necessary to artifically create sections
Usage
Some examples are in the demo/ folder.
Items you want to be referenced in a list or table must use the .. item:: directive:
.. item:: This is an Item title
This is the long description of the Item.
:Tag: Arbitrary tag
:Category: My arbitrary category
The field list can be used when generating a table to add extra columns with their contents.
All item of a page can then be collected.
For a list:
.. item_list::
For a table:
.. item_table::
List options
:numbered:uses numbers instead of bullet points:local:instead of collectingitemfrom all the page, only collect the ones from the current section
Example with all options:
.. item_list::
:numbered:
:local:
Table options
:local:instead of collectingitemfrom all the page, only collect the ones from the current section:headers:which columns to add to the table ; the fields added in theitemare used for that, separated with a comma:desc_name:set a title for the column containing the first line of theitemdirective ; once set, it can be used in the:headers:option to organize the column order
Example with all options:
.. item_table::
:local:
:headers: Tag, Description, Category
:desc_name: Description
Default fields
When used with the table, it is possible to add implicit fields with item, when a success of item should
have some common fields. To introduce a new scope with default fields:
.. item_default_fields::
:Tag: Default tag
To stop adding a default field, just create a new scope with any fields:
.. item_default_fields::
Caveat: when defining default fields, there must be a new line between the directive and the field list. Otherwise there are considered options of the directive.
Possible options:
:hidden:Does not add the default fields in the `item`` only in the table.
Example with option and default fields:
.. item_default_fields::
:hidden:
:Tag: Default tag
Installation
$ pip install sphinxcontrib-itemlist
Then add in your Sphinx conf.py file:
extensions = [ "sphinxcontrib.itemlist" ]
Alternatives
Some alternatives I found:
-
- missed it at first look, not referenced in official
contribrepository - too heavyweight for my needs
- missed it at first look, not referenced in official
-
- goal and result is a bit different, too specific
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinxcontrib-itemlist-1.0.0.tar.gz.
File metadata
- Download URL: sphinxcontrib-itemlist-1.0.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.63.0 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b02df9a58e0b06f3c9ac8f7b1e9b0f5e316cdc03387d6022690cbc53c39fd458
|
|
| MD5 |
461c586340d176fc7fe3d1f28e4b46e2
|
|
| BLAKE2b-256 |
1d940cb2cd0317ea5312a338e34ea5ccc49a505c1e559654c9eba196cd28fbab
|
File details
Details for the file sphinxcontrib_itemlist-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sphinxcontrib_itemlist-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.63.0 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e88dad217527a917f9109e78fdc3435ec319c1375cb3c7d104d243d53b838f4
|
|
| MD5 |
415492059481da4bd682af55606eaed7
|
|
| BLAKE2b-256 |
0ceca119a803efa95518f5ac998a01a25c2c16f7384f9dc0e9dfdd6b451d72e5
|