#!/usr/bin/env python
-# Turn a website into an HTML5 application with an application cache
-# manifest.
-#
-# http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html
-# https://developer.mozilla.org/en/docs/HTML/Using_the_application_cache
+"""Turn a website into an HTML5 application
+
+
+This turns a directory into the simplest possible offline web
+application, by making a manifest containing every file in the
+directory, then inserting it into each HTML document.
+
+For more information about the HTML5 application cache, see:
+
+- https://html.spec.whatwg.org/multipage/browsers.html#offline
+- https://developer.mozilla.org/en/docs/HTML/Using_the_application_cache
+
+"""
import os
import re
-import shutil
import time
+
def is_html(filename):
return filename.lower().endswith(".html")
+
def main(appdir):
if not os.path.isdir(appdir):
raise StandardError("input (%r) is not a directory" % appdir)
try:
appdir = sys.argv[1]
except IndexError:
- raise SystemExit("Usage: %s appdir" %(
- sys.argv[0]))
+ raise SystemExit("Usage: %s appdir" % sys.argv[0])
else:
main(appdir)
-