* zin: support to create h5 node with createWg.

This commit is contained in:
sunhao
2024-04-19 11:15:22 +08:00
parent 1c790512a9
commit ca52ce3cb5
3 changed files with 8 additions and 0 deletions
+2
View File
@@ -18,6 +18,8 @@ require_once __DIR__ . DS . 'directive.class.php';
class h extends node
{
public static array $h5Tags = array('div', 'span', 'strong', 'small', 'code', 'canvas', 'br', 'a', 'p', 'img', 'button', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'li', 'template', 'fieldset', 'legend');
public static array $defineProps = array
(
'tagName' => 'string',
+1
View File
@@ -32,6 +32,7 @@ function h3(mixed ...$args): h {return h::h3(...$args);}
function h4(mixed ...$args): h {return h::h4(...$args);}
function h5(mixed ...$args): h {return h::h5(...$args);}
function h6(mixed ...$args): h {return h::h6(...$args);}
function ol(mixed ...$args): h {return h::ol(...$args);}
function ul(mixed ...$args): h {return h::ul(...$args);}
function li(mixed ...$args): h {return h::li(...$args);}
function template(mixed ...$args): h {return h::template(...$args);}
+5
View File
@@ -42,6 +42,11 @@ function createWg($name, $args, ?string $fallbackWgName = null): node
$wgVer = getWgVer($name);
$wgName = "\\zin\\$name";
if(in_array($name, h::$h5Tags))
{
return h::$name($args);
}
if(!class_exists($wgName))
{
include_once dirname(__DIR__) . DS . 'wg' . DS . $name . DS . "v$wgVer.php";