Compare commits
6 Commits
e4debff28e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ddfb114c7 | |||
| 66dc28eca7 | |||
| dfc582d367 | |||
| 803138a49a | |||
| d7a601dd5e | |||
| 41142b963a |
2
Gemfile
2
Gemfile
@@ -1,3 +1,3 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'nokogiri', '~>1.12.5'
|
||||
gem 'nokogiri'
|
||||
|
||||
10
Gemfile.lock
10
Gemfile.lock
@@ -1,9 +1,9 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
mini_portile2 (2.6.1)
|
||||
nokogiri (1.12.5)
|
||||
mini_portile2 (~> 2.6.1)
|
||||
mini_portile2 (2.8.0)
|
||||
nokogiri (1.13.3)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
racc (1.6.0)
|
||||
|
||||
@@ -11,7 +11,7 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
nokogiri (~> 1.12.5)
|
||||
nokogiri
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.24
|
||||
2.1.4
|
||||
|
||||
@@ -2,8 +2,10 @@ require "open3"
|
||||
require "nokogiri"
|
||||
require "net/http"
|
||||
require "json"
|
||||
require "cgi"
|
||||
|
||||
def render_cached(cache, display, string, render_comment = nil)
|
||||
string = CGI.unescapeHTML string
|
||||
cache.fetch(string) do |new|
|
||||
puts " Rendering #{render_comment || new}"
|
||||
res = Net::HTTP.post URI("http://localhost:8000/render"),
|
||||
@@ -29,7 +31,7 @@ inline_cache, display_cache = {}, {}
|
||||
files.each do |file|
|
||||
puts "Rendering file: #{file}"
|
||||
document = Nokogiri::HTML.parse(File.open(file))
|
||||
document.search('//*[not(ancestor-or-self::code)]/text()').each do |t|
|
||||
document.search('//*[not(ancestor-or-self::code or ancestor-or-self::script)]/text()').each do |t|
|
||||
t.replace(perform_katex_sub(inline_cache, display_cache, t.content))
|
||||
end
|
||||
File.write(file, document.to_html(encoding: 'UTF-8'))
|
||||
|
||||
20
flake.lock
generated
20
flake.lock
generated
@@ -36,11 +36,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1648434477,
|
||||
"narHash": "sha256-0WLqHSmsbuk+ZJ1C8WvTAwr8kb138PDhQZ8/K/1dMBU=",
|
||||
"lastModified": 1666145384,
|
||||
"narHash": "sha256-kpHv3EawXzyR1mRX4joIqqZDYz//xyUMtGMsmJk3YuE=",
|
||||
"ref": "master",
|
||||
"rev": "796efcea28f7e2bd9858d9d1b86e2bd8158825b8",
|
||||
"revCount": 5,
|
||||
"rev": "cce6cf6a9458537ff1cb08dd8dad4f8460060f76",
|
||||
"revCount": 7,
|
||||
"type": "git",
|
||||
"url": "https://dev.danilafe.com/Nix-Configs/katex-server"
|
||||
},
|
||||
@@ -51,11 +51,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1648425779,
|
||||
"narHash": "sha256-0tcpEiiq3f3Hh77ax7QFuF15AnPaBIdDSbvrCUeyb9k=",
|
||||
"lastModified": 1648444094,
|
||||
"narHash": "sha256-2liapKh7WXPHELuzLvYK+464g4w9tr9DbNxGuz8XZ98=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1edfe6d91bd8348cfccacd72e82d1d06ad470117",
|
||||
"rev": "87c74b8120980461a9d4ce8f341551ce0fb50728",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -66,11 +66,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1648425779,
|
||||
"narHash": "sha256-0tcpEiiq3f3Hh77ax7QFuF15AnPaBIdDSbvrCUeyb9k=",
|
||||
"lastModified": 1648444094,
|
||||
"narHash": "sha256-2liapKh7WXPHELuzLvYK+464g4w9tr9DbNxGuz8XZ98=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1edfe6d91bd8348cfccacd72e82d1d06ad470117",
|
||||
"rev": "87c74b8120980461a9d4ce8f341551ce0fb50728",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1lvxm91hi0pabnkkg47wh1siv56s6slm2mdq1idfm86dyfidfprq";
|
||||
sha256 = "0rapl1sfmfi3bfr68da4ca16yhc0pp93vjwkj7y3rdqrzy3b41hy";
|
||||
type = "gem";
|
||||
};
|
||||
version = "2.6.1";
|
||||
version = "2.8.0";
|
||||
};
|
||||
nokogiri = {
|
||||
dependencies = ["mini_portile2" "racc"];
|
||||
@@ -15,10 +15,10 @@
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1v02g7k7cxiwdcahvlxrmizn3avj2q6nsjccgilq1idc89cr081b";
|
||||
sha256 = "1p6b3q411h2mw4dsvhjrp1hh66hha5cm69fqg85vn2lizz71n6xz";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.12.5";
|
||||
version = "1.13.3";
|
||||
};
|
||||
racc = {
|
||||
groups = ["default"];
|
||||
|
||||
Reference in New Issue
Block a user