raesl.doc.doc#

Document module.

Module Contents#

Classes#

Doc

Output document.

Par

Paragraph.

Functions#

get_bundle_root(→ Union[None, str])

Check if variable originates from a bundle and return the name

Attributes#

TEMPLATES

raesl.doc.doc.TEMPLATES#
class raesl.doc.doc.Doc(*paths: str | pathlib.Path, language: str = 'en', prologue: pathlib.Path | None = None, epilogue: pathlib.Path | None = None, goal_section: [bool] = True, transformation_section: [bool] = True, behavior_section: [bool] = True, design_section: [bool] = True, need_section: [bool] = True, relation_section: [bool] = True, var_table: [bool] = True, rich: str | None = 'tex', rich_opts: Dict[str, Any] | None = None, esl_paths: List[str] | List[pathlib.Path] | None = None, **metadata)#

Output document.

Parameters:
  • paths – ESL input files.

  • language – Output language.

  • prologue – Markdown document to include as a prologue.

  • epilogue – Markdown document to include as a conclusion.

  • goal_section – Goal section toggle.

  • transformation_section – Transformation section toggle.

  • behavior_section – Behavior section toggle.

  • design_section – Design section toggle.

  • need_section – Need section toggle.

  • relation_section – Need section toggle.

  • var_table – Var table toggle.

  • rich – Format to create rich output content in, defaults to ‘tex’.

  • rich_opts – Rich output generation options.

Keyword Arguments:

documentation. (Document metadata. See pandoc) –

property as_markdown: str#

Markdown representation of this document.

markdown_file_format = 'markdown+table_captions+multiline_tables+pipe_tables'#
markdown_generated = 'markdown+table_captions+multiline_tables+pipe_tables+grid_tables'#
parse_esl()#

Parse an ESL output Graph

yield_markdown() Generator[str, None, None]#

Yield markdown lines.

yield_metadata() Generator[str, None, None]#

Yield metadata lines.

yield_pars() Generator[str, None, None]#

Yield all paragraph texts.

save(path: pathlib.Path | str, to: str | None = None, pandoc_args: List[str] = ['--standalone', '--number-sections', '--toc', '--listings', '--self-contained'], filters: List[str] = ['pandoc-fignos'])#

Save document as a file.

Parameters:
  • path – Path to save to.

  • to – Optional format to save to. Normally derived from path.

  • pandoc_args – Additional arguments for pandoc conversion tool.

  • filters – Pandoc filters to use.

get_bundle_name_parts() Set[str]#

Get set of all name parts of bundles used within the spec

Returns:

Set of all name parts of bundles.

set_var_bundle_roots()#

Set the bundle root of variables if they originate from a bundle.

class raesl.doc.doc.Par(lines: Iterable[str], obj: Any | None = None)#

Paragraph.

Parameters:
  • lines – Lines of this paragraph.

  • obj – Object of this paragraph.

md#

Markdown representation.

raesl.doc.doc.get_bundle_root(vname: str, bundle_name_parts: Set) None | str#

Check if variable originates from a bundle and return the name of the root of the bundle.

Parameters:
  • vname – Name of the variable to check.

  • bundle_name_parts – Set of strings the comprise bundle names.

Returns:

None or Name of the root of the bundle from which the variable originates.