Fix type of id to match the new editor structure

single-block-api
Peter Stuifzand 4 years ago
parent 9e24fd03bd
commit 2c50de9a29

@ -28,7 +28,7 @@ func processBackrefs(fp *FilePages) error {
content := page.Content
var listItems []struct {
Id int
ID string
Indented int
Text string
}

@ -462,7 +462,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
jsonPage := pageText != "" && err == nil
if jsonPage {
var listItems []struct {
Id int
ID string
Indented int
Text string
}
@ -636,7 +636,7 @@ func main() {
content := page.Content
var listItems []struct {
Id int
ID string
Indented int
Text string
}

@ -27,3 +27,22 @@ func TestParseLinks(t *testing.T) {
assert.Equal(t, links[2].PageName, "Project_notes")
}
}
func TestTagLinks(t *testing.T) {
example := `
* #[[TODO]] Test1
* #[[TODO]] Test2
* #[[TODO]] Test3
* #[[TODO]] Test4
`
links, err := ParseLinks(example)
if assert.NoError(t, err, "should parse example") {
assert.Len(t, links, 4, "should contain 3 links")
assert.Equal(t, links[0].Line, "* #[[TODO]] Test1")
assert.Equal(t, links[0].Name, "TODO")
assert.Equal(t, links[0].PageName, "TODO")
}
}

Loading…
Cancel
Save