Skip to content

Commit f670c6b

Browse files
author
Antigravity Agent
committed
style(zenodo): Apply zig fmt formatting improvements
- Print → print (API consistency) - Float formatting with :.1 specifiers - Fix iteration range syntax for Zig 0.15 (#435)
1 parent 3711d2f commit f670c6b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/tri/zenodo_templates.zig

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5347,22 +5347,22 @@ pub const CitationGraph = struct {
53475347

53485348
switch (cit.citation_type) {
53495349
.cites, .builds_on => {
5350-
try buffer.writer(allocator).print(" \\node[fill=green!10, below left={d}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + left_idx * 0.8, node_name, short_title });
5350+
try buffer.writer(allocator).print(" \\node[fill=green!10, below left={d:.1}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + @as(f64, @floatFromInt(left_idx)) * 0.8, node_name, short_title });
53515351
try buffer.writer(allocator).print(" \\draw[->, thick] ({s}) -- (main);\n", .{node_name});
53525352
left_idx += 1;
53535353
},
53545354
.cited_by => {
5355-
try buffer.writer(allocator).print(" \\node[fill=yellow!10, below right={d}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + right_idx * 0.8, node_name, short_title });
5355+
try buffer.writer(allocator).print(" \\node[fill=yellow!10, below right={d:.1}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + @as(f64, @floatFromInt(right_idx)) * 0.8, node_name, short_title });
53565356
try buffer.writer(allocator).print(" \\draw[->, thick] (main) -- ({s});\n", .{node_name});
53575357
right_idx += 1;
53585358
},
53595359
.extends => {
5360-
try buffer.writer(allocator).print(" \\node[fill=orange!10, above left={d}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + extend_idx * 0.8, node_name, short_title });
5360+
try buffer.writer(allocator).print(" \\node[fill=orange!10, above left={d:.1}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + @as(f64, @floatFromInt(extend_idx)) * 0.8, node_name, short_title });
53615361
try buffer.writer(allocator).print(" \\draw[->, dashed, thick] ({s}) -- (main);\n", .{node_name});
53625362
extend_idx += 1;
53635363
},
53645364
.similar => {
5365-
try buffer.writer(allocator).print(" \\node[fill=purple!10, above right={d}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + similar_idx * 0.8, node_name, short_title });
5365+
try buffer.writer(allocator).print(" \\node[fill=purple!10, above right={d:.1}cm and 1cm of main] ({s}) {{{s}}};\n", .{ 1 + @as(f64, @floatFromInt(similar_idx)) * 0.8, node_name, short_title });
53665366
try buffer.writer(allocator).print(" \\draw[<->, dotted, thick] (main) -- ({s});\n", .{node_name});
53675367
similar_idx += 1;
53685368
},
@@ -5385,7 +5385,7 @@ pub const CitationGraph = struct {
53855385
// Add text bibliography
53865386
try buffer.appendSlice(allocator, "\\subsection*{Bibliography}\n\n");
53875387
for (self.citations) |cit| {
5388-
try buffer.writer(allocator).Print("\\textbf{{{s}}}. ", .{cit.id});
5388+
try buffer.writer(allocator).print("\\textbf{{{s}}}. ", .{cit.id});
53895389
try buffer.writer(allocator).print("{s}. ", .{cit.authors});
53905390
try buffer.writer(allocator).print("{d}. ", .{cit.year});
53915391
if (cit.venue) |v| try buffer.writer(allocator).print("{s}. ", .{v});
@@ -5684,13 +5684,13 @@ pub const ExperimentConfig = struct {
56845684

56855685
// Data rows (first 10 conditions)
56865686
const max_rows = @min(self.conditions.len, 10);
5687-
for (self.conditions[0..max_rows]) |cond| {
5687+
for (self.conditions[0..max_rows], 0..) |cond, cond_idx| {
56885688
for (cond.parameters, 0..) |kv, j| {
56895689
if (j > 0) try buffer.appendSlice(allocator, " & ");
56905690
try buffer.appendSlice(allocator, kv);
56915691
}
56925692
if (self.best_condition) |best| {
5693-
if (@intFromPtr(cond) == @intFromPtr(&self.conditions[best])) {
5693+
if (cond_idx == best) {
56945694
try buffer.appendSlice(allocator, " & \\textbf{");
56955695
if (cond.results) |r| try buffer.appendSlice(allocator, r);
56965696
try buffer.appendSlice(allocator, "} \\\\\n");
@@ -5758,13 +5758,13 @@ pub const ExperimentConfig = struct {
57585758

57595759
// Data rows
57605760
const max_rows = @min(self.conditions.len, 20);
5761-
for (self.conditions[0..max_rows]) |cond| {
5761+
for (self.conditions[0..max_rows], 0..) |cond, cond_idx| {
57625762
try buffer.appendSlice(allocator, "| ");
57635763
for (cond.parameters) |kv| {
57645764
try buffer.writer(allocator).print("{s} | ", .{kv});
57655765
}
57665766
if (self.best_condition) |best| {
5767-
if (@intFromPtr(cond) == @intFromPtr(&self.conditions[best])) {
5767+
if (cond_idx == best) {
57685768
try buffer.writer(allocator).print("**{s}** |\n", .{cond.results orelse "N/A"});
57695769
} else {
57705770
try buffer.writer(allocator).print("{s} |\n", .{cond.results orelse "N/A"});

0 commit comments

Comments
 (0)