tiny.zen.slides
Defined in tiny.zen.
API (6)
Actions
Public operations.
Types and contracts
Public types and contracts.
Namespaces
Public namespaces.
Source
Source: lib/zen/src/slides/deck.zig:19
zig
pub const Deck = struct { options: Options = .{}, open: bool = false, slide_index: usize = 0, slide_open_start: usize = 0, slide_body_start: usize = 0, pub fn begin(self: *Deck, out: *std.ArrayList(u8), allocator: Allocator) Allocator.Error!void { if (self.open) return; try out.appendSlice(allocator, "<div class=\""); try zen.html.appendAttributeEscaped(out, allocator, self.options.deck_class); try out.appendSlice(allocator, "\" data-zen-slides>\n"); self.open = true; try self.openSlide(out, allocator); } pub fn split(self: *Deck, out: *std.ArrayList(u8), allocator: Allocator) Allocator.Error!void { if (!self.open) try self.begin(out, allocator); if (self.empty(out)) return; try out.appendSlice(allocator, "</div>\n</section>\n"); try self.openSlide(out, allocator); } pub fn finish(self: *Deck, out: *std.ArrayList(u8), allocator: Allocator) Allocator.Error!void { if (!self.open) return; if (self.empty(out) and self.slide_index > 1) { out.shrinkRetainingCapacity(self.slide_open_start); } else { try out.appendSlice(allocator, "</div>\n</section>\n"); } try out.appendSlice(allocator, "</div>\n"); try out.appendSlice(allocator, print.stylesheet); if (self.options.runtime) { try out.appendSlice(allocator, script.runtime); } const options = self.options; self.* = .{ .options = options }; } fn openSlide(self: *Deck, out: *std.ArrayList(u8), allocator: Allocator) Allocator.Error!void { self.slide_index += 1; self.slide_open_start = out.items.len; try out.appendSlice(allocator, "<section class=\""); try zen.html.appendAttributeEscaped(out, allocator, self.options.slide_class); try out.appendSlice(allocator, "\" id=\""); try zen.html.appendAttributeEscaped(out, allocator, self.options.id_prefix); try out.append(allocator, '-'); try appendUsize(out, allocator, self.slide_index); try out.appendSlice(allocator, "\" aria-label=\"Slide "); try appendUsize(out, allocator, self.slide_index); try out.appendSlice(allocator, "\">\n"); try out.appendSlice(allocator, "<div class=\""); try zen.html.appendAttributeEscaped(out, allocator, self.options.frame_class); try out.appendSlice(allocator, "\">\n"); if (self.options.badge) |badge| { try out.appendSlice(allocator, "<span class=\""); try zen.html.appendAttributeEscaped(out, allocator, self.options.badge_class); try out.appendSlice(allocator, "\" aria-label=\"Non-curated content\">"); try zen.html.appendEscaped(out, allocator, badge); try out.appendSlice(allocator, "</span>\n"); } self.slide_body_start = out.items.len; } fn empty(self: Deck, out: *const std.ArrayList(u8)) bool { return out.items.len == self.slide_body_start; }};Source: lib/zen/src/root.zig:38
zig
/// Slide-deck rendering and print support.pub const slides = @import("slides/root.zig");Source: lib/zen/src/slides/root.zig
zig
const deck = @import("deck.zig");pub const print = @import("print.zig");pub const Options = deck.Options;pub const Deck = deck.Deck;Audit
| Definitions | 5 |
|---|---|
| Public names | 5 |
| Members | 5 |
| Version | 26.7.0 |
| Revision | daab053ee433 |