mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
Merge pull request #13300 from jcalabro/master
Better Autodoc Src File Links
This commit is contained in:
commit
1696434063
@ -1859,8 +1859,10 @@ var zigAnalysis;
|
||||
"</a>";
|
||||
} else {
|
||||
payloadHtml += escapeHtml(opts.fnDecl.name);
|
||||
payloadHtml = "<a target=\"_blank\" href=\"" +
|
||||
sourceFileLink(opts.fnDecl) + "\">" +
|
||||
escapeHtml(opts.fnDecl.name) + "</a>";
|
||||
}
|
||||
payloadHtml += renderSourceFileLink(opts.fnDecl);
|
||||
payloadHtml += "</span>";
|
||||
}
|
||||
} else {
|
||||
@ -2328,12 +2330,12 @@ var zigAnalysis;
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderSourceFileLink(decl) {
|
||||
let srcNode = getAstNode(decl.src);
|
||||
|
||||
return "<a style=\"float: right;\" href=\"" +
|
||||
sourceFileUrlTemplate.replace("{{file}}",
|
||||
zigAnalysis.files[srcNode.file]).replace("{{line}}", srcNode.line + 1) + "\">[src]</a>";
|
||||
function sourceFileLink(decl) {
|
||||
const srcNode = getAstNode(decl.src);
|
||||
return sourceFileUrlTemplate.
|
||||
replace("{{file}}", zigAnalysis.files[srcNode.file]).
|
||||
replace("{{line}}", srcNode.line + 1);
|
||||
}
|
||||
|
||||
function renderContainer(container) {
|
||||
@ -2460,7 +2462,8 @@ var zigAnalysis;
|
||||
fnDecl: decl,
|
||||
linkFnNameDecl: navLinkDecl(decl.name),
|
||||
});
|
||||
tdFnSrc.innerHTML = renderSourceFileLink(decl);
|
||||
tdFnSrc.innerHTML = "<a style=\"float: right;\" target=\"_blank\" href=\"" +
|
||||
sourceFileLink(decl) + "\">[src]</a>";
|
||||
|
||||
let docs = getAstNode(decl.src).docs;
|
||||
if (docs != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user