[Pythonjp-checkins] [py33.python-doc-ja] push by songofacandy - sphinxext の更新 on 2012-11-22 04:22 GMT

アーカイブの一覧に戻る

pytho****@googl***** pytho****@googl*****
2012年 11月 22日 (木) 13:22:19 JST


Revision: 45f08c9cb21c
Branch:   default
Author:   "INADA Naoki  <inada****@klab*****>"
Date:     Wed Nov 21 20:22:04 2012
Log:      sphinxext の更新
http://code.google.com/p/python-doc-ja/source/detail?r=45f08c9cb21c&repo=py33

Modified:
  /tools/sphinxext/indexsidebar.html
  /tools/sphinxext/layout.html
  /tools/sphinxext/pyspecific.py
  /tools/sphinxext/susp-ignored.csv

=======================================
--- /tools/sphinxext/indexsidebar.html	Mon Jul 16 20:08:10 2012
+++ /tools/sphinxext/indexsidebar.html	Wed Nov 21 20:22:04 2012
@@ -3,7 +3,7 @@
  	    <h3>Docs for other versions</h3>
  	    <ul>
  	      <li><a href="http://docs.python.org/2.7/">Python 2.7  
(stable)</a></li>
-	      <li><a href="http://docs.python.org/3.2/">Python 3.2  
(stable)</a></li>
+	      <li><a href="http://docs.python.org/3.4/">Python 3.4 (in  
development)</a></li>
                <li><a href="http://www.python.org/doc/versions/">Old  
versions</a></li>
              </ul>

=======================================
--- /tools/sphinxext/layout.html	Sat Nov 17 18:48:00 2012
+++ /tools/sphinxext/layout.html	Wed Nov 21 20:22:04 2012
@@ -3,19 +3,84 @@
          <li><img src="{{ pathto('_static/py.png', 1) }}" alt=""
                   style="vertical-align: middle; margin-top: -1px"/></li>
          <li><a href="http://www.python.org/">Python</a>{{ reldelim1 }}</li>
-        <li><a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{  
reldelim1 }}</li>
+        <li>
+          {%- if versionswitcher is defined %}
+          <span class="version_switcher_placeholder">{{ release }}</span>
+          <a href="{{ pathto('index') }}">Documentation</a>{{ reldelim1 }}
+          {%- else %}
+          <a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1  
}}
+          {%- endif %}
+        </li>
  {% endblock %}
  {% block extrahead %}
      <link rel="shortcut icon" type="image/png" href="{{  
pathto('_static/py.png', 1) }}" />
      {% if not embedded %}<script type="text/javascript" src="{{  
pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
      {% if not embedded %}<script type="text/javascript" src="{{  
pathto('_static/_jp.js', 1) }}"></script>{% endif %}
+    {% if versionswitcher is defined and not embedded %}<script  
type="text/javascript" src="{{ pathto('_static/version_switch.js', 1)  
}}"></script>{% endif %}
+    {% if pagename == 'whatsnew/changelog' %}
+    <script type="text/javascript">
+      $(document).ready(function() {
+          // add the search form and bind the events
+          $('h1').after([
+            '<p>Filter entries by content:',
+            '<input type="text" value="" id="searchbox" style="width:  
50%">',
+            '<input type="submit" id="searchbox-submit"  
value="Filter"></p>'
+          ].join('\n'));
+
+          function dofilter() {
+              try {
+                  var query = new RegExp($('#searchbox').val(), 'i');
+              }
+              catch (e) {
+                  return; // not a valid regex (yet)
+              }
+              // find headers for the versions (What's new in Python  
X.Y.Z?)
+              $('#changelog h2').each(function(index1, h2) {
+                  var h2_parent = $(h2).parent();
+                  var sections_found = 0;
+                  // find headers for the sections (Core, Library, etc.)
+                  h2_parent.find('h3').each(function(index2, h3) {
+                      var h3_parent = $(h3).parent();
+                      var entries_found = 0;
+                      // find all the entries
+                      h3_parent.find('li').each(function(index3, li) {
+                          var li = $(li);
+                          // check if the query matches the entry
+                          if (query.test(li.text())) {
+                              li.show();
+                              entries_found++;
+                          }
+                          else {
+                              li.hide();
+                          }
+                      });
+                      // if there are entries, show the section, otherwise  
hide it
+                      if (entries_found > 0) {
+                          h3_parent.show();
+                          sections_found++;
+                      }
+                      else {
+                          h3_parent.hide();
+                      }
+                  });
+                  if (sections_found > 0)
+                      h2_parent.show();
+                  else
+                      h2_parent.hide();
+              });
+          }
+          $('#searchbox').keyup(dofilter);
+          $('#searchbox-submit').click(dofilter);
+      });
+    </script>
+    {% endif %}
  {{ super() }}
  {% endblock %}
  {% block footer %}
      <div class="footer">
      &copy; <a href="{{ pathto('copyright') }}">Copyright</a> {{ copyright| 
e }}.
      <br />
-    The Python Software Foundation is a non-profit corporation.
+    The Python Software Foundation is a non-profit corporation.
      <a href="http://www.python.org/psf/donations/">Please donate.</a>
      <br />
      Last updated on {{ last_updated|e }}.
@@ -27,7 +92,6 @@
      によって翻訳されました。
      <a href="http://code.google.com/p/python-doc-ja/issues/list">誤訳を報告 
する。</a>
      </div>
-
  {% endblock %}
  {% block sidebarsourcelink %}
  {%- if show_source and has_source and sourcename %}
