page.pl -- Provide the SWISH application as Prolog HTML component
This library provides the SWISH page and its elements as Prolog HTML
grammer rules. This allows for server-side generated pages to include
swish or parts of swish easily into a page.
- swish_reply(+Options, +Request)
- HTTP handler to reply the default SWISH page. Processes the
following parameters:
- code(Code)
- Use Code as initial code. Code is either an HTTP url or
- url(URL)
- Download code from URL. As
code(URL)
, but makes the browser
download the source rather than the server.
- background(Code)
- Similar to Code, but not displayed in the editor.
- examples(Code)
- Provide examples. Each example starts with ?- at the beginning
of a line.
- q(Query)
- Use Query as the initial query.
- show_beware(Boolean)
- Control showing the beware limited edition warning.
- preserve_state(Boolean)
- If
true
, save state on unload and restore old state on load.
- swish_reply_resource(+Request) is semidet
- Serve /swish/Resource files. In recent Bootstrap versions, the
path to `fonts/` is generated that should refer to
node_modules/bootstrap/dist/fonts
. This could be a bug in
Bootstrap or in teh CSS cleaning. For now, we hack around the
issue here.
- swish_page(+Options)//
- Generate the entire SWISH default page.
- swish_navbar(+Options)//
- Generate the swish navigation bar.
- swish_config:logo(+Options)// is semidet[multifile]
- Hook to include the top-left logos. The default calls
pengine_logo//1 and swish_logo//1. The implementation should
emit zero or more <a> elements. See
config_available/branding.pl
for an example.
- pengine_logo(+Options)// is det
- swish_logo(+Options)// is det
- Emit an <a> element that provides a link to Pengines and SWISH
on this server. These may be called from swish_config:logo//1 to
include the default logos.
- swish_content(+Options)//
- Generate the SWISH editor, Prolog output area and query editor.
Options processed:
- source(HREF)
- Load initial source from HREF
- chat_count(Count)
- Indicate the presense of Count chat messages
- swish_resources//
- Include SWISH CSS and JavaScript. This does not use
html_require//1 because we need to include the JS using
RequireJS, which requires a non-standard script element.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
- swish_css(Arg1, Arg2)
- swish_js(Arg1, Arg2)
- swish_logo(Arg1, Arg2, Arg3)