mirror of
https://github.com/RGBCube/HTMNIX
synced 2025-07-25 23:17:44 +00:00
Don't HTML-ify <nixpkgs> and handle lists properly
This commit is contained in:
parent
53bc65d910
commit
7f54a2fedc
1 changed files with 11 additions and 3 deletions
14
flake.nix
14
flake.nix
|
@ -27,6 +27,9 @@
|
||||||
then "<${dropLast 1 name}/>"
|
then "<${dropLast 1 name}/>"
|
||||||
|
|
||||||
else "<${name}>";
|
else "<${name}>";
|
||||||
|
|
||||||
|
# When doing <name>, these won't return HTML tags.
|
||||||
|
propagatedFindFiles = [ "nixpkgs" ];
|
||||||
in {
|
in {
|
||||||
inherit (escapix) raw;
|
inherit (escapix) raw;
|
||||||
inherit lib;
|
inherit lib;
|
||||||
|
@ -37,12 +40,17 @@
|
||||||
|
|
||||||
result = self.call /${builtins.getEnv "TARGET_FILE"};
|
result = self.call /${builtins.getEnv "TARGET_FILE"};
|
||||||
|
|
||||||
__findFile = _: name: {
|
__findFile = env: name: if builtins.elem name propagatedFindFiles then __findFile env name else {
|
||||||
outPath = dottedNameToTag name;
|
outPath = dottedNameToTag name;
|
||||||
|
|
||||||
__functor = this: next:
|
__functor = this: next:
|
||||||
# Not an attrset. Just add it onto the HTML.
|
# Is a list. Consume each item. Treat it as if it was passed in one by one.
|
||||||
if !lib.isAttrs next
|
if lib.isList next
|
||||||
|
then lib.foldl' (this: this) (this (lib.head next)) (lib.tail next)
|
||||||
|
|
||||||
|
# Not an attrset or list.
|
||||||
|
# Just add it onto the HTML after stringifying it.
|
||||||
|
else if !lib.isAttrs next
|
||||||
then this // {
|
then this // {
|
||||||
outPath = (toString this) + escape (toString next);
|
outPath = (toString this) + escape (toString next);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue