Write index.html
parent
1faa875989
commit
c8aa41d626
|
@ -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…
Reference in New Issue