This commit is contained in:
parent
1003c19662
commit
beaa6202a6
|
@ -75,7 +75,7 @@ func processBackrefsForPage(page Page, refs Refs) error {
|
|||
link:
|
||||
for _, link := range links {
|
||||
for i, ref := range refs[link.PageName] {
|
||||
if ref.Link.Id == link.Id {
|
||||
if ref.Link.ID == link.ID {
|
||||
refs[link.PageName][i].Link = link
|
||||
continue link
|
||||
}
|
||||
|
|
2
util.go
2
util.go
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
type ParsedLink struct {
|
||||
Id string
|
||||
ID string `json:"Id"`
|
||||
Name string
|
||||
PageName string
|
||||
Line string
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
func TestParseLinks(t *testing.T) {
|
||||
example := "There are three types of notes and these should be kept seperate, because they have different goals. [[Fleeting notes]], [[Permanent notes]], [[Project notes]]."
|
||||
|
||||
links, err := ParseLinks(example)
|
||||
links, err := ParseLinks("id", example)
|
||||
|
||||
if assert.NoError(t, err, "should parse example") {
|
||||
assert.Len(t, links, 3, "should contain 3 links")
|
||||
|
@ -17,14 +17,17 @@ func TestParseLinks(t *testing.T) {
|
|||
assert.Equal(t, links[0].Line, "There are three types of notes and these should be kept seperate, because they have different goals. [[Fleeting notes]], [[Permanent notes]], [[Project notes]].")
|
||||
assert.Equal(t, links[0].Name, "Fleeting notes")
|
||||
assert.Equal(t, links[0].PageName, "Fleeting_notes")
|
||||
assert.Equal(t, links[0].ID, "id")
|
||||
|
||||
assert.Equal(t, links[1].Line, "There are three types of notes and these should be kept seperate, because they have different goals. [[Fleeting notes]], [[Permanent notes]], [[Project notes]].")
|
||||
assert.Equal(t, links[1].Name, "Permanent notes")
|
||||
assert.Equal(t, links[1].PageName, "Permanent_notes")
|
||||
assert.Equal(t, links[1].ID, "id")
|
||||
|
||||
assert.Equal(t, links[2].Line, "There are three types of notes and these should be kept seperate, because they have different goals. [[Fleeting notes]], [[Permanent notes]], [[Project notes]].")
|
||||
assert.Equal(t, links[2].Name, "Project notes")
|
||||
assert.Equal(t, links[2].PageName, "Project_notes")
|
||||
assert.Equal(t, links[2].ID, "id")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +39,7 @@ func TestTagLinks(t *testing.T) {
|
|||
* #[[TODO]] Test4
|
||||
`
|
||||
|
||||
links, err := ParseLinks(example)
|
||||
links, err := ParseLinks("id", example)
|
||||
|
||||
if assert.NoError(t, err, "should parse example") {
|
||||
assert.Len(t, links, 4, "should contain 3 links")
|
||||
|
@ -44,5 +47,6 @@ func TestTagLinks(t *testing.T) {
|
|||
assert.Equal(t, links[0].Line, "* #[[TODO]] Test1")
|
||||
assert.Equal(t, links[0].Name, "TODO")
|
||||
assert.Equal(t, links[0].PageName, "TODO")
|
||||
assert.Equal(t, links[0].ID, "TODO")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user