modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2025-11-12 12:30:43 +04:00
parent 9b83f276fe
commit e59b136b64
4 changed files with 32 additions and 4 deletions

View File

@ -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}>",
])];
}
}

View File

@ -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
View 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
View 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",
]);