From a8998068ad97be549156e50862d78e9987cd417e Mon Sep 17 00:00:00 2001 From: Niko Abeler Date: Thu, 8 Sep 2022 21:28:05 +0200 Subject: [PATCH] #13 GitHub Handle --- cmd/owl/webmention.go | 1 + embed/initial/base.html | 7 ++++++- renderer_test.go | 19 +++++++++++++++++++ user.go | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cmd/owl/webmention.go b/cmd/owl/webmention.go index 146e41f..ff558bc 100644 --- a/cmd/owl/webmention.go +++ b/cmd/owl/webmention.go @@ -76,6 +76,7 @@ var webmentionCmd = &cobra.Command{ return } processPost(user, &post) + return } posts, err := user.Posts() diff --git a/embed/initial/base.html b/embed/initial/base.html index c4062b6..7e2ecb8 100644 --- a/embed/initial/base.html +++ b/embed/initial/base.html @@ -44,7 +44,12 @@ diff --git a/renderer_test.go b/renderer_test.go index 369032f..6607c0a 100644 --- a/renderer_test.go +++ b/renderer_test.go @@ -44,6 +44,25 @@ func TestRenderTwitterHandle(t *testing.T) { } +func TestRenderGitHubHandle(t *testing.T) { + user := getTestUser() + config, _ := user.Config() + config.GitHubHandle = "testhandle" + user.SetConfig(config) + post, _ := user.CreateNewPost("testpost") + result, err := owl.RenderPost(&post) + + if err != nil { + t.Error("Error rendering post: " + err.Error()) + return + } + + if !strings.Contains(result, "href=\"https://github.com/testhandle\" rel=\"me\"") { + t.Error("GitHub handle not rendered. Got: " + result) + } + +} + func TestRenderPostHEntry(t *testing.T) { user := getTestUser() post, _ := user.CreateNewPost("testpost") diff --git a/user.go b/user.go index e7a1de7..c158290 100644 --- a/user.go +++ b/user.go @@ -22,6 +22,7 @@ type UserConfig struct { SubTitle string `yaml:"subtitle"` HeaderColor string `yaml:"header_color"` TwitterHandle string `yaml:"twitter_handle"` + GitHubHandle string `yaml:"github_handle"` } func (user User) Dir() string {