[Python-modules-commits] [zzzeeksphinx] 01/06: Import zzzeeksphinx_1.0.20.orig.tar.gz

Piotr Ożarowski piotr at moszumanska.debian.org
Thu Jul 20 18:51:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

piotr pushed a commit to branch master
in repository zzzeeksphinx.

commit 319f978af489c8c52c15e280a12f618c043d35e5
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Thu Jul 20 20:43:25 2017 +0200

    Import zzzeeksphinx_1.0.20.orig.tar.gz
---
 PKG-INFO                                          |   2 +-
 setup.py                                          |   4 +
 zzzeeksphinx.egg-info/PKG-INFO                    |   2 +-
 zzzeeksphinx.egg-info/entry_points.txt            |   4 +
 zzzeeksphinx/__init__.py                          |   2 +-
 zzzeeksphinx/mako.py                              |   9 +-
 zzzeeksphinx/sqlformatter.py                      |  10 +-
 zzzeeksphinx/themes/zzzeeksphinx/genindex.mako    |   4 +-
 zzzeeksphinx/themes/zzzeeksphinx/layout.mako      |  37 ++++--
 zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss | 141 +++++++++++++++++-----
 zzzeeksphinx/themes/zzzeeksphinx/static_base.mako |   2 +
 zzzeeksphinx/themes/zzzeeksphinx/theme.conf       |   1 +
 zzzeeksphinx/toc.py                               |  23 ++--
 13 files changed, 182 insertions(+), 59 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 21c97bd..471c9b4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: zzzeeksphinx
-Version: 1.0.18
+Version: 1.0.20
 Summary: Zzzeek's Sphinx Layout and Utilities.
 Home-page: http://bitbucket.org/zzzeek/zzzeeksphinx
 Author: Mike Bayer
diff --git a/setup.py b/setup.py
index b164169..0677ecc 100644
--- a/setup.py
+++ b/setup.py
@@ -37,6 +37,10 @@ setup(
     entry_points={
         'sphinx_themes': [
             'zzzeeksphinx = zzzeeksphinx.theme:get_path',
+        ],
+        'pygments.lexers': [
+            'pycon+sql = zzzeeksphinx.sqlformatter:PyConWithSQLLexer',
+            'python+sql = zzzeeksphinx.sqlformatter:PythonWithSQLLexer'
         ]
     },
 )
diff --git a/zzzeeksphinx.egg-info/PKG-INFO b/zzzeeksphinx.egg-info/PKG-INFO
index 21c97bd..471c9b4 100644
--- a/zzzeeksphinx.egg-info/PKG-INFO
+++ b/zzzeeksphinx.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: zzzeeksphinx
-Version: 1.0.18
+Version: 1.0.20
 Summary: Zzzeek's Sphinx Layout and Utilities.
 Home-page: http://bitbucket.org/zzzeek/zzzeeksphinx
 Author: Mike Bayer
diff --git a/zzzeeksphinx.egg-info/entry_points.txt b/zzzeeksphinx.egg-info/entry_points.txt
index 6fa6d01..99ae4ae 100644
--- a/zzzeeksphinx.egg-info/entry_points.txt
+++ b/zzzeeksphinx.egg-info/entry_points.txt
@@ -1,3 +1,7 @@
+[pygments.lexers]
+pycon+sql = zzzeeksphinx.sqlformatter:PyConWithSQLLexer
+python+sql = zzzeeksphinx.sqlformatter:PythonWithSQLLexer
+
 [sphinx_themes]
 zzzeeksphinx = zzzeeksphinx.theme:get_path
 
diff --git a/zzzeeksphinx/__init__.py b/zzzeeksphinx/__init__.py
index ca86eaf..bc6e11d 100644
--- a/zzzeeksphinx/__init__.py
+++ b/zzzeeksphinx/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '1.0.18'
+__version__ = '1.0.20'
 
 
 def setup(app):
diff --git a/zzzeeksphinx/mako.py b/zzzeeksphinx/mako.py
index 8aac1bd..7a3fad2 100644
--- a/zzzeeksphinx/mako.py
+++ b/zzzeeksphinx/mako.py
@@ -5,9 +5,11 @@ from sphinx.jinja2glue import BuiltinTemplateLoader
 from mako.lookup import TemplateLookup
 from .toc import TOCMixin
 import os
+import re
 
 rtd = os.environ.get('READTHEDOCS', None) == 'True'
 
+
 class MakoBridge(TOCMixin, TemplateBridge):
     def init(self, builder, *args, **kw):
         self.jinja2_fallback = BuiltinTemplateLoader()
