use crate::parser::parse_shell_blocks;
use crate::render::{render_repl_svg, render_typing_svg};
use crate::{ContentSpec, ControlSpec, CursorSpec, LayoutSpec, StyleSpec};
pub fn render_svg_from_input(
text: &str,
from_script: bool,
style: &StyleSpec,
layout: &LayoutSpec,
cursor: &CursorSpec,
control: &ControlSpec,
) -> String {
if from_script {
render_repl_from_script(text, style, layout, control)
} else {
render_typing_from_text(text, style, layout, cursor, control)
}
}
pub fn render_typing_from_text(
text: &str,
style: &StyleSpec,
layout: &LayoutSpec,
cursor: &CursorSpec,
control: &ControlSpec,
) -> String {
let content = ContentSpec {
text: text.to_string(),
};
render_typing_svg(&content, style, layout, cursor, control)
}
pub fn render_repl_from_script(
script: &str,
style: &StyleSpec,
layout: &LayoutSpec,
control: &ControlSpec,
) -> String {
let groups = parse_shell_blocks(script);
render_repl_svg(&groups, style, layout, control)
}