Build a static site generator using Ifa-Lang's file I/O and string processing.
This example demonstrates using Odi (Fs) for file operations and Ika (String) for template processing.
// Static Site Generator
ayanmo template = Odi.ka("template.html");
ayanmo posts = Odi.akojopo("posts/*.md");
fun post ninu posts {
ayanmo content = Odi.ka(post);
ayanmo html = markdown_to_html(content);
ayanmo output = Ika.ropo(template, "{{content}}", html);
ayanmo filename = Ika.ropo(post, ".md", ".html");
Odi.ko("public/" + filename, output);
Irosu.fo("Built: " + filename);
}
Irosu.fo("Site generated!");
// Simple template engine
ese markdown_to_html(text) {
ayanmo result = text;
// Headers
result = Ika.ropo(result, "# ", "<h1>");
result = Ika.ropo(result, "## ", "<h2>");
// Bold
result = Ika.ropo(result, "**", "<strong>");
pada result;
}