* Add comment.

This commit is contained in:
songchenxuan
2025-04-03 08:44:48 +08:00
committed by 刘刚
parent 2cadfc1539
commit bd969ebc8b
+28 -4
View File
@@ -45,7 +45,13 @@ function hookContent(): htm
return h::comment('{{HOOK_CONTENT}}');
}
function rParse($rawContent)
/**
* 解析 rawContent 中的 rStart 和 rBottom 标记,提取内容块。
*
* @param string $rawContent 原始内容字符串
* @return array 包含所有内容块的数组,键为块名,值为块内容
*/
function rParse($rawContent): array
{
$rawContents = [];
/* 解析所有的 rStart 标记,提取内容块。 */
@@ -63,17 +69,35 @@ function rParse($rawContent)
return $rawContents;
}
function rTop($name)
/**
* 生成 rStart 标记。
*
* @param string $name 标记名称
* @return htm 包含 rStart 标记的 htm 对象
*/
function rTop($name): htm
{
return h::comment('{RTOP:' . $name . '}');
}
function rBottom($name)
/**
* 生成 rBottom 标记。
*
* @param string $name 标记名称
* @return htm 包含 rBottom 标记的 htm 对象
*/
function rBottom($name): htm
{
return h::comment('{RBOTTOM:' . $name . '}');
}
function rHolder($name)
/**
* 生成 rContent 标记。
*
* @param string $name 标记名称
* @return string 包含 rContent 标记的字符串
*/
function rHolder($name): string
{
context()->rawContentCalled = true;
$name = strtoupper($name);