Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
8f74c522d7 | |||
24f44ec093 | |||
adb7f61436 | |||
b18faec312 | |||
7432f2e77d | |||
de34c5922c |
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1747542820,
|
||||
"narHash": "sha256-GaOZntlJ6gPPbbkTLjbd8BMWaDYafhuuYRNrxCGnPJw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "292fa7d4f6519c074f0a50394dbbe69859bb6043",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
39
flake.nix
Normal file
39
flake.nix
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in
|
||||
with pkgs;
|
||||
{
|
||||
devShells.x86_64-linux.default = mkShell {
|
||||
buildInputs = with python312Packages; [
|
||||
hy
|
||||
(buildPythonPackage rec {
|
||||
pname = "hyrule";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-SZyFjXNs6thVWhKbajYelY0DoRYqrcCQcdKMNC5t6Og=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pip
|
||||
wheel
|
||||
hy
|
||||
];
|
||||
})
|
||||
bleach
|
||||
pyaml
|
||||
requests
|
||||
requests_toolbelt
|
||||
validators
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
7
requirements.txt
Normal file
7
requirements.txt
Normal file
@ -0,0 +1,7 @@
|
||||
hy>=1
|
||||
hyrule>=1
|
||||
bleach>=6.2.0
|
||||
pyaml>=25.1.0
|
||||
requests>=2.32.3
|
||||
requests-toolbelt>=1
|
||||
validators>=0.34.0
|
@ -6,27 +6,27 @@
|
||||
|
||||
(setv (get hy-env "PATH") (+ (get hy-env "PATH") ":./www/site/scripts"))
|
||||
|
||||
(defn execute-bash [data]
|
||||
(sub r"\$\[(.*?)\]" (fn [sequence]
|
||||
(. (check-output (.group sequence 1) :shell True :executable "/bin/bash" :env hy-env) (decode) (strip)))
|
||||
(defn execute-bash [data]
|
||||
(sub r"\$\[(.*?)\]" (fn [sequence]
|
||||
(. (check-output (.group sequence 1) :shell True :executable "bash" :env hy-env) (decode) (strip)))
|
||||
data))
|
||||
|
||||
(defn parse-html-file [path #** kwargs]
|
||||
(with [f (open path "r")]
|
||||
(setv data (.read f)))
|
||||
|
||||
|
||||
(for [[k v] (.items kwargs)]
|
||||
(setv data (.replace data f"{"{"}{k}{"}"}" (str v))))
|
||||
|
||||
|
||||
(execute-bash data))
|
||||
|
||||
(defn send-raw-file [path]
|
||||
(setv [mime-type _] (guess-type path))
|
||||
|
||||
|
||||
(when (not mime-type)
|
||||
(setv mime-type "text/plain"))
|
||||
|
||||
|
||||
(with [f (open path "rb")]
|
||||
(setv data (.read f)))
|
||||
|
||||
|
||||
(return #({"Content-Type" mime-type "Cache-Control" "max-age=300, stale-while-revalidate=3600"} data)))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
mkdir data
|
||||
(cd src; hy build.hy)
|
||||
rm -rf site/html
|
||||
|
@ -8,4 +8,4 @@
|
||||
(setv env hy-env)
|
||||
(setv (get env "PATH") (+ (get hy-env "PATH") ":./scripts"))
|
||||
|
||||
(print (sub r"\$\[(.*?)\]" (fn [sequence] (. (check-output (.group sequence 1) :shell True :executable "/bin/bash" :env env) (decode) (strip))) (with [fp (open (get argv 1) "r")] (.read fp))))
|
||||
(print (sub r"\$\[(.*?)\]" (fn [sequence] (. (check-output (.group sequence 1) :shell True :executable "bash" :env env) (decode) (strip))) (with [fp (open (get argv 1) "r")] (.read fp))))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
path=$1
|
||||
caption=$2
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
timeout 0.6s nvim "$1" -c "set nonu | set nornu" -c "autocmd LspAttach * execute 'TOhtml | w! ${tmpfile} | qa!'" >/dev/null || nvim "$1" -c "set nonu | set nornu" -c "TOhtml | w! ${tmpfile} | qa!" >/dev/null
|
||||
|
Reference in New Issue
Block a user