site.sleela
website-generator/website/site.sleela · 58 line(s) · sleela
#sleela 2.1
// site.sleela -- top level of the Website Generator. Composes a complete demo
// site from a Design and an ordered list of Signs, then emits a single
// self-contained HTML document. This is the entry point a CLI or the JavaFX
// GUI drives: pick a design, add signs, emit.
//
// SLeeLa decides everything about the output here; a front end only chooses the
// design preset and the sign content.
class Site {
void main() {
Design design = new Design();
Signs signs = new Signs();
Emitter emitter = new Emitter();
// 1. Choose a design. "neon" is the loud, high-energy preset -- exactly
// the kind of exciting site this generator is meant to produce. Swap
// to "aurora", "editorial", or "brutalist" for a different feel with
// the identical sign list below.
Design.DesignModel d = design.preset("neon");
// 2. Compose the page as an ordered list of signs. Each sign is pure
// content; the design supplies the look.
string body = "";
body = body + emitter.renderSign(
signs.nav("Lumen", "Features Pricing Contact"), signs);
body = body + emitter.renderSign(
signs.hero("Launch something unforgettable",
"A website generated from pure design intent and semantic signs \u2014 no templates, no page builders.",
"Start building"), signs);
// Feature grid: the sign's body slot carries the rendered cards. In a
// real run the generator fills these from structured items; here we
// show the shape of the output.
string cards = "";
cards = cards + "<div class=\"card\"><h3>Design-driven</h3><p>Describe the look once; every page obeys it.</p></div>";
cards = cards + "<div class=\"card\"><h3>Sign-based</h3><p>Pages are semantic blocks, not markup soup.</p></div>";
cards = cards + "<div class=\"card\"><h3>Zero dependencies</h3><p>Output is a single self-contained document.</p></div>";
body = body + emitter.renderSign(signs.feature("Why it works", cards, ""), signs);
body = body + emitter.renderSign(
signs.testimonial("We shipped a launch page in an afternoon.", "A. Builder", ""), signs);
body = body + emitter.renderSign(
signs.cta("Ready to generate your site?", "Open the Studio", "#studio"), signs);
body = body + emitter.renderSign(
signs.footer("Lumen", "Made with the SLeeLa Website Generator", ""), signs);
// 3. Emit the full document and print it. A caller can redirect this to
// out/index.html.
string style = emitter.styleFor(d, design);
string html = emitter.document("Lumen \u2014 generated by SLeeLa", style, body);
print(html);
}
}