From 3904ba8d6a380f5ddbcd1da3733bc87acdd2da22 Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 15 Aug 2022 18:09:05 +0200 Subject: [PATCH] Linkear a backlinks, hacer lindos y renombrar a conexiones --- compilar.zig | 32 ++++++++++++++++++++++---------- drip.css | 13 +++++++++++++ 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/compilar.zig b/compilar.zig index 51ac6e7..4482aad 100644 --- a/compilar.zig +++ b/compilar.zig @@ -16,6 +16,8 @@ const HeaderOptions = struct { ir_al_inicio: bool = true, // Si esto es true, se muestra un
. header: bool = true, + // Si esto es true, se muestra un link a #conexiones en el header. + has_connections: bool = false, }; fn header( writer: std.fs.File.Writer, @@ -49,9 +51,18 @@ fn header( \\
\\

{s}

\\Historial - \\
\\ , .{ title, src_name }); + if (options.has_connections) { + try writer.print( + \\/ + \\Conexiones + , .{}); + } + try writer.print( + \\
+ \\ + , .{}); } } @@ -237,11 +248,18 @@ fn generateMarkdown( else try stripExtension(src_name); + var connection_count: u16 = 0; + for (connections.items) |connection| { + if (std.mem.eql(u8, try stripExtension(src_name), connection.linked)) + connection_count += 1; + } + var output = try build_dir.createFile(output_file_name, .{}); defer output.close(); try header(output.writer(), title, src_name, .{ .ir_al_inicio = !is_index, .header = !is_index, + .has_connections = connection_count > 0, }); var buffered_writer = std.io.bufferedWriter(output.writer()); try hackilyTransformHtml( @@ -249,16 +267,10 @@ fn generateMarkdown( buffered_writer.writer(), ); - var connection_count: u16 = 0; - for (connections.items) |connection| { - if (std.mem.eql(u8, try stripExtension(src_name), connection.linked)) - connection_count += 1; - } - if (connection_count > 0) { try buffered_writer.writer().print( - \\ + \\ , .{}); } try buffered_writer.flush(); diff --git a/drip.css b/drip.css index 8fc7cb0..b747b91 100644 --- a/drip.css +++ b/drip.css @@ -72,3 +72,16 @@ li { color: #ff9; } } + +#conexiones ul { + list-style: none; + padding: 0; + margin: 0; +} +#conexiones li { + padding: 0; + margin: 0; +} +#conexiones li::before { + content: "↜ "; +}