raesl.doc
¶
ESL to Doc
A Python package to process specifications in the form of .esl
files into regular
document formats such as .pdf
.
convert
¶
convert(
*paths: Union[str, Path],
output: Union[str, Path] = OUTPUT,
language: str = LANGUAGE,
title: str = TITLE,
prologue: Optional[Union[str, Path]] = PROLOGUE,
epilogue: Optional[Union[str, Path]] = EPILOGUE,
var_table: bool = VARTABLE,
rich: Optional[str] = RICH,
rich_opts: Optional[Dict[str, Any]] = None,
force: bool = FORCE,
dry: bool = DRY,
**metadata
)
Convert ESL files and/or directories to a formatted document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths
|
Union[str, Path]
|
Paths to resolve into ESL files. May be any number of files and directories to scan. |
()
|
output
|
Union[str, Path]
|
Optional output file (i.e. Markdown, PDF, DOCX). |
OUTPUT
|
language
|
str
|
Output document language. |
LANGUAGE
|
title
|
str
|
Output document title. |
TITLE
|
prologue
|
Optional[Union[str, Path]]
|
Optional prologue document to include (Markdown). |
PROLOGUE
|
epilogue
|
Optional[Union[str, Path]]
|
Optional epilogue document to include (Markdown). |
EPILOGUE
|
var_table
|
bool
|
Add table with all variables within appendix. |
VARTABLE
|
rich
|
Optional[str]
|
Format of rich output to use. One of "tex", "md" or "off". |
RICH
|
rich_opts
|
Optional[Dict[str, Any]]
|
Extra options for selected rich output. |
None
|
force
|
bool
|
Whether to overwrite the output file or raise an error if the file already exists. |
FORCE
|
dry
|
bool
|
Dry run. Skip creating an output document. |
DRY
|
Source code in src/raesl/doc/__init__.py
cli
¶
ESL to Doc Command Line Interface.
doc
¶
doc(
paths: Iterable[str],
output: str,
language: str,
title: str,
prologue: Optional[str],
epilogue: Optional[str],
rich: Optional[str],
force: bool,
dry: bool,
)
Convert ESL files and/or directories to a formatted document.
Source code in src/raesl/doc/cli.py
doc
¶
Document module.
Doc
¶
Doc(
*paths: Union[str, Path],
language: str = "en",
prologue: Optional[Path] = None,
epilogue: Optional[Path] = 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: Optional[str] = "tex",
rich_opts: Optional[Dict[str, Any]] = None,
esl_paths: Optional[
Union[List[str], List[Path]]
] = None,
**metadata
)
Output document.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths
|
Union[str, Path]
|
ESL input files. |
()
|
language
|
str
|
Output language. |
'en'
|
prologue
|
Optional[Path]
|
Markdown document to include as a prologue. |
None
|
epilogue
|
Optional[Path]
|
Markdown document to include as a conclusion. |
None
|
goal_section
|
bool
|
Goal section toggle. |
True
|
transformation_section
|
bool
|
Transformation section toggle. |
True
|
behavior_section
|
bool
|
Behavior section toggle. |
True
|
design_section
|
bool
|
Design section toggle. |
True
|
need_section
|
bool
|
Need section toggle. |
True
|
relation_section
|
bool
|
Need section toggle. |
True
|
var_table
|
bool
|
Var table toggle. |
True
|
rich
|
Optional[str]
|
Format to create rich output content in, defaults to 'tex'. |
'tex'
|
rich_opts
|
Optional[Dict[str, Any]]
|
Rich output generation options. |
None
|
Keyword Arguments: Document metadata. See pandoc documentation.
Source code in src/raesl/doc/doc.py
get_bundle_name_parts
¶
Get set of all name parts of bundles used within the spec
Returns:
Type | Description |
---|---|
Set[str]
|
Set of all name parts of bundles. |
Source code in src/raesl/doc/doc.py
parse_esl
¶
Parse an ESL output Graph
Source code in src/raesl/doc/doc.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
save
¶
save(
path: Union[Path, str],
to: Optional[str] = None,
pandoc_args: List[str] = [
"--standalone",
"--number-sections",
"--toc",
"--listings",
"--self-contained",
],
filters: List[str] = ["pandoc-fignos"],
)
Save document as a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Union[Path, str]
|
Path to save to. |
required |
to
|
Optional[str]
|
Optional format to save to. Normally derived from path. |
None
|
pandoc_args
|
List[str]
|
Additional arguments for pandoc conversion tool. |
['--standalone', '--number-sections', '--toc', '--listings', '--self-contained']
|
filters
|
List[str]
|
Pandoc filters to use. |
['pandoc-fignos']
|
Source code in src/raesl/doc/doc.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|
set_var_bundle_roots
¶
Set the bundle root of variables if they originate from a bundle.
Source code in src/raesl/doc/doc.py
yield_markdown
¶
yield_metadata
¶
Par
¶
Paragraph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lines
|
Iterable[str]
|
Lines of this paragraph. |
required |
obj
|
Optional[Any]
|
Object of this paragraph. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
md |
Markdown representation. |
Source code in src/raesl/doc/doc.py
get_bundle_root
¶
Check if variable originates from a bundle and return the name of the root of the bundle.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vname
|
str
|
Name of the variable to check. |
required |
bundle_name_parts
|
Set
|
Set of strings the comprise bundle names. |
required |
Returns:
Type | Description |
---|---|
Union[None, str]
|
None or Name of the root of the bundle from which the variable originates. |
Source code in src/raesl/doc/doc.py
lines
¶
Module to generate text lines that describe ESL objects.
Hookspecs
¶
bold
¶
boldhead
¶
Get a bold header (without numbering) with surrounding whitespace.
Source code in src/raesl/doc/lines.py
bundle_clarification
¶
bundle_clarification(
brvdict: Dict[str, List[Node]], html: bool = False
)
Yield bundle clarification section
Source code in src/raesl/doc/lines.py
bundle_path
¶
bundle_path(
path: str,
root: str,
italic: bool = False,
arrows: bool = True,
skip: str = "world",
)
Get a friendly representation of a bundle path.
Source code in src/raesl/doc/lines.py
cap
¶
component_node
¶
component_node(node: Node, h: int) -> LineGen
Yield component section
Source code in src/raesl/doc/lines.py
emph
¶
get_design_rule_line_vars
¶
get_design_rule_line_vars(
rules: List[Dict[str, str]], g: Graph
)
Get variables that are used within a design rule line
Source code in src/raesl/doc/lines.py
header
¶
Get a header with surrounding whitespace and optional capitalization.
Source code in src/raesl/doc/lines.py
hs
¶
image
¶
image(
path: str,
caption: Optional[str] = None,
label: Optional[str] = None,
sizing: Optional[str] = None,
) -> str
Get Pandoc Markdown for an image.
Source code in src/raesl/doc/lines.py
lines
¶
lines(node: Node, **kwargs) -> LineGen
Yield lines that describes a Node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
Node
|
Node to generate the lines from. |
required |
Source code in src/raesl/doc/lines.py
node_path
¶
Get a friendly representation of a node path.
Source code in src/raesl/doc/lines.py
ordered
¶
Generate an ordered Markdown or html list.
Source code in src/raesl/doc/lines.py
snt
¶
unordered
¶
Generate an unordered Markdown or html list.
Source code in src/raesl/doc/lines.py
var_clarification
¶
var_clarification(bvars: List[Node], html: bool = False)
Yield variable clarification section.
Source code in src/raesl/doc/lines.py
var_path
¶
var_path(
v: Node,
italic: bool = False,
arrows: bool = True,
skip: str = "world",
)
Get a friendly representation of a variable path.
Source code in src/raesl/doc/lines.py
locales
¶
Localization module.
Hookspecs
¶
list_locales
¶
List available locales.
register_default_locale
¶
Register default locale if no other locale is set.
Source code in src/raesl/doc/locales/__init__.py
register_locale
¶
Register a locale. Existing locales are re-registered.
Source code in src/raesl/doc/locales/__init__.py
nl
¶
Dutch locale overrides.
gettext
¶
make_predicate
¶
Check if a "splitsend werkwoord" has been used and return predicate.
Argument
Returns Predicate of the sentence.
Source code in src/raesl/doc/locales/nl.py
subclause_line
¶
rich
¶
Rich document content.
mdm
¶
mdm(
graph: Graph,
depth: int,
rich: str = "tex",
rich_opts: Dict[str, Any] = {},
img_dir: Optional[Union[Path, str]] = None,
) -> Generator[str, None, None]
Generate an Multi-Domain Matrix.
Yields:
Type | Description |
---|---|
str
|
Rich output lines. |
Source code in src/raesl/doc/rich.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
sections
¶
comp_node_behavior_cons
¶
Yield a behavior constraint section for a component node.
Source code in src/raesl/doc/sections.py
comp_node_behavior_reqs
¶
Yield a behavior requirement section for a component node.
Source code in src/raesl/doc/sections.py
comp_node_design_cons
¶
Yield a design constraint section for a component node.
Source code in src/raesl/doc/sections.py
comp_node_design_reqs
¶
Yield a design requirements section for a component node.
Source code in src/raesl/doc/sections.py
comp_node_goal_cons
¶
Yield a goal-constraint section for a component
Source code in src/raesl/doc/sections.py
comp_node_goal_reqs
¶
Yield a goal-requirement section for a component
Source code in src/raesl/doc/sections.py
comp_node_needs
¶
Yield a need section for a component node.
Source code in src/raesl/doc/sections.py
comp_node_props
¶
Yield a properties section for a component node
Source code in src/raesl/doc/sections.py
comp_node_relations
¶
Yield a relation section for a component.
Source code in src/raesl/doc/sections.py
comp_node_subcomps
¶
comp_node_subcomps(node: Node, h: int = 1)
Yield a subcomponents sections for a component.
Source code in src/raesl/doc/sections.py
comp_node_transformation_cons
¶
Yield a transformation constraints section for a component.
Source code in src/raesl/doc/sections.py
comp_node_transformation_reqs
¶
Yield a transformation requirements section for a component.
Source code in src/raesl/doc/sections.py
get_node_table
¶
get_node_table(
node: Node,
graph: Optional[Graph] = None,
sub_nodes: Optional[List[str]] = None,
) -> List
Returns a Markdown grid table.
Source code in src/raesl/doc/sections.py
get_var_table_row_elements
¶
Yield elements of a row in a var table.
Source code in src/raesl/doc/sections.py
global_design_cons
¶
global_design_cons(g: Graph, h: int = 1) -> LineGen
Yield a global design constraint section.
Source code in src/raesl/doc/sections.py
global_design_reqs
¶
global_design_reqs(g: Graph, h: int = 1) -> LineGen
Yield a global design requirements section.
Source code in src/raesl/doc/sections.py
global_needs
¶
global_needs(g: Graph, h: int = 1) -> LineGen
Yield a global need section.
Source code in src/raesl/doc/sections.py
global_needs_and_designs
¶
Yield a global need and design specification intro section.
Source code in src/raesl/doc/sections.py
node_decomp_level
¶
node_decomp_level(
depth: int,
comps: List[Node],
h: int = 1,
rich: str = None,
rich_opts: dict = {},
)
Yield a decomposition level intro section.
Source code in src/raesl/doc/sections.py
var_node_table
¶
var_node_table(
g: Graph, h: int = 1, reference_list: bool = False
) -> LineGen
Yield a variable table section.
Source code in src/raesl/doc/sections.py
utils
¶
Doc generation utility functions.
get_component_behaviors
¶
Get relevant behavior requirements or constraints for a component.
Source code in src/raesl/doc/utils.py
get_component_designs
¶
Get relevant design requirements or constraints for a component.
Source code in src/raesl/doc/utils.py
get_component_goals
¶
get_component_goals(
component: Node,
graph: Graph,
constraint: bool = True,
inherited: bool = True,
) -> List[Node]
Get relevant goal requirements or constraints for a component.
Source code in src/raesl/doc/utils.py
get_component_needs
¶
Get relevant needs for a component.
Source code in src/raesl/doc/utils.py
get_component_properties
¶
Get relevant properties for a component.
get_component_relations
¶
Get relevant relations for a component.
get_component_transformations
¶
get_component_transformations(
component: Node, graph: Graph, constraint: bool = True
) -> List[Node]
Get relevant transformation requirements or constraints for a component.
Source code in src/raesl/doc/utils.py
get_global_designs
¶
Get globally relevant design requirments or constraints.
Source code in src/raesl/doc/utils.py
get_global_needs
¶
Get globally relevant needs.