Write index.html

master
knotteye 3 years ago
parent 1faa875989
commit c8aa41d626
  1. BIN
      blogtool
  2. 4
      src/blogtool.cr
  3. 5
      testsite/articles/test-second.md

Binary file not shown.

@ -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)

@ -0,0 +1,5 @@
# Second test
brbrbbr
testing things
Loading…
Cancel
Save