PublicShow -- SWISH term-rendering support

This module manages rendering answers using alternative vizualizations. The idea is that a specific context uses zero or more rendering modules. These rendering modules provide an alternative HTML representation for the target term. If multiple possible renderings are found, a <div class="render-multi"> element is generated that contains the alternative renderings. The jQuery plugin renderMulti, defined in answer.js adds the behaviour to change rendering to the generated div.

The user can import rendering schemes into the current context using the directive below. Spec is either an atom or string, making the system look for render(Spec), or it is a (single) file specification that can be used for use_module/1.

:- use_rendering(Spec).

A rendering module is a Prolog module that defines the non-terminal term_rendering//3, which will be called as below. Term is the (non-var) term that must be rendered, Vars is a list of variable names bound to this term and Options is a list of write options that would normally be passed to write_term/3. The grammar is executed by library(http/html_write) and must generate compatible tokens (which means it must call html//1 to generate HTML tokens).

phrase(Renderer:term_rendering(Term, Vars, Options), Tokens)
Source use_rendering(+FileOrID)
Register an answer renderer. Same as use_rendering(FileOrID, []).
See also
- use_rendering/2.
Source use_rendering(:ID, +Options)
Register an answer renderer with options. Options are merged with write-options and passed to the non-terminal term_rendering//3 defined in the rendering module.
Source current_renderer(Name, Comment) is nondet
True when renderer Name is declared with Comment.
Source register_renderer(:Name, +Comment)
Register a module as SWISH rendering component.