diff --git a/doc/buildweb.py b/doc/buildweb.py index dcfd60de..29c25186 100755 --- a/doc/buildweb.py +++ b/doc/buildweb.py @@ -8,6 +8,7 @@ from __future__ import with_statement import codecs import datetime +import inspect import os import subprocess as sp import sys @@ -52,7 +53,7 @@ class Site(object): print "" print "Updating css..." try: - sp.check_call(["compass", "compile"]) + sp.check_call(["compass", "compile", "--boring"]) except sp.CalledProcessError: print "Failed to update CSS" @@ -89,6 +90,8 @@ class Page(object): basename, oldext = os.path.splitext(filename) oldext = oldext.lower()[1:] converter = getattr(self, "convert_%s" % oldext, lambda x: x) + if "insert_settings" in self.headers: + body = body % {"settings": self.format_settings()} self.body = converter(body) newext = self.headers.get('ext', '.html') @@ -120,14 +123,108 @@ class Page(object): if not tmpl_name: return self.body - kwargs = {"conf": conf, "body": self.body, "url": self.url()} + kwargs = { + "conf": conf, + "body": self.body, + "url": self.url() + } kwargs.update(self.headers) return self.site.get_template(tmpl_name).render(kwargs) def convert_rst(self, body): - parts = publish_parts(source=body, writer_name="html") + overrides = {"initial_header_level": 2} + parts = publish_parts( + source=body, + writer_name="html", + settings_overrides=overrides + ) return parts['html_body'] + def format_settings(self): + currdir = os.path.dirname(__file__) + sys.path.insert(0, os.path.join(currdir, "..")) + import gunicorn.config as guncfg + ret = [] + for i, s in enumerate(guncfg.KNOWN_SETTINGS): + if i == 0 or s.section != guncfg.KNOWN_SETTINGS[i-1].section: + ret.append("%s\n%s\n\n" % (s.section, "+" * len(s.section))) + ret.append(self.fmt_setting2(s)) + return ''.join(ret) + + def fmt_setting2(self, s): + if callable(s.default): + val = inspect.getsource(s.default) + val = "\n".join(" %s" % l for l in val.splitlines()) + val = " ::\n\n" + val + else: + val = "``%s``" % s.default + + if s.cli and s.meta: + args = ["%s %s" % (arg, s.meta) for arg in s.cli] + cli = ', '.join(args) + elif s.cli: + cli = ", ".join(s.cli) + + out = [] + out.append("%s" % s.name) + out.append("~" * len(s.name)) + out.append("") + if s.cli: + out.append("* ``%s``" % cli) + out.append("* %s" % val) + out.append("") + out.append(s.desc) + out.append("") + out.append("") + return "\n".join(out) + + def fmt_setting(self, s): + out = [] + lines = s.desc.splitlines() + width = max(map(lambda x: len(x), lines)) + + if not callable(s.default): + val = '%s' % s.default + else: + val = '' + + if s.cli and s.meta: + args = ["%s %s" % (arg, s.meta) for arg in s.cli] + cli = ', '.join(args) + elif s.cli: + cli = ", ".join(s.cli) + else: + cli = "N/A" + + width = 80 + namelen = 20 + deflen = 20 + clilen = width - (namelen + deflen + 4) + + args = ("-" * namelen, "-" * deflen, "-" * clilen) + out.append("+%s+%s+%s+" % args) + + names = "| %s" % s.name + names += " " * (namelen - (len(s.name) + 2)) + names += " | %s" % val + names += " " * (deflen - (len(val) + 2)) + names += " | %s" % cli + names += " " * (clilen - (len(cli) + 1)) + names += "|" + out.append(names) + + out.append(out[0].replace("-", "=")) + + for l in lines: + l = l.rstrip("\n") + if len(l) < width: + l += " " * ((width - 2) - len(l)) + out.append("|%s|" % l) + out.append("+%s+" % ("-" * (width - 2))) + out.extend(["", ""]) + + return "\n".join(out) + def main(): Site().render() diff --git a/doc/css/style.sass b/doc/css/style.sass index dfc7fb8e..b051b8f1 100644 --- a/doc/css/style.sass +++ b/doc/css/style.sass @@ -1,10 +1,159 @@ +@import compass/css3 @import compass/reset +@import compass/utilities/general +@import compass/utilities/lists -$bg_color: #F9F9F9 -$font_color: #2A2A2A +$separator: #CCCCCC + +$size_body_width: 700px +$size_toc_width: 150px + +$color_a: #569633 +$color_bg: #F9F9F9 +$color_font: #2A2A2A +$color_footer_a: #444444 +$color_footer_border: #CCCCCC +$color_headings: #489848 +$color_headings_border: #CCCCCC +$color_menu_border: #BBBBBB +$color_menu_a: #489848 +$color_note_before: #489848 +$color_note_border: #489848 +$color_pre_bg: #FFFFDD +$color_th_border: #000000 body - background: $bg_color - color: $font_color + background: $color_bg + color: $color_font + line-height: 18px font-family: Arial, sans-serif + font-size: 13px + +div.container + display: block + width: $size_body_width + margin: 0 auto + +#header + margin: 1em auto + text-align: center + +#menu + width: 100% + margin: 1em 0 + border-bottom: 1px solid $color_menu_border + text-align: center + ul + +no-bullets + display: inline + li + display: inline + margin-right: 15px + text-align: center + a + font-size: 20px + font-weight: 700 + color: $color_menu_a + text-decoration: none + +#contents.sidebar + float: right + width: $size_toc_width + ul + margin-bottom: 0.2em + +p.topic-title + display: none + +div.section + margin-right: $size_toc_width + 20px + +div.section div.section + margin-right: 0 + +div.section ul + margin-left: 15px + +no-bullets + +h1, h2, h3, h4 + color: $color_headings + +h1 + margin-top: 10px + font-size: 26px + +h2 + border-bottom: 5px solid $color_headings_border + margin-bottom: 13px + padding-bottom: 3px + font-size: 20px + font-weight: 700 + +h3 + border-bottom: 1px solid $color_headings_border + margin-bottom: 13px + font-weight: 700 + +a + color: $color_a + text-decoration: none + +p + margin-bottom: 1em font-size: 1em + +ol + list-style: decimal + margin-left: 2em + margin-bottom: 13px + +ul + list-style: disc + margin-left: 2em + margin-bottom: 13px + +pre, tt + font-family: 'andale mono', 'lucida console', monospace + font-size: 12px + background: $color_pre_bg + +pre + white-space: pre + margin: 3px 3px 2em 3px + padding: 8px 20px + +.note + border-top: 1px solid $color_note_border + border-bottom: 1px solid $color_note_border + padding: .6em .6em .6em 80px + margin-bottom: 2em + position: relative + p.admonition-title:before + content: "!" + font-size: 60px + font-weight: bold + color: $color_note_before + position: absolute + top: 30px + left: 30px + font-family: helvetica,arial + p.admonition-title + font-weight: 700 + margin: 0 + margin-bottom: 4px + padding: 0 + p.last + padding: 0 + margin: 0 + +#footer + border-top: 1px solid $color_footer_border + clear: both + display: block + width: 100% + margin-top: 3em + padding-top: 1em + text-align: center + font-size: 0.8em + a + color: $color_footer_a diff --git a/doc/htdocs/configuration.html b/doc/htdocs/configuration.html index 9b28d197..bf36c537 100644 --- a/doc/htdocs/configuration.html +++ b/doc/htdocs/configuration.html @@ -4,56 +4,31 @@
+
+ Gunicorn 0.5 introduced the ability to use a Python configuration file. Gunicorn will look for gunicorn.conf.py in the current working directory or what ever path is specified on the command line with the -c option.
backlog = 2048 # The listen queue size for the server socket
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
@@ -85,7 +60,7 @@ before_exec=lambda server: server.log.info("Forked child, reexecuting"