code wiki / (root) / nx_rss_lib.nx

nx_rss_lib.nx

buildroot/runtime/nx_rss_lib.nx

6146 B164 linesdepth 4pulls 5 transitivereach 5 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_rss_lib.nx -- THE RSS 2.0 BUILDER AS A LIBRARY (extracted 2026-09-16 from nx_rss.nx, whose compile-only smoke main() made it un-importable -- the first consumer that needed to COMPOSE it, the /compare daily feed, could not). Every builder function below is byte-identical to the one it was moved from; nx_rss.nx now imports this file and keeps only its smoke main. rss.nx -- RSS 2.0 feed builder. Emits valid RSS 2.0 XML (specification: Harvard Berkman Center, 2009). Every feed reader, podcast app, news aggregator, and many static site generators consume RSS. nishi-pages without RSS is half a blog engine. Feed skeleton: <?xml version=\"1.0\" encoding=\"utf-8\"?> <rss version=\"2.0\"> <channel> <title>...</title> <link>...</link> <description>...</description> <language>en</language> <pubDate>Wed, 22 Apr 2026 12:34:56 GMT</pubDate> <item> <title>...</title> <link>...</link> <description>...</description> <pubDate>...</pubDate> <guid>...</guid> </item> ... </channel> </rss> All dates use IMF-fixdate (http_date.nx). Text content is HTML-escaped (html_escape.nx) so the feed can contain '<', '>', '&' safely. This is a stream-builder: caller walks their posts and calls rss_item for each; we don't own the post list. All output appends to a caller-owned buffer with bounds checking. Invariants: R1 Order matters: rss_begin -> rss_item* -> rss_end.

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_html_escape.nx nx_http_date.nx nx_rss_lib.nx nx_compare_feed_lib.nx nx_rss.nx

imports: nx_syscalls.nxnx_html_escape.nxnx_http_date.nx

imported by: nx_compare_feed_lib.nxnx_rss.nx

structs

none

consts

57const RSS_MAGIC_4096: i64 = 4096
59const RSS_ERR_SHORT: i64 = -1

functions

63func rss_put(out: *u8, cap: i64, off: i64,
75func rss_put_escaped(out: *u8, cap: i64, off: i64,
called by 2: rss_beginrss_item calls 1: html_escape
84func rss_begin(out: *u8, cap: i64, off: i64,
122func rss_item(out: *u8, cap: i64, off: i64,
160func rss_end(out: *u8, cap: i64, off: i64) -> i64
called by 1: cf_build calls 1: rss_put