No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nnra6864 884b898cfa chore: Dependencies come from the ktisigonos organization
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 01:23:03 +01:00
.gitignore chore: Ignore build output 2026-11-11 00:14:38 +01:00
build.zig feat: The xml adapter writes whole XML files from a value tree 2026-11-11 00:14:38 +01:00
build.zig.zon chore: Dependencies come from the ktisigonos organization 2026-11-11 01:23:03 +01:00
README.md feat: The xml adapter writes whole XML files from a value tree 2026-11-11 00:14:38 +01:00
root.zig feat: The xml adapter writes whole XML files from a value tree 2026-11-11 00:14:38 +01:00

kosm_xml

XML for kosm: the xml adapter writes whole XML files through output.generate. It claims .xml; files with another extension (fontconfig's .conf) pass .lang = "xml". It knows no app, and cannot edit existing files yet.

How values become XML

Value XML
the root table <?xml version="1.0"?>, then its one root element
a root key starting with ! a declaration before the root element: "!DOCTYPE" = kosm.raw("fontconfig SYSTEM \"urn:fontconfig:fonts.dtd\"")
a table an element holding its entries as child elements, or <name/> when it has none
a key starting with @ an attribute of the enclosing element: .@"@binding" = "strong"
a list its element repeated once per item, in order
a string, number, boolean or color the element's text, escaped
kosm.raw text written verbatim
try output.generate(.{ .file = "~/.config/fontconfig/conf.d/50-kosm.conf", .lang = "xml" }, .{
    .fontconfig = .{ .alias = .{ .family = "monospace", .prefer = .{ .family = .{ "Iosevka", "Noto Color Emoji" } } } },
});

writes

<?xml version="1.0"?>
<fontconfig>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Iosevka</family>
      <family>Noto Color Emoji</family>
    </prefer>
  </alias>
</fontconfig>

An element cannot hold both text and child elements.