1
Fork 0
mirror of https://github.com/RGBCube/HTMNIX synced 2025-07-24 14:37:41 +00:00

Fix raw escapes on their own

This commit is contained in:
RGBCube 2024-02-28 13:24:22 +03:00
parent bd30355f48
commit 6e2c6ff8f3
No known key found for this signature in database

View file

@ -4,13 +4,15 @@
inputs.nixpkgslib.url = "github:nix-community/nixpkgs.lib";
outputs = { self, nixpkgslib }: let
inherit (nixpkgslib) lib;
first = n: builtins.substring 0 n;
dropFirst = n: string: builtins.substring n (builtins.stringLength string - n) string;
last = n: string: builtins.substring (builtins.stringLength string - n) n string;
dropLast = n: string: builtins.substring 0 (builtins.stringLength string - n) string;
escapix = import ./escape.nix nixpkgslib.lib;
escapix = import ./escape.nix lib;
inherit (escapix) escape;
attrsetToHtmlAttrs = attrs:
@ -31,7 +33,7 @@
call = builtins.scopedImport {
inherit (self) raw call __findFile;
inherit (nixpkgslib) lib;
inherit lib;
};
result = self.call /${builtins.getEnv "TARGET_FILE"};
@ -40,8 +42,8 @@
outPath = dottedNameToTag name;
__functor = this: next:
# Not an attrset. Just escape and add it onto the HTML.
if !builtins.isAttrs next
# Not an attrset or an escaped one. Just toString it and add it onto the HTML.
if builtins.isAttrs next -> lib.hasSuffix "-_" next.outPath or ""
then this // {
outPath = (toString this) + escape (toString next);
}