docs.gl icon indicating copy to clipboard operation
docs.gl copied to clipboard

Offline version cannot really be used offline

Open Letheward opened this issue 3 years ago • 1 comments

The offline version downloaded from About cannot be used normally without internet.

The Problem:

  • Without internet, the left sidebar links, search and MathJax rendering, etc are completely not functional.

Temporary Solutions:

  • I just batch replace all the external links to jquery.min.js, jquery-ui.min.js from every file to links to local disk versions of these files, and it seems works out fine. (MathJax is not working of course)
  • And batch replace the all the home logo links on top left to href="../index.html".

Maybe we can do these at the build process?

Letheward avatar Jun 29 '21 07:06 Letheward

Thanks for pointing this out. I don't have the bandwidth to do these but I would love to see a PR.

BSVino avatar Jul 27 '21 15:07 BSVino

The docs can be viewed offline using a local HTTP server. However, because function documentation files have no extension, a custom server that serves extensionless files as text/html has to be used.

As a quick solution to anybody that has this issue, you can copy this python script to something like serve.py and then run it:

#!/usr/bin/env python3

import http.server
import socketserver


class Handler(http.server.SimpleHTTPRequestHandler):
    extensions_map = http.server.SimpleHTTPRequestHandler.extensions_map.copy()
    extensions_map[''] = 'text/html'


host = "localhost"
port = 8080
with socketserver.TCPServer((host, port), Handler) as httpd:
    print(f"serving docs at http://{host}:{port}")
    httpd.serve_forever()

kovaxis avatar Feb 19 '23 12:02 kovaxis