@@ -15,7 +17,9 @@ class MakoBridge(TOCMixin, TemplateBridge):
 
         builder.config.html_context['release_date'] = \
             builder.config['release_date']
-        builder.config.html_context['site_base'] = builder.config['site_base']
+        protocol_agnostic = builder.config['site_base']
+        protocol_agnostic = re.sub("^https?://", "//", protocol_agnostic)
+        builder.config.html_context['site_base'] = protocol_agnostic
 
         self.app = builder.app
 
@@ -28,7 +32,7 @@ class MakoBridge(TOCMixin, TemplateBridge):
             directories=builder.config.templates_path + [
                 template_path
             ],
-            #format_exceptions=True,
+            # format_exceptions=True,
             imports=[
                 "from zzzeeksphinx import util"
             ]
@@ -72,6 +76,7 @@ class MakoBridge(TOCMixin, TemplateBridge):
         context.setdefault("canonical_url", None)
         context.setdefault("single_version", None)
         context.setdefault("rtd_language", "en")
+
         # override context attributes
         self.setup_ctx(context)
         context.setdefault('_', lambda x: x)
diff --git a/zzzeeksphinx/sqlformatter.py b/zzzeeksphinx/sqlformatter.py
index b280df8..3ddc072 100644
--- a/zzzeeksphinx/sqlformatter.py
+++ b/zzzeeksphinx/sqlformatter.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
 from pygments.lexer import RegexLexer, bygroups, using
 from pygments.token import Token
 from pygments.filter import Filter
@@ -5,7 +7,7 @@ from pygments.filter import apply_filters
 from pygments.lexers import PythonLexer, PythonConsoleLexer
 from sphinx.highlighting import PygmentsBridge
 from pygments.formatters import HtmlFormatter, LatexFormatter
-
+from mako import filters
 import re
 
 
@@ -99,12 +101,14 @@ class PopupSQLFormatter(HtmlFormatter):
 
                 if ttype is Token.Sql:
                     yield 1, "<div class='show_sql'>%s</div>" % \
-                        re.sub(r'(?:{stop}|\n+)$', '', value)
+                        re.sub(
+                            r'(?:{stop}|\n+)$', '', filters.html_escape(value))
                 elif ttype is Token.Sql.Link:
                     yield 1, "<a href='#' class='sql_link'>sql</a>"
                 elif ttype is Token.Sql.Popup:
                     yield 1, "<div class='popup_sql'>%s</div>" % \
-                        re.sub(r'(?:{stop}|\n+)$', '', value)
+                        re.sub(
+                            r'(?:{stop}|\n+)$', '', filters.html_escape(value))
             else:
                 buf.append((ttype, value))
 
diff --git a/zzzeeksphinx/themes/zzzeeksphinx/genindex.mako b/zzzeeksphinx/themes/zzzeeksphinx/genindex.mako
index 9ea6795..76a3d90 100644
--- a/zzzeeksphinx/themes/zzzeeksphinx/genindex.mako
+++ b/zzzeeksphinx/themes/zzzeeksphinx/genindex.mako
@@ -21,7 +21,7 @@
         numcols = 1
         numitems = 0
     %>
-% for entryname, (links, subitems) in entries:
+% for entryname, (links, subitems) in [(a, b[0:2]) for a, b in entries]:
 
 <dt>
     % if links:
@@ -36,7 +36,7 @@
 
     % if subitems:
     <dd><dl>
-      % for subentryname, subentrylinks in subitems:
+      % for subentryname, subentrylinks in subitems[0:2]:
       <dt><a href="${subentrylinks[0][1]}">${subentryname|h}</a>
               % for j, (unknown, link) in enumerate(subentrylinks[1:]):
                   <a href="${link}">[${j}]</a>
diff --git a/zzzeeksphinx/themes/zzzeeksphinx/layout.mako b/zzzeeksphinx/themes/zzzeeksphinx/layout.mako
index bc7ed97..4e49e10 100644
--- a/zzzeeksphinx/themes/zzzeeksphinx/layout.mako
+++ b/zzzeeksphinx/themes/zzzeeksphinx/layout.mako
@@ -37,11 +37,13 @@
 
 
 <%
-withsidebar = bool(toc) and current_page_name != 'index'
+withsidebar = bool(toc) and (
+    theme_index_sidebar is True or current_page_name != 'index'
+)
 %>
 
 <%block name="head_title">
-    % if current_page_name != 'index':
+    % if theme_index_sidebar or current_page_name != 'index':
     ${capture(self.show_title) | util.striptags} —
     % endif
     ${docstitle|h}
