From bbc9f232f882b7d4b64ae4c1e21260c1fa196a09 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 19 Apr 2015 13:37:39 +0200 Subject: [PATCH] Fix some stylistic issues found by various linters. --- src/pwl6.css | 4 ++-- tools/generate-appcache | 25 ++++++++++++++++--------- tools/generate-nw | 13 ++++++++----- tools/generate-osx-app | 9 +++++---- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/pwl6.css b/src/pwl6.css index 180d159..12c330a 100644 --- a/src/pwl6.css +++ b/src/pwl6.css @@ -15,9 +15,9 @@ html, body { } .yuu-overlay *:focus { - box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); -moz-box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); -webkit-box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); + box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); outline: none; } @@ -39,9 +39,9 @@ input[type=range][data-yuu-command]::-moz-range-thumb { } input[type=checkbox][data-yuu-command]:focus + label[for] { - box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); -moz-box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); -webkit-box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); + box-shadow: 0 0 5px hsla(276, 66%, 80%, 1.0); outline: 0; } diff --git a/tools/generate-appcache b/tools/generate-appcache index a729f0b..674a864 100755 --- a/tools/generate-appcache +++ b/tools/generate-appcache @@ -1,19 +1,28 @@ #!/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: + +- http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html +- 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) @@ -45,8 +54,6 @@ if __name__ == "__main__": 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) - diff --git a/tools/generate-nw b/tools/generate-nw index 62b535c..ea99e69 100755 --- a/tools/generate-nw +++ b/tools/generate-nw @@ -6,15 +6,18 @@ import os import re -import shutil import time import json + def is_html(filename): return filename.lower().endswith(".html") + def attr(name): - return "data-" + name + """=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?""" + return ("data-" + name + + """=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?""") + def main(appdir, version=None): if not os.path.isdir(appdir): @@ -24,10 +27,10 @@ def main(appdir, version=None): for root, dirnames, filenames in os.walk(appdir): root = os.path.relpath(root, appdir) for filename in filenames: - if filename.lower() == "index.html": + flower = filename.lower() + if flower == "index.html": indexes.append(os.path.join(root, filename)) - if ("icon" in filename.lower() - and filename.lower().endswith((".ico", ".png"))): + if ("icon" in flower and flower.endswith((".ico", ".png"))): icons.append(os.path.join(root, filename)) indexes.sort(key=lambda fn: (fn.count("/"), fn)) diff --git a/tools/generate-osx-app b/tools/generate-osx-app index 57d80a0..86e5c46 100755 --- a/tools/generate-osx-app +++ b/tools/generate-osx-app @@ -6,24 +6,26 @@ import re import plistlib import shutil import json -import re -from os.path import join, basename +from os.path import join + def xp_filename(basename): return re.sub('["<>*?|\\\\]', "_", basename.replace("/", "-").replace(":", ".")) + def versionify(version): return ".".join(filter(lambda x: x.isdigit(), re.split("[-+.]", version))[:3]) + def main(nwdir, nwpackage): if not os.path.isdir(nwdir): raise StandardError("input (%r) is not a directory" % nwdir) nwzip = zipfile.ZipFile(nwpackage) icnss = filter(lambda f: f.lower().endswith(".icns"), - nwzip.namelist()) + nwzip.namelist()) package = json.load(nwzip.open("package.json")) app = join(nwdir, "nwjs.app") title = package["window"]["title"] @@ -56,4 +58,3 @@ def main(nwdir, nwpackage): if __name__ == "__main__": import sys main(*sys.argv[1:]) - -- 2.30.2