topmark.pipeline.steps.renderer¶
topmark / pipeline / steps / renderer
Header renderer step for the TopMark pipeline (view-based).
This step takes the selected field mapping built in the previous step
(ctx.views.build.selected) and renders it into header text using the active
file type's formatting rules. It preserves the file's newline convention,
mutates only the processing context, and performs no I/O.
Outputs
ctx.views.render.lines- rendered header lines (keepends).ctx.views.render.block- concatenated rendered text.
Notes
- The builder remains the single source of field dictionaries
(
ctx.views.build.builtins/ctx.views.build.selected). - The renderer does not compute diffs nor write to disk.
RendererStep ¶
Bases: BaseStep
Render expected header text from the selected field mapping.
Consumes BuilderView.selected and produces a RenderView with lines/block.
Preserves newline style and indentation where applicable.
Axes written
- render
Sets
- RenderStatus: {PENDING, RENDERED}
Source code in src/topmark/pipeline/steps/renderer.py
may_proceed ¶
Determine if processing can proceed to the render step.
Processing can proceed if: - The header was successfully generated (ctx.status.generation is RENDERED or GENERATED)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context for the current file. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if processing can proceed to the render step, False otherwise. |
Source code in src/topmark/pipeline/steps/renderer.py
run ¶
Render the expected header text from ctx.views.build.selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
Mutable context with:
* |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If header processor is not defined. |
Mutations
ProcessingContext: The same context with ctx.views.render populated depending on
the generation status:
* NO_FIELDS - no-op; sets ctx.views.render
= RenderView(lines=None, block=None).
* GENERATED - sets ctx.views.render.lines and ctx.views.render.block.
If the selected mapping is empty, produces an empty render defensively.
* any other status - returns unchanged.
Notes
This step mutates ctx in place and performs no I/O.
Source code in src/topmark/pipeline/steps/renderer.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 | |
hint ¶
Attach render hints (non-binding).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
ProcessingContext
|
The processing context. |
required |