diff --git a/docs/html/_sources/stdlib.txt b/docs/html/_sources/stdlib.txt index 56fc3b4..ed657d6 100644 --- a/docs/html/_sources/stdlib.txt +++ b/docs/html/_sources/stdlib.txt @@ -129,7 +129,7 @@ Python 标准库概览 有几个模块用于访问互联网以及处理网络通信协议。其中最简单的两个是用于处理从 urls 接收的数据的 `urllib2 `_ 以及用于发送电子邮件的 `smtplib `_:: - >>> from urllib2 + >>> import urllib2 >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): ... line = line.decode('utf-8') # Decoding the binary data to text. ... if 'EST' in line or 'EDT' in line: # look for Eastern Time diff --git a/docs/html/_static/basic.css b/docs/html/_static/basic.css index 037fd64..2b513f0 100644 --- a/docs/html/_static/basic.css +++ b/docs/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -52,6 +52,8 @@ div.sphinxsidebar { width: 230px; margin-left: -100%; font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; } div.sphinxsidebar ul { @@ -83,10 +85,6 @@ div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } -div.sphinxsidebar #searchbox input[type="submit"] { - width: 30px; -} - img { border: 0; max-width: 100%; @@ -187,6 +185,13 @@ div.genindex-jumpbox { /* -- general body styles --------------------------------------------------- */ +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + a.headerlink { visibility: hidden; } @@ -525,11 +530,11 @@ div.code-block-caption span.caption-number { div.code-block-caption span.caption-text { } -div.container { +div.literal-block-wrapper { padding: 1em 1em 0; } -div.container div.highlight { +div.literal-block-wrapper div.highlight { margin: 0; } diff --git a/docs/html/_static/doctools.js b/docs/html/_static/doctools.js index 8c9b995..8163495 100644 --- a/docs/html/_static/doctools.js +++ b/docs/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -124,6 +124,7 @@ var Documentation = { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); + }, /** @@ -179,7 +180,7 @@ var Documentation = { * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 */ fixFirefoxAnchorBug : function() { - if (document.location.hash && $.browser.mozilla) + if (document.location.hash) window.setTimeout(function() { document.location.href += ''; }, 10); @@ -252,6 +253,29 @@ var Documentation = { }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); } }; @@ -260,4 +284,4 @@ _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); -}); +}); \ No newline at end of file diff --git a/docs/html/_static/pygments.css b/docs/html/_static/pygments.css index 57eadc0..8213e90 100644 --- a/docs/html/_static/pygments.css +++ b/docs/html/_static/pygments.css @@ -4,8 +4,10 @@ .highlight .err { border: 1px solid #FF0000 } /* Error */ .highlight .k { color: #007020; font-weight: bold } /* Keyword */ .highlight .o { color: #666666 } /* Operator */ +.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ diff --git a/docs/html/_static/searchtools.js b/docs/html/_static/searchtools.js index 6e1f06b..066857c 100644 --- a/docs/html/_static/searchtools.js +++ b/docs/html/_static/searchtools.js @@ -2,14 +2,15 @@ * searchtools.js_t * ~~~~~~~~~~~~~~~~ * - * Sphinx JavaScript utilties for the full-text search. + * Sphinx JavaScript utilities for the full-text search. * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ +/* Non-minified version JS is _stemmer.js if file is provided */ /** * Porter Stemmer */ @@ -373,8 +374,7 @@ var Search = { } // lookup as search terms in fulltext - results = results.concat(this.performTermsSearch(searchterms, excluded, terms, Scorer.term)) - .concat(this.performTermsSearch(searchterms, excluded, titleterms, Scorer.title)); + results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms)); // let the scorer override scores with a custom scoring function if (Scorer.score) { @@ -439,7 +439,7 @@ var Search = { dataType: "text", complete: function(jqxhr, textstatus) { var data = jqxhr.responseText; - if (data !== '') { + if (data !== '' && data !== undefined) { listItem.append(Search.makeSearchSummary(data, searchterms, hlterms)); } Search.output.append(listItem); @@ -538,23 +538,47 @@ var Search = { /** * search for full-text terms in the index */ - performTermsSearch : function(searchterms, excluded, terms, score) { + performTermsSearch : function(searchterms, excluded, terms, titleterms) { var filenames = this._index.filenames; var titles = this._index.titles; - var i, j, file, files; + var i, j, file; var fileMap = {}; + var scoreMap = {}; var results = []; // perform the search on the required terms for (i = 0; i < searchterms.length; i++) { var word = searchterms[i]; + var files = []; + var _o = [ + {files: terms[word], score: Scorer.term}, + {files: titleterms[word], score: Scorer.title} + ]; + // no match but word was a required one - if ((files = terms[word]) === undefined) + if ($u.every(_o, function(o){return o.files === undefined;})) { break; - if (files.length === undefined) { - files = [files]; } + // found search word in contents + $u.each(_o, function(o) { + var _files = o.files; + if (_files === undefined) + return + + if (_files.length === undefined) + _files = [_files]; + files = files.concat(_files); + + // set score for the word in each file to Scorer.term + for (j = 0; j < _files.length; j++) { + file = _files[j]; + if (!(file in scoreMap)) + scoreMap[file] = {} + scoreMap[file][word] = o.score; + } + }); + // create the mapping for (j = 0; j < files.length; j++) { file = files[j]; @@ -576,7 +600,9 @@ var Search = { // ensure that none of the excluded terms is in the search result for (i = 0; i < excluded.length; i++) { if (terms[excluded[i]] == file || - $u.contains(terms[excluded[i]] || [], file)) { + titleterms[excluded[i]] == file || + $u.contains(terms[excluded[i]] || [], file) || + $u.contains(titleterms[excluded[i]] || [], file)) { valid = false; break; } @@ -584,6 +610,9 @@ var Search = { // if we have still a valid result we can add it to the result list if (valid) { + // select one (max) score for the file. + // for better ranking, we should calculate ranking by using words statistics like basic tf-idf... + var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]})); results.push([filenames[file], titles[file], '', null, score]); } } @@ -594,7 +623,7 @@ var Search = { * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words, hlwords is the list of normal, unstemmed - * words. the first one is used to find the occurance, the + * words. the first one is used to find the occurrence, the * latter for highlighting it. */ makeSearchSummary : function(text, keywords, hlwords) { diff --git a/docs/html/_static/websupport.js b/docs/html/_static/websupport.js index 79ed10e..98e7f40 100644 --- a/docs/html/_static/websupport.js +++ b/docs/html/_static/websupport.js @@ -2,9 +2,9 @@ * websupport.js * ~~~~~~~~~~~~~ * - * sphinx.websupport utilties for all documentation. + * sphinx.websupport utilities for all documentation. * - * :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ diff --git a/docs/html/appendix.html b/docs/html/appendix.html index d6e675b..6fdcd55 100644 --- a/docs/html/appendix.html +++ b/docs/html/appendix.html @@ -7,7 +7,7 @@ - 15. 附录 — Python tutorial 2.7.11 2.7.11 documentation + 15. 附录 — Python tutorial 2.7.13 2.7.13 documentation @@ -28,7 +28,7 @@ - + @@ -44,7 +44,7 @@