Write index.html

master
knotteye 2020-12-23 11:54:28 -06:00
parent 1faa875989
commit c8aa41d626
3 changed files with 9 additions and 0 deletions

BIN
blogtool

Binary file not shown.

View File

@ -40,13 +40,17 @@ def render_file(filename : String | Path)
Base+Markd.to_html(File.read(filename), Markd::Options.new(smart: true, safe: false))+"</body></html>"
end
index = Base
Dir.entries("articles").select{ |i| i != "." && i != ".." }.each do |article|
if article[article.size-3, article.size] == ".md"
File.write Path.new("dist", article[0,article.size-3]+".html"), render_file("articles/"+article)
index += "<h4><a href=\"/"+article[0,article.size-3]+"\"/>"+article[0,article.size-3]+"</a></h4>\n"
else
File.write Path.new("dist", article+".html"), render_file("articles/"+article)
index += "<h4><a href=\"/"+article+"\"/>"+article+"</a></h4>\n"
end
end
File.write Path["dist/index.html"], index+"</body></html>"
Dir.entries("assets").select{ |i| i != "." && i != ".." }.each do |asset|
File.copy Path.new("assets", asset), Path.new("dist", "static", asset)

View File

@ -0,0 +1,5 @@
# Second test
brbrbbr
testing things