From 82bebfab8a6528f24f23dac99ce5b11efab27761 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 23 Dec 2019 12:56:41 -0700 Subject: templates: Change functions, add front matter support, better markdown --- modules/caddyhttp/templates/tplcontext_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/caddyhttp/templates/tplcontext_test.go') diff --git a/modules/caddyhttp/templates/tplcontext_test.go b/modules/caddyhttp/templates/tplcontext_test.go index d9aab0c..37b6382 100644 --- a/modules/caddyhttp/templates/tplcontext_test.go +++ b/modules/caddyhttp/templates/tplcontext_test.go @@ -31,6 +31,7 @@ package templates import ( "bytes" "fmt" + "html/template" "io/ioutil" "net/http" "os" @@ -47,17 +48,20 @@ func TestMarkdown(t *testing.T) { for i, test := range []struct { body string - expect string + expect template.HTML }{ { body: "- str1\n- str2\n", expect: "\n", }, } { - result := string(context.Markdown(test.body)) + result, err := context.funcMarkdown(test.body) if result != test.expect { t.Errorf("Test %d: expected '%s' but got '%s'", i, test.expect, result) } + if err != nil { + t.Errorf("Test %d: got error: %v", i, result) + } } } @@ -180,7 +184,7 @@ func TestStripHTML(t *testing.T) { expect: `