@@ -87,7 +89,13 @@ withsidebar = bool(toc) and current_page_name != 'index'
 <div id="docs-top-navigation-container" class="body-background">
 <div id="docs-header">
     <div id="docs-version-header">
-        Release: <span class="version-num">${release}</span> | Release Date: ${release_date}
+        Release: <span class="version-num">${release}</span>
+        % if release_date:
+        | Release Date: ${release_date}
+        % else:
+        | Release Date: unreleased
+        % endif
+
     </div>
 
     <h1>${docstitle|h}</h1>
@@ -102,7 +110,11 @@ withsidebar = bool(toc) and current_page_name != 'index'
     % if not withsidebar:
         <div id="index-nav">
             <form class="search" action="${pathto('search')}" method="get">
-              <input type="text" name="q" size="12" /> <input type="submit" value="${_('Search')}" />
+              <label>
+                 Search terms:
+              <input type="text" placeholder="search..." name="q" size="12" />
+              </label>
+              <input type="submit" value="${_('Search')}" />
               <input type="hidden" name="check_keywords" value="yes" />
               <input type="hidden" name="area" value="default" />
             </form>
@@ -132,7 +144,10 @@ withsidebar = bool(toc) and current_page_name != 'index'
 
             <div id="sidebar-search">
                 <form class="search" action="${pathto('search')}" method="get">
-                  <input type="text" name="q" size="12" /> <input type="submit" value="${_('Search')}" />
+                  <label>
+                  Search terms:
+                  <input type="text" placeholder="search..." name="q" size="12" />
+                  </label>
                   <input type="hidden" name="check_keywords" value="yes" />
                   <input type="hidden" name="area" value="default" />
                 </form>
@@ -142,6 +157,12 @@ withsidebar = bool(toc) and current_page_name != 'index'
 
         <div id="docs-sidebar">
 
+        <div id="sidebar-banner">
+            ${parent.bannerad()}
+        </div>
+
+        <div id="docs-sidebar-inner">
+
         <%
             breadcrumb = parents[:]
             if not breadcrumb or breadcrumb[0]['link'] != pathto('index'):
@@ -174,6 +195,8 @@ withsidebar = bool(toc) and current_page_name != 'index'
         % endif
 
         </div>
+
+        </div>
     % endif
 
     </div>
@@ -205,7 +228,7 @@ withsidebar = bool(toc) and current_page_name != 'index'
 
 </div>
 
-<div id="docs-bottom-navigation" class="docs-navigation-links">
+<div id="docs-bottom-navigation" class="docs-navigation-links${', withsidebar' if withsidebar else ''}">
     % if prevtopic:
         Previous:
         <a href="${prevtopic['link']|h}" title="${_('previous chapter')}">${prevtopic['title']}</a>
@@ -249,4 +272,4 @@ withsidebar = bool(toc) and current_page_name != 'index'
     <script type="text/javascript" src="${pathto('_static/detectmobile.js', 1)}"></script>
     <script type="text/javascript" src="${pathto('_static/init.js', 1)}"></script>
 
