Compare commits
2 commits
50152e4abf
...
f0e0bf16da
Author | SHA1 | Date | |
---|---|---|---|
f0e0bf16da | |||
21c1b5303c |
3 changed files with 22 additions and 2 deletions
15
README.md
15
README.md
|
@ -1,3 +1,16 @@
|
||||||
# perc
|
# perc
|
||||||
|
|
||||||
Better Werc
|
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
5
app.rb
|
@ -147,14 +147,17 @@ class Sidebar
|
||||||
end
|
end
|
||||||
|
|
||||||
$sidebar = Sidebar.new
|
$sidebar = Sidebar.new
|
||||||
|
$files_cache = {}
|
||||||
def pview(file)
|
def pview(file)
|
||||||
body = ""
|
body = ""
|
||||||
cont = File.read(file) or return "Not found"
|
cont = File.read(file) or return "Not found"
|
||||||
if (file =~ /\.erb$/)
|
if (file =~ /\.erb$/)
|
||||||
|
# We can't cache erb
|
||||||
tp = ERB.new(cont)
|
tp = ERB.new(cont)
|
||||||
body = tp.result(binding)
|
body = tp.result(binding)
|
||||||
elsif (file =~ /\.md$/)
|
elsif (file =~ /\.md$/)
|
||||||
body = $markdown.render cont
|
# But we can cache markdown
|
||||||
|
body = ($files_cache[file] ||= $markdown.render cont)
|
||||||
end
|
end
|
||||||
put_in_layout(body)
|
put_in_layout(body)
|
||||||
end
|
end
|
||||||
|
|
4
deploy
Executable file
4
deploy
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
RUBY_YJIT_ENABLE=1 rackup
|
Loading…
Add table
Add a link
Reference in a new issue