Skip to content

Commit 9830dcf

Browse files
authored
Merge pull request #294 from Tcode-Motion/refactor-dsl-to-html-inner-1646838706433682746
🧹 [extract render_component helper from dsl_to_html_inner]
2 parents afd0916 + af5add9 commit 9830dcf

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎stdlib/src/web/renderer.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,12 @@ pub fn render_footer_block(html: &mut String, dsl: &DslBlockValue) {
17681768
html.push_str("</footer>");
17691769
}
17701770

1771+
pub fn render_component(html: &mut String, dsl: &DslBlockValue) {
1772+
html.push_str("<div class=\"webforge-component card\">");
1773+
render_children(html, dsl);
1774+
html.push_str("</div>");
1775+
}
1776+
17711777
pub fn dsl_to_html_inner(val: &RuntimeValue, html: &mut String) {
17721778
if let RuntimeValue::DslBlock(dsl) = val {
17731779
match dsl.kind.as_str() {
@@ -1789,11 +1795,7 @@ pub fn dsl_to_html_inner(val: &RuntimeValue, html: &mut String) {
17891795
"nav" => render_nav(html, dsl),
17901796
"header" => render_header_block(html, dsl),
17911797
"footer" => render_footer_block(html, dsl),
1792-
"component" => {
1793-
html.push_str("<div class=\"webforge-component card\">");
1794-
render_children(html, dsl);
1795-
html.push_str("</div>");
1796-
}
1798+
"component" => render_component(html, dsl),
17971799
"website" => {
17981800
render_children(html, dsl);
17991801
}

0 commit comments

Comments
 (0)