-</%block>
\ No newline at end of file
+</%block>
diff --git a/zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss b/zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss
index ba48189..d3583c7 100644
--- a/zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss
+++ b/zzzeeksphinx/themes/zzzeeksphinx/static/docs.scss
@@ -1,6 +1,10 @@
-$primary-font-family: Verdana, sans-serif;
-$header-font-family: Helvetica, Arial, sans-serif;
-$top-header-font-family: Tahoma,Geneva,sans-serif;
+ at import url(//fonts.googleapis.com/css?family=Oxygen|Libre+Franklin:400,700);
+
+$primary-font-family: "Libre Franklin", sans-serif;
+$header-font-family: "Libre Franklin", Arial, sans-serif;
+$top-header-font-family: "Libre Franklin", Arial, sans-serif;
+$sidebar-font-family: "Libre Franklin", Verdana, sans-serif;
+
 $primary-background-color: #FDFBFC;
 $topmost-header-color: #EBEBEE;
 $popout-color: #FBFBEE;
@@ -11,8 +15,15 @@ $notebox-background-color: #EEFFEF;
 $border-style: 1px solid #CCC;
 $highlighted-nav-link-background-color: #DDD;
 
+$sidebar-popout-height: 160px;
+
+$max-container-width: 1000px;
+$fixed-sidebar-width: 224px;
+$docs-body-sidebar-left: 234px;
+
 /* global */
 
+
 .body-background {
   background-color: $primary-background-color;
 }
@@ -32,6 +43,11 @@ form {
     display:inline;
 }
 
+label > input {
+  margin: 10px 0px;
+
+}
+
 /* hyperlinks */
 
 a:link, a:visited, a:active {
@@ -76,8 +92,8 @@ a.headerlink:hover {
 /* Container setup */
 
 #docs-container {
-  max-width:1000px;
-  margin: 0 auto;
+  max-width:$max-container-width;
+  margin: 10px auto;
   position: relative;
 }
 
@@ -90,20 +106,24 @@ a.headerlink:hover {
   font-size:.9em;
   position: relative;
 
+  background-color: $topmost-header-color;
+  border: $border-style;
+  height: 75px;
+
+  display: flex;
+  align-items: center;
+
   h1 {
     font-size: 20px;
     color: #222222;
-    margin: 4px 0px;
-    padding: 5px 5px;
-    background-color: $topmost-header-color;
-    border: $border-style;
+    margin-left: 10px;
   }
 }
 
 #docs-sidebar-popout,
 #docs-bottom-navigation,
 #index-nav {
-  font-family: $primary-font-family;
+  font-family: $sidebar-font-family;
   background-color: $popout-color;
   border: $border-style;
   font-size:.8em;
@@ -129,6 +149,10 @@ a.headerlink:hover {
     margin: 1em 0 1em 5px;
 }
 
+#docs-bottom-navigation.withsidebar {
+  margin-left: $docs-body-sidebar-left;
+}
+
 #docs-copyright {
     font-size:.85em;
     padding:5px 0px;
@@ -174,13 +198,15 @@ a.headerlink:hover {
 }
 
 #docs-body,
-#docs-sidebar,
 #index-nav
  {
   font-family: $primary-font-family;
   font-size:.85em;
   line-height:1.5em;
 
+  h2 {
+      line-height:1.3em;
+  }
 }
 
 #docs-body {
@@ -193,7 +219,7 @@ a.headerlink:hover {
 #index-nav {
   position: relative;
   margin-top:10px;
-  padding:0 10px;
+  padding:10px 10px;
 }
 
 #index-nav form {
@@ -208,32 +234,40 @@ a.headerlink:hover {
 }
 
 #sidebar-topnav {
-  position: absolute;
-  bottom: 3em;
-  left: 10px;
 }
 
 #sidebar-search {
-  position: absolute;
-  bottom: 1em;
-  left: 10px;
+  margin: 10px 0px 10px 0px;
 }
 
+
 #docs-sidebar {
-  top: 118px;
+  top: $sidebar-popout-height + 18px;
+  width: $fixed-sidebar-width;
   bottom: 0;
   min-height: 0;
   overflow-y: auto;
   overflow-x: hidden;
   margin-top:5px;
-  width:212px;
+  margin-right: 5px;
+  z-index: 3;
+}
+
+#sidebar-banner {
+    margin: 0px;
+    padding: 0px;
+}
+
+
+#docs-sidebar-inner {
   padding-left:10px;
+  /*width:212px;*/
+
+  font-family: $sidebar-font-family;
 
   font-size:.85em;
 
   border: $border-style;
