HTML page for the current application.
By default, it renders:
render-bodygeneric-function is called with
By default, it just renders
BODY-HTML-STRING as is, without escaping.
BODY-HTML-STRING argument contains a rendered widget tree, generated
reblocks/widget:render generic-function call on the root widget.
Renders links to
DEPENDENCIES argument contains a list of
objects inherited from
These functions can be used during rendering to retrieve an information about the page.
Render protocol first renders the widget tree and
only after that renders page
Thus you might use
setf on these functions during
widget rendering to change the title, description
If you want to change these variables globally for the whole application, then define a before method like this:
(defmethod reblocks/page:render :before ((app disk-analyzer) inner-html &rest rest) (declare (ignore rest)) (setf (reblocks/page:get-title) "Cloud Analyzer - Saves space and money!") (setf (reblocks/page:get-description) "Helps to save money when storing data in the Cloud.") (setf (reblocks/page:get-keywords) (list "cloud" "storage" "analyzer")))
Out of the box, Reblocks provides a few facilities for
They are based on
Spinneret templating engine. Old version of Weblocks used
CL-WHO instead. But Spinneret is more flexible and what is more important,
it escapes content by default, preventing
HTML injection vulnerability.
Most of the time, you only will need a
reblocks/html:with-html macro, which is
similary to Spinneret's one, but binds a few special variables to a stream
to write output to and how to write it:
(reblocks/html:with-html (:ul (:li "One") (:li "Two") (:li "Three"))) ;.. <ul> ;.. <li>One ;.. <li>Two ;.. <li>Three ;.. </ul> ;=> NIL
Sometimes you might want to get a
HTML string instead. In this case you might use
(reblocks/html:with-html-string (:ul (:li "One") (:li "Two") (:li "Three"))) ;.. ;=> "<ul> ;-> <li>One ;-> <li>Two ;-> <li>Three ;-> </ul>"
You can use any other templating engine, just ensure
it writes output to the
For more advanced
UI, look at the REBLOCKS-UI documentation.
Renders body using Spinneret
with-html, but capture the output as a string.
Reblocks will write all output into this stream.
This stream is created for each request and available to
code executed within a request as a special
variable. All html should be rendered to this stream,
but don't worry, if you are using
with-html-string macroses, they handle this for you.
Language to add into the root html element.
We want an
HTML nice to read by default.