html_quasiquotations.pl -- HTML quasi quotations
This module implements quasi quotations for HTML. Together with library(http/html_write), this allows for inclusion of long HTML fragments in the Prolog source code while replacing attributes and content with variable that come from the surrounding Prolog clause.
This module is included and re-exported from library(http/html_write).
- html(+Content, +Vars, +VarDict, -DOM) is det
- The predicate html/4 implements HTML quasi quotations. These
quotations produce a DOM term that is suitable for html//1 and
other predicates that are declared to consume this format. The
quasi quoter only accepts valid, but possibly partial HTML
documents. The document must begin with a tag. The quoter
replaces attributes or content whose value is a Prolog variable
that appears in the argument list of the
html
indicator. If the variable defines content, it must be the only content. Here is an example, replacing both a content element and an attribute. Note that the document is valid HTML.html({|html(Name, URL)|| <p>Dear <span class="name">Name</span>, <p>You can <a href="URL">download</a> the requested article now. |}