modifs.mineures sans commentaires
This commit is contained in:
parent
9b83f276fe
commit
e59b136b64
@ -101,8 +101,10 @@ class SimpleTag implements IContent {
|
||||
$parts = ["<{$this->tag}"];
|
||||
$this->addAttrs($parts, $attrs);
|
||||
$parts[] = ">";
|
||||
A::merge($parts, $children);
|
||||
$parts[] = "</{$this->tag}>";
|
||||
return [c::to_string($parts)];
|
||||
return [c::to_string([
|
||||
implode("", $parts),
|
||||
...$children,
|
||||
"</{$this->tag}>",
|
||||
])];
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ class Tag extends SimpleTag implements IPrintable {
|
||||
$parts = ["<{$this->tag}"];
|
||||
$this->addAttrs($parts, $this->attrs);
|
||||
$parts[] = ">";
|
||||
return $parts;
|
||||
return [implode("", $parts)];
|
||||
}
|
||||
|
||||
function getChildren(): array {
|
||||
|
||||
14
src/web/vo.php
Normal file
14
src/web/vo.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace nulib\web;
|
||||
|
||||
use nulib\php\content\c;
|
||||
use nulib\web\content\v;
|
||||
|
||||
/**
|
||||
* Class vo: classe outil pour afficher les tags générés par {@link v}
|
||||
*/
|
||||
class vo {
|
||||
static function __callStatic($name, $args) {
|
||||
c::write(call_user_func_array([v::class, $name], $args));
|
||||
}
|
||||
}
|
||||
12
tbin/test-vo.php
Normal file
12
tbin/test-vo.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
require __DIR__ . "/../vendor/autoload.php";
|
||||
|
||||
use nulib\web\content\v;
|
||||
use nulib\web\vo;
|
||||
|
||||
vo::h1("titre");
|
||||
vo::p("paragraph");
|
||||
vo::p([
|
||||
"il y a", v::b(4), "lapins.",
|
||||
"allons à la plage",
|
||||
]);
|
||||
Loading…
x
Reference in New Issue
Block a user