Skip to main content

Module export

Module export 

Source
Expand description

Multi-format export backends (E012 US2 — Phase 7).

Public types: export::ExportFormat, export::write_export. Each individual backend is gated behind its output-<format> leaf: HTML5 (output-html), mIRC ^C codes (output-irc), SVG 1.1 (output-svg). The ANSI sub-formats reuse ColorDepth from color_depth for SGR emission. Multi-format export backends (E012 US2 — FR-005, Phase 7).

§Backends

Each backend is gated behind a distinct output-<format> Cargo leaf per ADR-0006:

FormatLeafModule
HTML5output-html[html]
mIRC ^Coutput-irc[irc]
SVG 1.1output-svg[svg]
ANSI 16(always)(renders via crate::color_depth)
ANSI 256color-256(renders via crate::color_depth)
ANSI 24bitcolor-truecolor(renders via crate::color_depth)

§Dispatch

[write_export] receives a crate::filter::RenderGrid and an [ExportFormat] and dispatches to the appropriate backend, returning a Vec<u8> with the encoded bytes. When the requested format’s leaf is disabled at compile time, FigletError::UnsupportedExportFormat is returned with the full list of available formats so the CLI can produce a useful diagnostic per FR-016.

§Security

  • HTML/SVG: 4-char escape applied to every text-content and double- quoted-attribute byte per AD-004 + HINT-004 — see [html] module docs for the exact set + reasoning.
  • IRC: ASCII C0/C1 non-printable bytes stripped per FR-015; UTF-8 continuation bytes preserved per spec Edge Cases — see [irc] module docs.
  • SVG: NO <script>, <foreignObject>, xlink:href, <image href=...>, <use xlink:href=...> emission. Inline style="..." IS emitted but contains only typed numeric #RRGGBB values — no user bytes ever flow into a style value per spec Edge Cases.

Modules§

htmloutput-html
HTML5 export backend (E012 US2 — FR-005, FR-014, AD-004, HINT-004).
ircoutput-irc
mIRC ^C color-code export backend (E012 US2 — FR-006, FR-015, FR-027).
svgoutput-svg
SVG 1.1 export backend (E012 US2 — FR-007, FR-027).

Enums§

ExportFormat
Supported export formats (E012 US2 — FR-005).

Functions§

write_export
Dispatch a RenderGrid to the requested ExportFormat backend.