master
knotteye 3 years ago
parent 88f93a1395
commit 614809f34e
  1. 2
      README.md
  2. 4
      src/blogtool.cr
  3. 2
      testsite/base.html

@ -27,4 +27,4 @@ dist
|-> about.html
```
You can build blogtool by running `make && sudo make install`. Invoke blogtool by running `blogtool` in the project directory. There are no options. You can copy /etc/blogtool/base.html to the project root and make changes to overwrite the template, as long as the string "## CONTENT\n" is in the template somewhere, as that will be replaced with the article or about page.
You can build blogtool by running `make && sudo make install`. Invoke blogtool by running `blogtool` in the project directory. There are no options. You can copy /etc/blogtool/base.html to the project root and make changes to overwrite the template, as long as the string "## CONTENT" is in the template somewhere, as that will be replaced with the article or about page.

@ -37,7 +37,7 @@ BaseCSS = begin
end
def render_file(filename : String | Path)
Base+Markd.to_html(File.read(filename), Markd::Options.new(smart: true, safe: false))+"</body></html>"
Base.sub("## CONTENT", Markd.to_html(File.read(filename), Markd::Options.new(smart: true, safe: false)))
end
index = Base
@ -51,7 +51,7 @@ Dir.entries("articles").select{ |i| i != "." && i != ".." }.each do |article|
content += "<h3><a href=\"/"+article+".html\">"+article.gsub("-", " ")+"</a></h3>\n"
end
end
index.gsub("## CONTENT\n") { content }
index = index.gsub("## CONTENT") { content }
File.write Path["dist/index.html"], index
Dir.entries("assets").select{ |i| i != "." && i != ".." }.each do |asset|

@ -3,5 +3,5 @@
<head>
</head>
<body>
</body>
## CONTENT</body>
</html>
Loading…
Cancel
Save