Skip to content

Commit 5694834

Browse files
author
Tjaz Erzen
committed
Fix setting the render range correctly
1 parent eccacfa commit 5694834

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

plain2code.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,17 @@ def render(args, run_state: RunState, codeplain_api, event_bus: EventBus): # no
161161

162162
console.info(f"Rendering {args.filename} to target code.")
163163

164+
# Compute render range from either --render-range or --render-from
165+
render_range = None
166+
if args.render_range or args.render_from:
167+
# Parse the plain file to get the plain_source for FRID extraction
168+
_, plain_source, _ = plain_file.plain_file_parser(args.filename, template_dirs)
169+
170+
if args.render_range:
171+
render_range = get_render_range(args.render_range, plain_source)
172+
elif args.render_from:
173+
render_range = get_render_range_from(args.render_from, plain_source)
174+
164175
codeplainAPI = codeplain_api.CodeplainAPI(args.api_key, console)
165176
codeplainAPI.verbose = args.verbose
166177
assert args.api is not None and args.api != "", "API URL is required"
@@ -169,7 +180,7 @@ def render(args, run_state: RunState, codeplain_api, event_bus: EventBus): # no
169180
module_renderer = ModuleRenderer(
170181
codeplainAPI,
171182
args.filename,
172-
args.render_range,
183+
render_range,
173184
template_dirs,
174185
args,
175186
run_state,

0 commit comments

Comments
 (0)