diff options
| author | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2013-03-10 10:18:38 +0900 |
|---|---|---|
| committer | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2013-03-10 10:18:38 +0900 |
| commit | 19760d6050fe86dceced397c1f7946d743584be3 (patch) | |
| tree | 80dee71b9bf76be0de2f0876915f4e2a08680543 /sphinx | |
| parent | 9ec37e6f9628ca6b3c84af95b95c489a28a6b60d (diff) | |
| parent | a46049c89362b5045b1bad894f33fd89f3b60157 (diff) | |
| download | sphinx-19760d6050fe86dceced397c1f7946d743584be3.tar.gz | |
Merged in r_rudi/sphinx (pull request #122)
move "copy additional files" after "copying TeX support files" in latex builder.
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/directives/code.py | 5 | ||||
| -rw-r--r-- | sphinx/writers/text.py | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 6fb21d14..0d04c906 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -122,11 +122,11 @@ class LiteralInclude(Directive): encoding = self.options.get('encoding', env.config.source_encoding) codec_info = codecs.lookup(encoding) + f = None try: f = codecs.StreamReaderWriter(open(filename, 'rb'), codec_info[2], codec_info[3], 'strict') lines = f.readlines() - f.close() except (IOError, OSError): return [document.reporter.warning( 'Include file %r not found or reading it failed' % filename, @@ -136,6 +136,9 @@ class LiteralInclude(Directive): 'Encoding %r used for reading included file %r seems to ' 'be wrong, try giving an :encoding: option' % (encoding, filename))] + finally: + if f is not None: + f.close() objectname = self.options.get('pyobject') if objectname is not None: diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 9df97407..96576911 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -199,9 +199,14 @@ class TextTranslator(nodes.NodeVisitor): do_format() if first is not None and result: itemindent, item = result[0] + result_rest, result = result[1:], [] if item: - result.insert(0, (itemindent - indent, [first + item[0]])) - result[1] = (itemindent, item[1:]) + toformat = [first + ' '.join(item)] + do_format() #re-create `result` from `toformat` + _dummy, new_item = result[0] + result.insert(0, (itemindent - indent, [new_item[0]])) + result[1] = (itemindent, new_item[1:]) + result.extend(result_rest) self.states[-1].extend(result) def visit_document(self, node): @@ -572,11 +577,11 @@ class TextTranslator(nodes.NodeVisitor): self.new_state(len(str(self.list_counter[-1])) + 2) def depart_list_item(self, node): if self.list_counter[-1] == -1: - self.end_state(first='* ', end=None) + self.end_state(first='* ') elif self.list_counter[-1] == -2: pass else: - self.end_state(first='%s. ' % self.list_counter[-1], end=None) + self.end_state(first='%s. ' % self.list_counter[-1]) def visit_definition_list_item(self, node): self._li_has_classifier = len(node) >= 2 and \ |
