X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/a352efb826be6c0341d22203cdb7fe9d0af51950..31cf69da711d788e330a44d20e29ce901615d13c:/bin/pagegen.py diff --git a/bin/pagegen.py b/bin/pagegen.py index 008ee71..a4b9f5d 100755 --- a/bin/pagegen.py +++ b/bin/pagegen.py @@ -16,18 +16,23 @@ def jslist(name, debug): return list("js/%s%s.js" % (y, hgid) for y in pages.flatten(x)) def csslist(name, debug, gen=False): + ui = pages.UIs[name] + nocss = ui.get("nocss") if not debug: return ["css/%s-%s.css" % (name, gethgid())] - ui = pages.UIs[name] - return list("css/%s%s.css" % ("debug/" if gen else "", x) for x in pages.flatten([ui.get("extracss", []), "colours", "dialogs", "%s" % name])) + css = pages.flatten([ui.get("extracss", []), "colours", "dialogs"]) + if not nocss: + css = list(css) + [name] + return list("css/%s%s.css" % ("debug/" if gen else "", x) for x in css) def _gethgid(): try: - p = subprocess.Popen(["hg", "id"], stdout=subprocess.PIPE) + p = subprocess.Popen(["hg", "id"], stdout=subprocess.PIPE, shell=os.name == "nt") except Exception, e: if hasattr(e, "errno") and e.errno == 2: raise HGException, "unable to execute" - + raise HGException, "unknown exception running hg: %s" % repr(e) + data = p.communicate()[0] if p.wait() != 0: raise HGException, "unable to get id" @@ -48,8 +53,11 @@ def producehtml(name, debug): ui = pages.UIs[name] js = jslist(name, debug) css = csslist(name, debug, gen=True) - csshtml = "\n".join(" " % x for x in css) - jshtml = "\n".join(" " % x for x in js) + csshtml = "\n".join(" " % (config.STATIC_BASE_URL, x) for x in css) + jshtml = "\n".join(" " % (config.STATIC_BASE_URL, x) for x in js) + + if hasattr(config, "ANALYTICS_HTML"): + jshtml+="\n" + config.ANALYTICS_HTML div = ui.get("div", "") customjs = ui.get("customjs", "") @@ -57,9 +65,11 @@ def producehtml(name, debug): return """%s + %s (qwebirc) - + + %s%s %s