All predicatesShow sourcehtml_write.pl -- Write HTML text

The purpose of this library is to simplify writing HTML pages. Of course, it is possible to use format/3 to write to the HTML stream directly, but this is generally not very satisfactory:

This module tries to remedy these problems. The idea is to translate a Prolog term into an HTML document. We use DCG for most of the generation.

International documents

The library supports the generation of international documents, but this is currently limited to using UTF-8 encoded HTML or XHTML documents. It is strongly recommended to use the following mime-type.

Content-type: text/html; charset=UTF-8

When generating XHTML documents, the output stream must be in UTF-8 encoding.

Source html_set_options(+Options) is det
Set options for the HTML output. Options are stored in prolog flags to ensure proper multi-threaded behaviour where setting an option is local to the thread and new threads start with the options from the parent thread. Defined options are:
dialect(Dialect)
One of html4, xhtml or html5 (default). For compatibility reasons, html is accepted as an alias for html4.
doctype(+DocType)
Set the <|DOCTYPE DocType > line for page//1 and page//2.
content_type(+ContentType)
Set the Content-type for reply_html_page/3

Note that the doctype and content_type flags are covered by distinct prolog flags: html4_doctype, xhtml_doctype and html5_doctype and similar for the content type. The Dialect must be switched before doctype and content type.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source html(Arg1, Arg2, Arg3, Arg4)
Source print_html(Arg1)
Source html_print_length(Arg1, Arg2)
Source print_html(Arg1, Arg2)
Source html_meta(Arg1)
Source html_quoted(Arg1, Arg2, Arg3)
Source html_quoted_attribute(Arg1, Arg2, Arg3)
Source html_begin(Arg1, Arg2, Arg3)
Source html_end(Arg1, Arg2, Arg3)
Source html_post(Arg1, Arg2, Arg3, Arg4)
Source html_current_option(Arg1)
Source html_receive(Arg1, Arg2, Arg3)
Source html_receive(Arg1, Arg2, Arg3, Arg4)
Source xhtml_ns(Arg1, Arg2, Arg3, Arg4)
Source html(Arg1, Arg2, Arg3)
Source page(Arg1, Arg2, Arg3)
Source html_root_attribute(Arg1, Arg2, Arg3, Arg4)
Source page(Arg1, Arg2, Arg3, Arg4)
Source reply_html_page(Arg1, Arg2)
Source reply_html_page(Arg1, Arg2, Arg3)
Source page(Arg1, Arg2, Arg3, Arg4, Arg5)