1
Fork 0
mirror of https://github.com/RGBCube/HTMNIX synced 2025-07-25 23:17:44 +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"; inputs.nixpkgslib.url = "github:nix-community/nixpkgs.lib";
outputs = { self, nixpkgslib }: let outputs = { self, nixpkgslib }: let
inherit (nixpkgslib) lib;
first = n: builtins.substring 0 n; first = n: builtins.substring 0 n;
dropFirst = n: string: builtins.substring n (builtins.stringLength string - n) string; dropFirst = n: string: builtins.substring n (builtins.stringLength string - n) string;
last = n: string: builtins.substring (builtins.stringLength string - n) n string; last = n: string: builtins.substring (builtins.stringLength string - n) n string;
dropLast = n: string: builtins.substring 0 (builtins.stringLength string - 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; inherit (escapix) escape;
attrsetToHtmlAttrs = attrs: attrsetToHtmlAttrs = attrs:
@ -31,7 +33,7 @@
call = builtins.scopedImport { call = builtins.scopedImport {
inherit (self) raw call __findFile; inherit (self) raw call __findFile;
inherit (nixpkgslib) lib; inherit lib;
}; };
result = self.call /${builtins.getEnv "TARGET_FILE"}; result = self.call /${builtins.getEnv "TARGET_FILE"};
@ -40,8 +42,8 @@
outPath = dottedNameToTag name; outPath = dottedNameToTag name;
__functor = this: next: __functor = this: next:
# Not an attrset. Just escape and add it onto the HTML. # Not an attrset or an escaped one. Just toString it and add it onto the HTML.
if !builtins.isAttrs next if builtins.isAttrs next -> lib.hasSuffix "-_" next.outPath or ""
then this // { then this // {
outPath = (toString this) + escape (toString next); outPath = (toString this) + escape (toString next);
} }