diff --git a/flake.nix b/flake.nix index bff1a0b..3542429 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,7 @@ { description = "A site in nix?"; - inputs = { - tix.url = "git+https://git.tristans.cloud/tristan/tix"; - }; + inputs = { tix.url = "git+https://git.tristans.cloud/tristan/tix"; }; outputs = { self, nixpkgs, tix }: let diff --git a/nixite/md.nix b/nixite/md.nix index 7aa0e36..01d3380 100644 --- a/nixite/md.nix +++ b/nixite/md.nix @@ -1,5 +1,4 @@ -let - elems = import ./elems.nix; +let elems = import ./elems.nix; in rec { readMd = md: if builtins.isPath md then @@ -66,7 +65,7 @@ in rec { (let m = builtins.match regex block; before = let v = builtins.elemAt m 0; in if v == null then "" else v; - after = toString( builtins.elemAt m (matchCount - 1)); + after = toString (builtins.elemAt m (matchCount - 1)); matchCount = builtins.length m; in if m == null then block @@ -97,14 +96,11 @@ in rec { (basicRule (wrap "~~") elems.del) (basicRule (wrap "\\*\\*") elems.strong) (basicRule (wrapBreak "__") elems.strong) - (rule (contains "\\[(.*)]\\((.*)\\)") ( - m: + (rule (contains "\\[(.*)]\\((.*)\\)") (m: let href = builtins.elemAt m 2; text = builtins.elemAt m 1; - in - (elems.a href text) - )) + in (elems.a href text))) (rule ('' (.* )([^-][^ @@ -127,8 +123,15 @@ in rec { }) [ m ])) [ (builtins.elemAt l 2) ])) )) - (basicRule ( "(.*\n\n)?(.+)\n(.*)?" ) elems.p) - (basicRule ("(.*\n\n)?```(.*)```(.*)?") (elems.textarea { readonly = true; })) + (basicRule ('' + (.* + + )?(.+) + (.*)?'') elems.p) + (basicRule ('' + (.* + + )?```(.*)```(.*)?'') (elems.textarea { readonly = true; })) (basicRule (containsBreak '' ###### ([^ ]+)'') (elems.h6)) diff --git a/testing/elems.test.nix b/testing/elems.test.nix index 6ada732..897bc53 100644 --- a/testing/elems.test.nix +++ b/testing/elems.test.nix @@ -1,4 +1,5 @@ -{it,...}:let +{ it, ... }: +let elems = import ../nixite/elems.nix; style = import ../nixite/style.nix; html = import ../nixite/html.nix; diff --git a/testing/html.test.nix b/testing/html.test.nix index d64332b..96c3871 100644 --- a/testing/html.test.nix +++ b/testing/html.test.nix @@ -1,5 +1,5 @@ -{it, ...}: let - html = import ../nixite/html.nix; +{ it, ... }: +let html = import ../nixite/html.nix; in with html; [ (it "keeps info in the tag" (let p = tag "p"; diff --git a/testing/md.test.nix b/testing/md.test.nix index a35ee2e..4a8d216 100644 --- a/testing/md.test.nix +++ b/testing/md.test.nix @@ -1,4 +1,5 @@ -{it,...}: let +{ it, ... }: +let md = import ../nixite/md.nix; elems = import ../nixite/elems.nix; in with md; [ @@ -99,7 +100,10 @@ in with md; [ foo bar ''; - expected = "
lorem ipsum\ndolor sit\n
foo bar
"; + expected = '' +lorem ipsum + dolor sit +
foo bar
''; asString = true; }) diff --git a/testing/site.test.nix b/testing/site.test.nix index 0c89044..8e1e893 100644 --- a/testing/site.test.nix +++ b/testing/site.test.nix @@ -1,4 +1,5 @@ -{it,...}:let +{ it, ... }: +let html = import ../nixite/html.nix; elems = import ../nixite/elems.nix; site = import ../nixite/site.nix; diff --git a/testing/style.test.nix b/testing/style.test.nix index a2da79b..fb81f90 100644 --- a/testing/style.test.nix +++ b/testing/style.test.nix @@ -1,4 +1,5 @@ -{it,...}: let +{ it, ... }: +let style = import ../nixite/style.nix; elems = import ../nixite/elems.nix; in [