Compare commits

...

2 commits

Author SHA1 Message Date
f0e0bf16da Added todo list 2025-06-02 16:43:12 +10:00
21c1b5303c Added cache
Only fork markdown tho, can't cache erb.

Now also added a deploy script which runs erb
2025-06-02 16:28:44 +10:00
3 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,16 @@
# perc
Better Werc
# TODO
- [ ] Documentation
- [ ] Adding expiry to cache files.
- [ ] Adding support for [Slim](https://slim-template.github.io/) Template
- [ ] Support for dirrent layout files for subdirectory.
- [ ] Adding search. From what I can find, there are several good tools aviable that
index the site, e.g. [sphinix](https://sphinxsearch.com/), [Apache
Lucene](https://lucene.apache.org/), and [Xapian](https://xapian.org/)

5
app.rb
View file

@ -147,14 +147,17 @@ class Sidebar
end
$sidebar = Sidebar.new
$files_cache = {}
def pview(file)
body = ""
cont = File.read(file) or return "Not found"
if (file =~ /\.erb$/)
# We can't cache erb
tp = ERB.new(cont)
body = tp.result(binding)
elsif (file =~ /\.md$/)
body = $markdown.render cont
# But we can cache markdown
body = ($files_cache[file] ||= $markdown.render cont)
end
put_in_layout(body)
end

4
deploy Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/sh
RUBY_YJIT_ENABLE=1 rackup