All predicatesShow sourcepage.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.

Source 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.
Source add_show_beware(+Options0, -Option) is det[private]
Add show_beware(false) when called with code, query or examples. These are dedicated calls that do not justify this message.
Source add_preserve_state(+Options0, -Option) is det[private]
Add preserve_state(false) when called with code.
Source source_option(+Request, +Options0, -Options)[private]
If the data was requested as '/Alias/File', reply using file Alias(File).
Source source_file(+Request, -File, +Options) is semidet[private]
File is the file associated with a SWISH request. A file is associated if path_info is provided. If the file does not exist, an HTTP 404 exception is returned. Options:
alias(-Alias)
Get the swish_config:source_alias/2 Alias name that was used to find File.
Source source_metadata(+Path, +Code, -Meta:dict) is det[private]
Obtain meta information about a local source file. Defined meta info is:
last_modified:Time
Last modified stamp of the file. Always present.
loaded:true
Present of the file is a loaded source file
modified_since_loaded:true
Present if the file loaded, has been edited, but not yet reloaded.
Source 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.
Source swish_page(+Options)//
Generate the entire SWISH default page.
Source swish_navbar(+Options)//
Generate the swish navigation bar.
Source swish_title(+Options)// is det[private]
Emit the HTML header options dealing with the title and shortcut icons. This can be hooked using title//1.
Source swish_logos(+Options)// is det[private]
Emit the navbar branding logos at the top-left. Can be hooked using swish_logos//1.
 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.
Source pengine_logo(+Options)// is det
Source 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.
Source 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
Source swish_config_hash(+Options)//[private]
Set window.swish.config_hash to a hash that represents the current configuration. This is used by config.js to cache the configuration in the browser's local store.
Source swish_options(+Options)//[private]
Emit additional options. This is similar to config, but the config object is big and stable for a particular SWISH server. The options are set per session.
Source source(+Type, +Options)//[private]
Associate the source with the SWISH page. The source itself is stored in the textarea from which CodeMirror is created. Options:
code(+String)
Initial code of the source editor
file(+File)
If present and code(String) is present, also associate the editor with the given file. See storage.pl.
url(+URL)
as file(File), but used if the data is loaded from an alias/file path.
title(+Title)
Defines the title used for the tab.
Source background(+Options)//[private]
Associate the background program (if any). The background program is not displayed in the editor, but is sent to the pengine for execution.
Source notebooks(+Type, +Options)//[private]
We have opened a notebook. Embed the notebook data in the left-pane tab area.
Source download_source(+HREF, -Source, +Options) is det[private]
Download source from a URL. Options processed:
timeout(+Seconds)
Max time to wait for reading the source. Default is 10 seconds.
max_length(+Chars)
Maximum lenght of the content. Default is 1 million.
encoding(+Encoding)
Encoding used to interpret the text. Default is UTF-8.
bug
- : Should try to interpret the encoding from the HTTP header.
Source document_type(-Type, +Options) is det[private]
Determine the type of document.
Arguments:
Type- is one of swinb or pl
Source 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.
Source swish_rest_reply(+Method, +Request, +Options) is det[private]
Handle non-GET requests. Such requests may be used to modify source code.

Undocumented predicates

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

Source swish_css(Arg1, Arg2)
Source swish_js(Arg1, Arg2)
Source swish_logo(Arg1, Arg2, Arg3)