From 614809f34eb96b8e4500d4c99d624b96152c3e87 Mon Sep 17 00:00:00 2001 From: knotteye Date: Sat, 6 Mar 2021 14:46:15 -0600 Subject: [PATCH] Squish bug --- README.md | 2 +- src/blogtool.cr | 4 ++-- testsite/base.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d531349..8dcceec 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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. \ No newline at end of file diff --git a/src/blogtool.cr b/src/blogtool.cr index 78416ff..a92e849 100644 --- a/src/blogtool.cr +++ b/src/blogtool.cr @@ -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))+"" + 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 += "

"+article.gsub("-", " ")+"

\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| diff --git a/testsite/base.html b/testsite/base.html index 46d6c0b..4b3ce3c 100644 --- a/testsite/base.html +++ b/testsite/base.html @@ -3,5 +3,5 @@ - +## CONTENT \ No newline at end of file