class Page
The HTML page shell for a Presently view.
Renders the initial HTML page with the import map, stylesheets, and the embedded Live view component. Uses a custom XRB template that includes Presently's assets (syntax highlighting, etc.).
Definitions
TEMPLATE = XRB::Template.load_file(File.expand_path("page.xrb", __dir__))
The compiled XRB template for the page shell.
def initialize(title: "Presently", body: nil)
Initialize a new page.
Signature
-
parameter
titleString The page title.
-
parameter
bodyLive::View | Nil The Live view to embed in the page.
Implementation
def initialize(title: "Presently", body: nil)
@title = title
@body = body
end
attr :title
Signature
-
attribute
String The page title.
attr :body
Signature
-
attribute
Live::View | Nil The Live view to embed.
def call
Render the page to an HTML string.
Signature
-
returns
String The rendered HTML.
Implementation
def call
TEMPLATE.to_string(self)
end