Skip to main content
Version: 0.0.1

rayquiro.web

rayquiro.web is the built-in web generation framework in RayQuiro.

In 0.0.1, it supports two styles:

  • a one-shot web.page(...) helper
  • a builder API with routes, head tags, public assets, and live local serving

Import

import rayquiro.web as web;

Quick Start

import rayquiro.web as web;

web.begin("Demo", "build/site/index.html");
web.style("
.page { max-width: 960px; margin: 0 auto; padding: 48px 24px; }
.title { font-size: 48px; }
");
web.open("main", "page");
web.h1("RayQuiro", "title");
web.p("Builder-style HTML from RayQuiro.");
web.close("main");
web.end();

API Reference

web.page(title, bodyHtml, outputPath, optionalCss)

One-shot HTML generation helper.

Use it for the simplest static page export.

web.page(
"Hello",
"<h1>Hello</h1><p>Generated from RayQuiro.</p>",
"build/index.html"
);

web.begin(title, outputPath)

Starts a builder-style page session.

The parent directory of outputPath becomes the output root for generated route files.

web.route(routePath, optionalTitle, optionalOutputPath)

Switches the current route.

Examples:

web.route("/about", "About");
web.route("/docs", "Docs", "build/custom/docs.html");

Default route mapping:

  • / -> your original outputPath
  • /about -> build/.../about/index.html

web.head(html)

Appends raw HTML into the current route's <head>.

Example:

web.head("<meta name='description' content='RayQuiro demo'>");

web.public(path)

Sets the public asset or shell directory.

By default:

public

Example:

web.public("web_public");

web.live(port)

web.serve(port)

Enables a local live server after generation.

Default port:

5274

Example:

web.live(5274);

web.style(cssText)

Appends CSS to the generated document.

web.open(tag, className)

Opens a normal HTML tag:

web.open("main", "page");
web.open("section", "hero");

web.open("<raw markup>")

You can also pass ready-made markup directly:

web.open("<main class='page'>");
web.open("<section class='hero'>");

When the tag is not self-closing, RayQuiro tracks it so web.close() can close it later.

web.close(optionalFallbackTag)

Closes the last tracked tag.

Examples:

web.close();
web.close("section");

web.text(text, className, tag)

Writes a text element.

Defaults:

  • className: ""
  • tag: "span"

Example:

web.text("RAYQUIRO WEB", "eyebrow", "div");

web.h1(text, className)

web.h2(text, className)

web.p(text, className)

Convenience text blocks for headings and paragraphs.

web.button(label, className, href)

Creates an anchor styled like a button.

web.raw(html)

Appends raw HTML directly into the current route body.

web.end()

Finalizes all routes, writes the HTML output, and starts the live server if web.live(...) was enabled.

Public Shell Templates

If public/index.html exists, RayQuiro uses it as the document shell.

Recognized placeholders:

  • {{ rq_title }}
  • <!-- rq-styles -->
  • <!-- rq-head -->
  • <!-- rq-body -->
  • <!-- rq-live -->

Minimal example:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- rq-head -->
</head>
<body>
<div id="app"><!-- rq-body --></div>
<!-- rq-live -->
</body>
</html>

Route Example

import rayquiro.web as web;

web.begin("Route Demo", "build/route_demo/index.html");
web.public("web_public");
web.head("<meta name='description' content='RayQuiro route demo'>");
web.open("<main class='page'>");
web.open("<section class='hero'>");
web.text("RAYQUIRO WEB", "eyebrow", "div");
web.h1("Home route", "title");
web.p("This page uses public/index.html as a shell.", "lead");
web.close();
web.close();

web.route("/about", "About RayQuiro");
web.head("<meta name='robots' content='index,follow'>");
web.open("<main class='page'>");
web.h1("About route", "title");
web.raw("<div class='panel'><p>Custom raw HTML inside route.</p></div>");
web.close();

web.live(5415);
web.end();

Generated Output

Typical result:

build/
route_demo/
index.html
about/
index.html

Notes

  • web.live(...) keeps the process alive until you stop it.
  • On Windows, the live server binds to http://127.0.0.1:<port>.
  • web.end() is required to write the output.