-
-  z-index: 3;
   background-color: $sidebar-color;
 
   > ul {
@@ -244,6 +278,8 @@ a.headerlink:hover {
     display: block;
     margin-left: -100px;
     padding-left: 100px;
+    padding-top: 3px;
+    padding-bottom: 3px;
   }
 
   li.current > span.link-container {
@@ -253,7 +289,7 @@ a.headerlink:hover {
   h3, h4 {
     background-color: $sidebar-header-background-color;
     color: $sidebar-header-color;
-    font-family: $primary-font-family;
+    font-family: $sidebar-font-family;
     font-size: 1.1em;
     font-weight: normal;
     margin: 10px 0 0 -15px;
@@ -280,16 +316,18 @@ a.headerlink:hover {
         margin-left: 20px;
     }
   }
+
 }
 
+
 #docs-sidebar-popout {
-  height:105px;
-  max-height: 105px;
+  height: $sidebar-popout-height;
+  max-height: $sidebar-popout-height;
   width:212px;
   padding-left:10px;
   padding-top:10px;
   position: relative;
-
+  line-height: 1.2em;
   font-size:.75em;
 
   p, form {
@@ -309,7 +347,8 @@ a.headerlink:hover {
 
 #fixed-sidebar.withsidebar {
   float: left;
-  width:224px;
+  width:$fixed-sidebar-width;
+
 }
 
 #fixed-sidebar.preautomated {
@@ -345,7 +384,7 @@ a.headerlink:hover {
 }
 
 #docs-body.withsidebar {
-  margin-left: 230px;
+  margin-left: $docs-body-sidebar-left;
 }
 
 
@@ -442,10 +481,56 @@ a.headerlink:hover {
 }
 
 
+/* tables */
+
+.section > table.docutils {
+  border: none;
+  border-collapse: collapse;
+
+  tr {
+    border-collapse: collapse;
+    border-spacing: 0;
+    empty-cells: show;
+
+    td, th {
+      border: 1px solid #e1e4e5;
+      background-color: transparent;
+      vertical-align: middle;
+      font-size: 90%;
+      margin: 0;
+      overflow: visible;
+      padding: 8px 16px;
+    }
+
+
+  }
+
+
+  tr.row-even {
+      td {
+        background-color: #f3f6f6;
+      }
+  }
+
+
+
+}
+
 /* docutils-specific elements */
 
 th.field-name {
     text-align:right;
+    position: absolute;
+    padding: 0px;
+    margin: 0px;
+}
+
+td.field-body {
+  padding-top: 1em;
+  ul.first {
+    padding-left: 17px;
+    padding-top: 1em;
+  }
 }
 
 div.section {
diff --git a/zzzeeksphinx/themes/zzzeeksphinx/static_base.mako b/zzzeeksphinx/themes/zzzeeksphinx/static_base.mako
index 437df66..998e60e 100644
--- a/zzzeeksphinx/themes/zzzeeksphinx/static_base.mako
+++ b/zzzeeksphinx/themes/zzzeeksphinx/static_base.mako
@@ -1,6 +1,8 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
+<%def name="bannerad()"></%def>
+
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --git a/zzzeeksphinx/themes/zzzeeksphinx/theme.conf b/zzzeeksphinx/themes/zzzeeksphinx/theme.conf
index 508ed64..9bb5562 100644
--- a/zzzeeksphinx/themes/zzzeeksphinx/theme.conf
+++ b/zzzeeksphinx/themes/zzzeeksphinx/theme.conf
@@ -4,3 +4,4 @@ stylesheet = docs.css
 pygments_style = sphinx
 
 [options]
+index_sidebar = false
\ No newline at end of file
diff --git a/zzzeeksphinx/toc.py b/zzzeeksphinx/toc.py
index ec9331b..3820219 100644
--- a/zzzeeksphinx/toc.py
+++ b/zzzeeksphinx/toc.py
@@ -1,7 +1,6 @@
 #!coding: utf-8
 
 from docutils import nodes as docutils_nodes
-from sphinx import addnodes
 
 
 class TOCMixin(object):
@@ -22,15 +21,19 @@ class TOCMixin(object):
 
         raw_tree = self.app.env.get_toctree_for(
             current_page_name, self.app.builder, True, maxdepth=-1)
-        local_tree = self.app.env.get_toc_for(
+        local_toc_tree = self.app.env.get_toc_for(
             current_page_name, self.app.builder)
 
+        if raw_tree is None:
+            raw_tree = local_toc_tree
+
         # start with the bullets inside the doc's toc,
         # not the top level bullet, as we get that from the other tree
-        if not local_tree.children or len(local_tree.children[0].children) < 2:
+        if not local_toc_tree.children or \
+                len(local_toc_tree.children[0].children) < 2:
             local_tree = None
         else:
-            local_tree = local_tree.children[0].children[1]
+            local_tree = local_toc_tree.children[0].children[1]
 
         def _locate_nodes(nodes, level, outer=True):
             # this is a lazy way of getting at all the info in a
@@ -64,16 +67,7 @@ class TOCMixin(object):
                     name = local_text[0].rawsource
                     remainders = elem.children[index:]
 
-                    # a little bit of extra filtering of when/where
-                    # we want internal nodes vs. page-level nodes,
-                    # this is usually not needed except in a certain
-                    # edge case
-                    if (
-                        not outer and refuri.startswith("#")
-                    ) or (
-                        outer and "#" not in refuri
-                    ):
-                        yield level, refuri, name, local_text
+                    yield level, refuri, name, local_text
                 else:
                     remainders = elem.children
 
@@ -178,6 +172,7 @@ class TOCMixin(object):
                             parent_element=parent_element)
 
         element = docutils_nodes.bullet_list()
+
         nodes = _organize_nodes(_locate_nodes([raw_tree], 0))
         _render_nodes(
             nodes,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/zzzeeksphinx.git



More information about the Python-modules-commits mailing list