Speculator: include API docs links for branches

pull/977/head
Richard van der Hoff 7 years ago
parent c9d5498767
commit 2454598926

@ -664,13 +664,23 @@ function redirectToApiDocs(relativePath) {
branchNames = append(branchNames, "HEAD") branchNames = append(branchNames, "HEAD")
for _, branch := range branchNames { for _, branch := range branchNames {
href := "spec/" + url.QueryEscape(branch) + "/" href := "spec/" + url.QueryEscape(branch) + "/"
fmt.Fprintf(&b, `<li><a href="%s">%s</a></li>`, href, branch) fmt.Fprintf(&b, "<li><a href=\"%s\">%s</a></li>\n", href, branch)
if *includesDir != "" { if *includesDir != "" {
fmt.Fprintf(&b, `<li><a href="%s?matrixdotorgstyle=1">%s, styled like matrix.org</a></li>`, fmt.Fprintf(&b, "<li><a href=\"%s?matrixdotorgstyle=1\">%s, styled like matrix.org</a></li>\n",
href, branch) href, branch)
} }
} }
b.Write([]byte("</ul></div></body>")) b.Write([]byte("</ul></div>\n\n"))
b.Write([]byte("<div>View the API docs at:<ul>"))
for _, branch := range branchNames {
fmt.Fprintf(&b,
"<li><a href=\"#\" onclick=\"redirectToApiDocs('spec/%s/api-docs.json')\">%s</a></li>\n",
url.QueryEscape(branch), branch)
}
b.Write([]byte("</ul></div>"))
b.Write([]byte("</body>"))
b.WriteTo(w) b.WriteTo(w)
} }

Loading…
Cancel
Save