[ENH] Add macro to generate enum tables filtered by tags
Currently, some documentation manually maintain duplicate enum tables when the values already exist in schema definitions with tags.
Proposal:
Add a macro that generates tables from existing enum definitions filtered by tag:
{{ MACROS___make_enum_table("type__channels", "microephys") }}
Functionality:
- Takes column definition (for example, type__channels)
- Filters enums by tag (for example, microephys)
- Generates formatted table automatically
Example:
Instead of manually listing microelectrophysiology (#1705 ) channel types like LFP, HP, MUA in documentation, the macro would pull all microephys-tagged enums from the type__channels definition automatically.
Backwards compatibility: This is a documentation enhancement that doesn't change the specification itself, so it's fully backwards compatible.
Mock example:
Current manual approach:
| Value | Description |
|-------|-------------|
| LFP | Local field potential |
| HP | High-pass filtered signal |
| MUA | Multi-unit activity |
Proposed macro approach:
{{ MACROS___make_enum_table("type__channels", "microephys") }}
This would automatically generate the same table by pulling from the schema.
Sounds like a great idea!
The places to implement this would be:
- Rendering code: https://github.com/bids-standard/bids-specification/blob/master/tools/schemacode/src/bidsschematools/render/tables.py
- Wrapper: https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/macros.py
- Macro definition: https://github.com/bids-standard/bids-specification/blob/master/tools/mkdocs_macros_bids/main.py
Thanks for links! I will try to implement it then.