=======================================
--- /tools/sphinxext/pyspecific.py	Fri Oct 12 19:45:31 2012
+++ /tools/sphinxext/pyspecific.py	Wed Nov 21 20:22:04 2012
@@ -33,9 +33,38 @@
      self.body.append('<span class="versionmodified">%s</span> ' % text)

  from sphinx.writers.html import HTMLTranslator
+from sphinx.writers.latex import LaTeXTranslator
  from sphinx.locale import versionlabels
  HTMLTranslator.visit_versionmodified = new_visit_versionmodified
+HTMLTranslator.visit_versionmodified = new_visit_versionmodified

+# monkey-patch HTML and LaTeX translators to keep doctest blocks in the
+# doctest docs themselves
+orig_visit_literal_block = HTMLTranslator.visit_literal_block
+def new_visit_literal_block(self, node):
+    meta = self.builder.env.metadata[self.builder.current_docname]
+    old_trim_doctest_flags = self.highlighter.trim_doctest_flags
+    if 'keepdoctest' in meta:
+        self.highlighter.trim_doctest_flags = False
+    try:
+        orig_visit_literal_block(self, node)
+    finally:
+        self.highlighter.trim_doctest_flags = old_trim_doctest_flags
+
+HTMLTranslator.visit_literal_block = new_visit_literal_block
+
+orig_depart_literal_block = LaTeXTranslator.depart_literal_block
+def new_depart_literal_block(self, node):
+    meta = self.builder.env.metadata[self.curfilestack[-1]]
+    old_trim_doctest_flags = self.highlighter.trim_doctest_flags
+    if 'keepdoctest' in meta:
+        self.highlighter.trim_doctest_flags = False
+    try:
+        orig_depart_literal_block(self, node)
+    finally:
+        self.highlighter.trim_doctest_flags = old_trim_doctest_flags
+
+LaTeXTranslator.depart_literal_block = new_depart_literal_block

  # Support for marking up and linking to bugs.python.org issues

@@ -145,6 +174,47 @@
          return ret


+# Support for including Misc/NEWS
+
+import re
+import codecs
+
+issue_re = re.compile('([Ii])ssue #([0-9]+)')
+whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
+
+class MiscNews(Directive):
+    has_content = False
+    required_arguments = 1
+    optional_arguments = 0
+    final_argument_whitespace = False
+    option_spec = {}
+
+    def run(self):
+        fname = self.arguments[0]
+        source = self.state_machine.input_lines.source(
+            self.lineno - self.state_machine.input_offset - 1)
+        source_dir = path.dirname(path.abspath(source))
+        fpath = path.join(source_dir, fname)
+        self.state.document.settings.record_dependencies.add(fpath)
+        try:
+            fp = codecs.open(fpath, encoding='utf-8')
+            try:
+                content = fp.read()
+            finally:
+                fp.close()
+        except Exception:
+            text = 'The NEWS file is not available.'
+            node = nodes.strong(text, text)
+            return [node]
+        content = issue_re.sub(r'`\1ssue #\2  
<http://bugs.python.org/\2>`__',
+                               content)
+        content = whatsnew_re.sub(r'\1', content)
+        # remove first 3 lines as they are the main heading
+        lines = ['.. default-role:: obj', ''] + content.splitlines()[3:]
+        self.state_machine.insert_input(lines, fname)
+        return []
+
+
  # Support for building "topic help" for pydoc

  pydoc_topic_labels = [
@@ -276,3 +346,4 @@
      app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)')
      app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
      app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
+    app.add_directive('miscnews', MiscNews)
=======================================
--- /tools/sphinxext/susp-ignored.csv	Fri Oct 12 19:45:31 2012
+++ /tools/sphinxext/susp-ignored.csv	Wed Nov 21 20:22:04 2012
@@ -124,9 +124,8 @@
  library/functions,,:stop,"a[start:stop, i]"
  library/functions,,:stop,a[start:stop:step]
  library/hotshot,,:lineno,"ncalls  tottime  percall  cumtime  percall  
filename:lineno(function)"
-library/http.client,52,:port,host:port
+library/http.client,,:port,host:port
  library/http.cookies,,`,!#$%&'*+-.^_`|~:
-library/httplib,,:port,host:port
  library/imaplib,,:MM,"""DD-Mmm-YYYY HH:MM:SS"
  library/imaplib,,:SS,"""DD-Mmm-YYYY HH:MM:SS"
  library/inspect,,:int,">>> def foo(a, *, b:int, **kwargs):"
@@ -358,3 +357,15 @@
  whatsnew/3.2,,:location,zope9-location = ${zope9:location}
  whatsnew/3.2,,:prefix,... zope-conf = ${custom:prefix}/etc/zope.conf
  whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf
+whatsnew/news,,:platform,:platform:
+whatsnew/news,,:password,: Unquote before b64encoding user:password during  
Basic
+whatsnew/news,,:close,Connection:close header.
+whatsnew/news,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised  
UnicodeDecodeError, caused"
+whatsnew/news,,:close,: Connection:close header is sent by requests using  
URLOpener
+whatsnew/news,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead  
of ""localhost""."
+whatsnew/news,,:test,: test_subprocess:test_leaking_fds_on_error no longer  
gives a
+whatsnew/news,,:test,: Fix test_posix:test_getgroups failure under  
Solaris.  Patch
+whatsnew/news,,:Olimit,Drop -OPT:Olimit compiler option.
+whatsnew/news,,:MAXYEAR,timedelta from date or datetime falls outside of  
the MINYEAR:MAXYEAR range.
+whatsnew/news,,:bz2,with mode 'r' or 'r:bz2' and a fileobj argument that  
contained no data or
+whatsnew/news,,:db2,: Add configure option --with-dbmliborder=db1:db2:...  
to specify




Pythonjp-checkins メーリングリストの案内
アーカイブの一覧に戻る