modifs.mineures sans commentaires
This commit is contained in:
parent
9b83f276fe
commit
e59b136b64
@ -101,8 +101,10 @@ class SimpleTag implements IContent {
|
|||||||
$parts = ["<{$this->tag}"];
|
$parts = ["<{$this->tag}"];
|
||||||
$this->addAttrs($parts, $attrs);
|
$this->addAttrs($parts, $attrs);
|
||||||
$parts[] = ">";
|
$parts[] = ">";
|
||||||
A::merge($parts, $children);
|
return [c::to_string([
|
||||||
$parts[] = "</{$this->tag}>";
|
implode("", $parts),
|
||||||
return [c::to_string($parts)];
|
...$children,
|
||||||
|
"</{$this->tag}>",
|
||||||
|
])];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class Tag extends SimpleTag implements IPrintable {
|
|||||||
$parts = ["<{$this->tag}"];
|
$parts = ["<{$this->tag}"];
|
||||||
$this->addAttrs($parts, $this->attrs);
|
$this->addAttrs($parts, $this->attrs);
|
||||||
$parts[] = ">";
|
$parts[] = ">";
|
||||||
return $parts;
|
return [implode("", $parts)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildren(): array {
|
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