diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
| commit | 350aed3fdb9f1e73e69655e53f44ca6a91c196da (patch) | |
| tree | 3d2a128667b5f6ca6d0b4e1f4865fc98aac6b60b /doc/build/builder | |
| parent | 71f92436bdc86f30e2c21d8f5244733601e8c39e (diff) | |
| download | sqlalchemy-350aed3fdb9f1e73e69655e53f44ca6a91c196da.tar.gz | |
- whitespace removal bonanza
Diffstat (limited to 'doc/build/builder')
| -rw-r--r-- | doc/build/builder/builders.py | 19 | ||||
| -rw-r--r-- | doc/build/builder/util.py | 4 |
2 files changed, 11 insertions, 12 deletions
diff --git a/doc/build/builder/builders.py b/doc/build/builder/builders.py index b82480ad3..d5feaf85e 100644 --- a/doc/build/builder/builders.py +++ b/doc/build/builder/builders.py @@ -14,14 +14,14 @@ from mako.template import Template class MakoBridge(TemplateBridge): def init(self, builder, *args, **kw): self.layout = builder.config.html_context.get('mako_layout', 'html') - + self.lookup = TemplateLookup(directories=builder.config.templates_path, format_exceptions=True, imports=[ "from builder import util" ] ) - + def render(self, template, context): template = template.replace(".html", ".mako") context['prevtopic'] = context.pop('prev', None) @@ -30,8 +30,8 @@ class MakoBridge(TemplateBridge): # sphinx 1.0b2 doesn't seem to be providing _ for some reason... context.setdefault('_', lambda x:x) return self.lookup.get_template(template).render_unicode(**context) - - + + def render_string(self, template, context): context['prevtopic'] = context.pop('prev', None) context['nexttopic'] = context.pop('next', None) @@ -44,7 +44,7 @@ class MakoBridge(TemplateBridge): "from builder import util" ] ).render_unicode(**context) - + class StripDocTestFilter(Filter): def filter(self, lexer, stream): for ttype, value in stream: @@ -116,7 +116,7 @@ def _strip_trailing_whitespace(iter_): buf[-1] = (buf[-1][0], buf[-1][1].rstrip()) for t, v in buf: yield t, v - + class PopupSQLFormatter(HtmlFormatter): def _format_lines(self, tokensource): buf = [] @@ -134,7 +134,7 @@ class PopupSQLFormatter(HtmlFormatter): yield 1, "<div class='popup_sql'>%s</div>" % re.sub(r'(?:[{stop}|\n]*)$', '', value) else: buf.append((ttype, value)) - + for t, v in _strip_trailing_whitespace(HtmlFormatter._format_lines(self, iter(buf))): yield t, v @@ -148,7 +148,7 @@ class PopupLatexFormatter(LatexFormatter): continue else: yield ttype, value - + def format(self, tokensource, outfile): LatexFormatter.format(self, self._filter_tokens(tokensource), outfile) @@ -164,5 +164,4 @@ def setup(app): app.connect('autodoc-skip-member', autodoc_skip_member) PygmentsBridge.html_formatter = PopupSQLFormatter PygmentsBridge.latex_formatter = PopupLatexFormatter - -
\ No newline at end of file + diff --git a/doc/build/builder/util.py b/doc/build/builder/util.py index dc2e27245..a9dcff001 100644 --- a/doc/build/builder/util.py +++ b/doc/build/builder/util.py @@ -6,7 +6,7 @@ def striptags(text): def go(m): # .html with no anchor if present, otherwise "#" for top of page return m.group(1) or '#' - + def strip_toplevel_anchors(text): return re.compile(r'(\.html)?#[-\w]+-toplevel').sub(go, text) - + |
