mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
autodoc: minor pr cleanup
This commit is contained in:
parent
51a4861a08
commit
53e971226d
@ -51,7 +51,7 @@ var zigAnalysis;
|
||||
const domHdrName = document.getElementById("hdrName");
|
||||
const domHelpModal = document.getElementById("helpModal");
|
||||
const domSearchPlaceholder = document.getElementById("searchPlaceholder");
|
||||
const sourceFileUrlTemplate = "src-viewer/{{file}}#L{{line}}"
|
||||
const sourceFileUrlTemplate = "src/{{file}}#L{{line}}"
|
||||
const domLangRefLink = document.getElementById("langRefLink");
|
||||
|
||||
let lineCounter = 1;
|
||||
@ -989,7 +989,7 @@ var zigAnalysis;
|
||||
"switch(" +
|
||||
cond +
|
||||
") {" +
|
||||
'<a href="/src-viewer/' +
|
||||
'<a href="/src/' +
|
||||
file_name +
|
||||
"#L" +
|
||||
line +
|
||||
|
||||
@ -9,7 +9,7 @@ const Package = @import("Package.zig");
|
||||
const Zir = @import("Zir.zig");
|
||||
const Ref = Zir.Inst.Ref;
|
||||
const log = std.log.scoped(.autodoc);
|
||||
const Docgen = @import("Docgen.zig");
|
||||
const Docgen = @import("autodoc/render_source.zig");
|
||||
|
||||
module: *Module,
|
||||
doc_location: Compilation.EmitLoc,
|
||||
@ -243,6 +243,7 @@ pub fn generateZirData(self: *Autodoc) !void {
|
||||
try d.handle.openDir(self.doc_location.basename, .{})
|
||||
else
|
||||
try self.module.zig_cache_artifact_directory.handle.openDir(self.doc_location.basename, .{});
|
||||
|
||||
{
|
||||
const data_js_f = try output_dir.createFile("data.js", .{});
|
||||
defer data_js_f.close();
|
||||
@ -267,25 +268,27 @@ pub fn generateZirData(self: *Autodoc) !void {
|
||||
try buffer.flush();
|
||||
}
|
||||
|
||||
output_dir.makeDir("src-viewer") catch |e| switch (e) {
|
||||
error.PathAlreadyExists => {},
|
||||
else => |err| return err,
|
||||
};
|
||||
const html_dir = try output_dir.openDir("src-viewer", .{});
|
||||
{
|
||||
output_dir.makeDir("src") catch |e| switch (e) {
|
||||
error.PathAlreadyExists => {},
|
||||
else => |err| return err,
|
||||
};
|
||||
const html_dir = try output_dir.openDir("src", .{});
|
||||
|
||||
var files_iterator = self.files.iterator();
|
||||
var files_iterator = self.files.iterator();
|
||||
|
||||
while (files_iterator.next()) |entry| {
|
||||
const new_html_path = entry.key_ptr.*.sub_file_path;
|
||||
while (files_iterator.next()) |entry| {
|
||||
const new_html_path = entry.key_ptr.*.sub_file_path;
|
||||
|
||||
const html_file = try createFromPath(html_dir, new_html_path);
|
||||
defer html_file.close();
|
||||
var buffer = std.io.bufferedWriter(html_file.writer());
|
||||
const html_file = try createFromPath(html_dir, new_html_path);
|
||||
defer html_file.close();
|
||||
var buffer = std.io.bufferedWriter(html_file.writer());
|
||||
|
||||
const out = buffer.writer();
|
||||
const out = buffer.writer();
|
||||
|
||||
try Docgen.genHtml(self.module.gpa, entry.key_ptr.*, out);
|
||||
try buffer.flush();
|
||||
try Docgen.genHtml(self.module.gpa, entry.key_ptr.*, out);
|
||||
try buffer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
// copy main.js, index.html
|
||||
|
||||
@ -9,7 +9,7 @@ const print = std.debug.print;
|
||||
const mem = std.mem;
|
||||
const testing = std.testing;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const Module = @import("Module.zig");
|
||||
const Module = @import("../Module.zig");
|
||||
|
||||
pub fn genHtml(
|
||||
allocator: Allocator,
|
||||
@ -33,7 +33,6 @@ pub fn genHtml(
|
||||
\\ line-height: 1.5;
|
||||
\\ }
|
||||
\\
|
||||
\\ @media screen and (min-width: 1025px) {
|
||||
\\ pre > code {
|
||||
\\ display: block;
|
||||
\\ overflow: auto;
|
||||
Loading…
x
Reference in New Issue
Block a user