decided in favor of dedicated COMPONENT() macro, updates to documentation
This commit is contained in:
@@ -7,7 +7,7 @@ RENDER(Request& context)
|
||||
|
||||
DTree named_props;
|
||||
named_props["title"] = "Named Render Example";
|
||||
named_props["body"] = "This content is rendered through the RENDER:BODY(Request& context) entry point.";
|
||||
named_props["body"] = "This content is rendered through the COMPONENT:BODY(Request& context) entry point.";
|
||||
|
||||
<>
|
||||
<link rel="stylesheet" href='style.css?v=<?= time() ?>'></link>
|
||||
@@ -23,11 +23,11 @@ RENDER(Request& context)
|
||||
component_resolve("components/card"):
|
||||
<code><?= component_resolve("components/card") ?></code>
|
||||
</p>
|
||||
<h2>Default Render</h2>
|
||||
<h2>Default Component</h2>
|
||||
<div>
|
||||
<?: component("components/card", card_props, context) ?>
|
||||
</div>
|
||||
<h2>Named Render</h2>
|
||||
<h2>Named Component</h2>
|
||||
<? render_component("components/card:BODY", named_props, context); ?>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
|
||||
RENDER(Request& context)
|
||||
COMPONENT(Request& context)
|
||||
{
|
||||
<>
|
||||
<section style="border:1px solid #ccc;padding:1em;margin:1em 0;">
|
||||
<? render_component("card:TITLE", context.call, context); ?>
|
||||
<? render_component("card:BODY", context.call, context); ?>
|
||||
<? render_component(":TITLE", context.call, context); ?>
|
||||
<? render_component(":BODY", context.call, context); ?>
|
||||
</section>
|
||||
</>
|
||||
}
|
||||
|
||||
RENDER:TITLE(Request& context)
|
||||
COMPONENT:TITLE(Request& context)
|
||||
{
|
||||
<>
|
||||
<h3><?= first(context.call["title"].to_string(), "Component Title") ?></h3>
|
||||
</>
|
||||
}
|
||||
|
||||
RENDER:BODY(Request& context)
|
||||
COMPONENT:BODY(Request& context)
|
||||
{
|
||||
<>
|
||||
<p><?= first(context.call["body"].to_string(), "Component Body") ?></p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RENDER(Request& context)
|
||||
COMPONENT(Request& context)
|
||||
{
|
||||
String lang = first(context.call["lang"].to_string(), "plain");
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RENDER(Request& context)
|
||||
COMPONENT(Request& context)
|
||||
{
|
||||
String title = first(
|
||||
context.call["node"]["attrs"]["title"].to_string(),
|
||||
|
||||
Reference in New Issue
Block a user