Sending Webmentions #10
|
@ -6,6 +6,7 @@
|
|||
<time class="dt-published" datetime="{{.Post.Meta.Date}}">
|
||||
{{.Post.Meta.Date}}
|
||||
</time>
|
||||
<a class="u-url" href="{{.Post.FullUrl}}">#</a>
|
||||
</small>
|
||||
</hgroup>
|
||||
<hr>
|
||||
|
|
7
post.go
7
post.go
|
@ -358,11 +358,8 @@ func (post *Post) OutgoingWebmentions() []WebmentionOut {
|
|||
func (post *Post) ScanForLinks() error {
|
||||
// this could be done in markdown parsing, but I don't want to
|
||||
// rely on goldmark for this (yet)
|
||||
postHtml, err := renderPostContent(post)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
links, _ := post.user.repo.Parser.ParseLinks([]byte(postHtml))
|
||||
postHtml := post.RenderedContent()
|
||||
links, _ := post.user.repo.Parser.ParseLinks(postHtml.Bytes())
|
||||
for _, link := range links {
|
||||
post.AddOutgoingWebmention(link)
|
||||
}
|
||||
|
|
|
@ -199,3 +199,17 @@ func TestRenderPostNotMentioningWebmentionsIfNoAvail(t *testing.T) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func TestRenderIncludesFullUrl(t *testing.T) {
|
||||
user := getTestUser()
|
||||
post, _ := user.CreateNewPost("testpost")
|
||||
result, _ := owl.RenderPost(&post)
|
||||
|
||||
if !strings.Contains(result, "class=\"u-url\"") {
|
||||
t.Error("u-url not rendered. Got: " + result)
|
||||
}
|
||||
if !strings.Contains(result, post.FullUrl()) {
|
||||
t.Error("Full url not rendered. Got: " + result)
|
||||
t.Error("Expected: " + post.FullUrl())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue