nx_rss_lib.nx
buildroot/runtime/nx_rss_lib.nx
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
imports: nx_syscalls.nxnx_html_escape.nxnx_http_date.nx
imported by: nx_compare_feed_lib.nxnx_rss.nx
structs
| none |
consts
| 57 | const RSS_MAGIC_4096: i64 = 4096 |
| 59 | const RSS_ERR_SHORT: i64 = -1 |
functions
| 63 | func rss_put(out: *u8, cap: i64, off: i64, |
| 75 | func rss_put_escaped(out: *u8, cap: i64, off: i64, |
| 84 | func rss_begin(out: *u8, cap: i64, off: i64, |
| 122 | func rss_item(out: *u8, cap: i64, off: i64, |
| 160 | func rss_end(out: *u8, cap: i64, off: i64) -> i64 |