How to distribute XDOC manuals for other people to use.
After you have documented your books with XDOC and created a manual, you may wish to share your manual with coworkers, collaborators, customers, sponsors, etc. The best way to do this may depend on many factors.
By default, the manuals created by save use only client-side JavaScript code. This makes deployment very easy: you can just copy the files to wherever you like, and you don't even need a web server.
This approach—just copying the default manual—is well-suited for:
But the default manuals will perform badly on slow connections. So, if your users are going to read the manual over, e.g., VPNs or public web sites, then you may wish to read on.
The basic reason that the default manuals are slow is that they work by
simply loading the data for every topic, at startup. As of October
2013, this comes to around 25 MB of data for the basic
The XDOC manuals created by
This option requires a small amount of configuration, and you may need to coordinate with your network administrator to get certain software installed.
If you want to use our scripts directly, you will need a web server that supports Perl scripts with the CGI, DBI, and DBD::SQLite modules installed. If for some reason this poses a problem, you may find that you can easily port these scripts to other popular languages, like PHP or Ruby, with SQLite support.
In the manual directory you created with the save command, you should
find a Perl script named
$ cd my-library/manual $ perl xdata2sql.pl ------------------------------------------------------------------------------- xdata2sql.pl: Convert xdata.js into xdata.db (an sqlite3 database) NOTE: Most folks don't need to run this at all! If you just want to: - browse an XDOC manual on your local hard drive, or - share an XDOC manual on your fast intranet then ignore this script and just see index.html. The main use for this script is to share XDOC manuals on the internet. In this scenario, just having the web browser load in the entire (generally 20+ MB) xdata.js file is not very practical, because some users will have slow connections and will take too long to load the file. There are many ways to solve this. Our approach is to convert xdata.js into an sqlite3 database, and then use a server-side script that will allow us to access topics only as they are requested. ------------------------------------------------------------------------------- ; Converting xdata.js ; Reading file ; Checking file ; Parsing JSON data. ; Creating new xdata.db. ; Creating xdoc_data table. ; Populating xdoc_data table. ; All done. To actually use the database, see xdataget.pl.
After this step, you should have a new file named
If you are missing some required Perl modules, then instead of the above output you may see a message such as
Can't locate DBI.pm in @INC ...
In this case, you may need to ask your systems administrator to install the missing modules.
Once you have created the
Typically, for
To make sure the script is working, you should now load it in your web
browser by going to, e.g.,
{"results":[ ]}
If, instead, you see a message like Internal Server Error, then you may have a permissions problem, or your web server's version of Perl may be missing a require library, or something else may be wrong; ask your systems administrator for help.
You may also wish to load, e.g.,:
http://my-server/cgi-bin/xdataget.pl?keys=ACL2____TOP
and make sure that you can see some text from your top topic.
The final step is to edit the file
var XDATAGET = "";
To have the right URL for your xdataget.pl script, e.g., into:
var XDATAGET = "http://my-server/cgi-bin/xdataget.pl";
At this point, your manual should load topic data dynamically as needed. The result should be much faster for users on slow connections.