initial commit
This commit is contained in:
commit
74670edee1
9 changed files with 141 additions and 0 deletions
18
nixite/html.nix
Normal file
18
nixite/html.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
rec {
|
||||
toHTML = elem:
|
||||
if builtins.typeOf elem == "string"
|
||||
then elem
|
||||
else if builtins.typeOf elem == "list"
|
||||
then builtins.toString (map toHTML elem)
|
||||
else ''<${elem.tag}>${toHTML elem.child}</${elem.tag}>'';
|
||||
|
||||
writeAttrs = attrs:
|
||||
toString builtins.attrValues (
|
||||
builtins.mapAttrs (key: value: ''${key}="${value}"'') attrs
|
||||
);
|
||||
|
||||
tag = tag: child: {
|
||||
inherit tag child;
|
||||
__toString = toHTML;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue