This repository provides the SWI-Prolog sources for a proxy server for Learn Prolog Now! which rewrites the sources to embed SWISH, the SWI-Prolog web shell. The modified version of Learn Prolog Now is hosted at lpn.swi-prolog.org
The current version is merely a proof of concept. It identifies verbatim environments in the Learn Prolog Now HTML and classifies these as source code or example queries. It notably is not (yet) very good at discovering the relations between source fragments. Most of the infrastructure to improve on that is already in place: sources and queries are parsed and analysed for predicates they implement and require.
You will need to install SWI Prolog version 7 or greater for this to work. To check, run this:
% swipl --version
% swipl proxy.pl
?- server(8080).
Use local server at port 8000 rather than www.learnprolognow.org:
% swipl proxy.pl
?- local.
?- server(8080).
?- local_swish(3050).
As current user
% ./daemon.pl --port=8080
As defined user
% sudo -u www-data ./daemon.pl --port=8080
Or on port 80:
% sudo ./daemon.pl --user=www-data
Create a directory cache
and make sure it is writeable by the server.
If no such diretory exists, all pages are fetched dynamically.
% mkdir cache
% sudo chgrp www-data cache
% sudo chmod g+w cache