From 2ab171a0d47b6f9fd168a27987842c47ce562877 Mon Sep 17 00:00:00 2001 From: James Mills Date: Fri, 29 Oct 2021 02:10:15 +1000 Subject: [PATCH] Code cleanup --- .gitignore | 3 ++- main.go | 5 ++--- main_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index cfd3f59..ec76799 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.bak +**.pub /zs -/.pub /dist +/test.md diff --git a/main.go b/main.go index 49657aa..f5240d6 100644 --- a/main.go +++ b/main.go @@ -33,9 +33,8 @@ func renameExt(path, oldext, newext string) string { } if oldext == "" || strings.HasSuffix(path, oldext) { return strings.TrimSuffix(path, oldext) + newext - } else { - return path } + return path } // globals returns list of global OS environment variables that start @@ -169,7 +168,7 @@ func render(s string, vars Vars) (string, error) { } } } - return s, nil + } // Renders markdown with the given layout into html expanding all the macros diff --git a/main_test.go b/main_test.go index ada7564..6470bc5 100644 --- a/main_test.go +++ b/main_test.go @@ -55,7 +55,7 @@ foo: bar title: Hello, world! --- Some content in markdown -`: Vars{ +`: { "foo": "bar", "title": "Hello, world!", "url": "test.html", @@ -67,7 +67,7 @@ Some content in markdown url: "example.com/foo.html" --- Hello -`: Vars{ +`: { "url": "example.com/foo.html", "__content": "Hello\n", },