diff --git a/README.md b/README.md index 637d779..e809cc1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ # perc -Better Werc \ No newline at end of file +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/) + + diff --git a/app.rb b/app.rb index 95cf1a1..3f5e0cb 100644 --- a/app.rb +++ b/app.rb @@ -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 diff --git a/deploy b/deploy new file mode 100755 index 0000000..cc529f8 --- /dev/null +++ b/deploy @@ -0,0 +1,4 @@ +#!/usr/bin/sh + + +RUBY_YJIT_ENABLE=1 rackup \ No newline at end of file