bidsschematools.render.text¶
Functions for rendering portions of the schema as text.
Functions
- bidsschematools.render.text.append_filename_template_legend(text, pdf_format=False)¶
Append a legend to filename templates.
- bidsschematools.render.text.define_allowed_top_directories(schema, src_path=None) str ¶
Create a list of allowed top-level directories with their descriptions.
- bidsschematools.render.text.define_common_principles(schema, src_path=None)¶
Enumerate the common principles defined in the schema.
- bidsschematools.render.text.make_entity_definitions(schema, src_path=None)¶
Generate definitions and other relevant information for entities in the specification.
Each entity gets its own heading.
- bidsschematools.render.text.make_filename_template(dstype, schema=None, src_path=None, n_dupes_to_combine=6, pdf_format=False, **kwargs)¶
Create codeblocks containing example filename patterns for a given datatype.
By default, this function uses HTML, instead of direct Markdown codeblocks, so that it can embed hyperlinks within the filenames.
- Parameters:
dstype ("raw" or "deriv") – The type of files being rendered; determines if rules are found in rules.files.raw or rules.files.deriv
schema (dict) – The schema object, which is a dictionary with nested dictionaries and lists stored within it.
src_path (str or None) – The file where this macro is called, which may be explicitly provided by the “page.file.src_path” variable.
n_dupes_to_combine (int) – The minimum number of suffixes/extensions to combine in the template as <suffix>/<extension>.
pdf_format (bool, optional) – If True, the filename template will be compiled as a standard markdown code block, without any hyperlinks, so that the specification’s PDF build will look right. If False, the filename template will use HTML and include hyperlinks. This works on the website. Default is False.
**kwargs (dict) – Keyword arguments used to filter the schema. Example kwargs that may be used include: “suffixes”, “datatypes”, “extensions”.
- Returns:
codeblock – A multiline string containing the filename templates for file types in the schema, after filtering.
- Return type:
Notes
This function links to HTML files, rather than markdown files.
- bidsschematools.render.text.make_glossary(schema, src_path=None)¶
Generate glossary.
- Parameters:
- Returns:
text – A string containing descriptions and some formatting information about the entities in the schema.
- Return type:
- bidsschematools.render.text.render_text(schema, key: str, src_path=None)¶
- Parameters:
- Returns:
desc – Description of the object.
- Return type:
- bidsschematools.render.text.value_key_table(namespace)¶