Content Rendering

Page Rendering

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 HTML headers. Thus you might use setf on these functions during widget rendering to change the title, description or keywords.

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"

HTML Rendering

Out of the box, Reblocks provides a few facilities for HTML generation. 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:

    (: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:

    (: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 reblocks/html:*stream* variable.

For more advanced UI, look at the REBLOCKS-UI documentation.