library(pldoc/http) provides an embedded HTTP documentation
server that allows for browsing the documentation of all files loaded
after library(pldoc) has been loaded.
- Actually activate the PlDoc server. Merely loading the server does not do so to avoid incidental loading in a user HTTP server making the documentation available.
- doc_server(?Port) is det
- doc_server(?Port, +Options) is det
- Start a documentation server in the current Prolog process. The
server is started in a separate thread. Options are handed to
http_server/2. In addition, the following options are
- Allow connections from HostOrIP. If HostOrIP is an atom
it is matched to the hostname. It if starts with a .,
suffix match is done, matching the domain. Finally it
can be a term
ip(A,B,C,D). See tcp_host_to_address/2 for details.
- Allow editing from localhost connections? Default:
The predicate doc_server/1 is defined as below, which provides a good default for development.
doc_server(Port) :- doc_server(Port, [ allow(localhost) ]).
- doc_current_server(-Port) is det[private]
- TCP/IP port of the documentation server. Fails if no server is running. Note that in the current infrastructure we can easily be embedded into another Prolog HTTP server. If we are not started from doc_server/2, we return the port of a running HTTP server.
- doc_browser is det
- doc_browser(+What) is semidet
- Open user's default browser on the documentation server.
- Start XPCE as edit requests comming from the document server can only be handled if XPCE is running.
- Reply using the index-page of the Prolog working directory. There are various options for the start directory. For example we could also use the file or directory of the file that would be edited using edit/0.
- HTTP handle for /index.html, providing an overall overview of the available documentation.
- Hander for /file?file=File, providing documentation for File.
- HTTP handler that starts the user's default editor on the host
running the server. This handler can only accessed if the
browser connection originates from
localhost. The call can edit files using the
fileattribute or a predicate if both
arityis given and optionally
- HTTP handler to handle the places menu.
- allowed_directory(+Dir) is semidet[private]
- True if we are allowed to produce and index for Dir.
- allowed_file(+File) is semidet[private]
- True if we are allowed to serve File. Currently means we have predicates loaded from File or the directory must be allowed.
- Handler for /res/File, serving CSS, JS and image files.
- Handler for /doc/Path
Reply documentation of a file. Path is the absolute path of the file for which to return the documentation. Extension is either none, the Prolog extension or the HTML extension.
Note that we reply with pldoc.css if the file basename is pldoc.css to allow for a relative link from any directory.
- edit_options(+Request, -Options) is det[private]
edit(true)in Options if the connection is from the localhost.
- pl_file(+File, -PlFile) is semidet[private]
- wiki_file(+File, -TxtFile) is semidet[private]
- True if TxtFile is an existing file that must be served as wiki file.
- clean_path(+AfterDoc, -AbsPath)[private]
- Restore the path, Notably deals Windows issues
- Handler for /man, offering one of the parameters:
- providing documentation from the manual on the predicate PI.
- providing documentation from the manual on the function PI.
- providing documentation from the manual on the C-function F.
- Handler for /doc_for?object=Term, Provide documentation for the given term.
- Search the collected PlDoc comments and Prolog manual.
The following predicates are exported, but not or incorrectly documented.