[Python-checkins] r67142 - in doctools/trunk/sphinx: directives/other.py environment.py latexwriter.py static/default.css util/compat.py
georg.brandl
python-checkins at python.org
Fri Nov 7 09:12:30 CET 2008
Author: georg.brandl
Date: Fri Nov 7 09:12:29 2008
New Revision: 67142
Log:
Copy fixes from Hg until 724:bebba06f30d2.
Modified:
doctools/trunk/sphinx/directives/other.py
doctools/trunk/sphinx/environment.py
doctools/trunk/sphinx/latexwriter.py
doctools/trunk/sphinx/static/default.css
doctools/trunk/sphinx/util/compat.py
Modified: doctools/trunk/sphinx/directives/other.py
==============================================================================
--- doctools/trunk/sphinx/directives/other.py (original)
+++ doctools/trunk/sphinx/directives/other.py Fri Nov 7 09:12:29 2008
@@ -229,15 +229,16 @@
def seealso_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
- seealsonode = make_admonition(
+ ret = make_admonition(
addnodes.seealso, name, [_('See also')], options, content,
lineno, content_offset, block_text, state, state_machine)
if arguments:
argnodes, msgs = state.inline_text(arguments[0], lineno)
para = nodes.paragraph()
para += argnodes
- seealsonode[1:1] = [para] + msgs
- return [seealsonode]
+ para += msgs
+ ret[0].insert(1, para)
+ return ret
seealso_directive.content = 1
seealso_directive.arguments = (0, 1, 1)
Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py (original)
+++ doctools/trunk/sphinx/environment.py Fri Nov 7 09:12:29 2008
@@ -32,7 +32,7 @@
from docutils import nodes
from docutils.io import FileInput, NullOutput
from docutils.core import Publisher
-from docutils.utils import Reporter
+from docutils.utils import Reporter, relative_path
from docutils.readers import standalone
from docutils.parsers.rst import roles
from docutils.parsers.rst.languages import en as english
@@ -619,19 +619,22 @@
node['uri'] = imgpath
if imgpath.endswith(os.extsep + '*'):
for filename in glob(path.join(self.srcdir, imgpath)):
- dir, base = path.split(filename)
- if base.lower().endswith('.pdf'):
- candidates['application/pdf'] = path.join(docdir, base)
- elif base.lower().endswith('.svg'):
- candidates['image/svg+xml'] = path.join(docdir, base)
+ relname = relative_path(self.srcdir, filename)
+ if filename.lower().endswith('.pdf'):
+ candidates['application/pdf'] = path.join(docdir, relname)
+ elif filename.lower().endswith('.svg'):
+ candidates['image/svg+xml'] = path.join(docdir, relname)
else:
- f = open(filename, 'rb')
try:
- imgtype = imghdr.what(f)
- finally:
- f.close()
+ f = open(filename, 'rb')
+ try:
+ imgtype = imghdr.what(f)
+ finally:
+ f.close()
+ except (OSError, IOError):
+ self.warn(docname, 'Image file %s not readable' % filename)
if imgtype:
- candidates['image/' + imgtype] = path.join(docdir, base)
+ candidates['image/' + imgtype] = path.join(docdir, relname)
else:
candidates['*'] = imgpath
for imgpath in candidates.itervalues():
Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py (original)
+++ doctools/trunk/sphinx/latexwriter.py Fri Nov 7 09:12:29 2008
@@ -877,6 +877,7 @@
raise nodes.SkipNode
def visit_reference(self, node):
+ print node
uri = node.get('refuri', '')
if self.in_title or not uri:
self.context.append('')
Modified: doctools/trunk/sphinx/static/default.css
==============================================================================
--- doctools/trunk/sphinx/static/default.css (original)
+++ doctools/trunk/sphinx/static/default.css Fri Nov 7 09:12:29 2008
@@ -618,7 +618,7 @@
margin-bottom: 0;
}
-div.admonition p {
+div.admonition p.admonition-title + p {
display: inline;
}
Modified: doctools/trunk/sphinx/util/compat.py
==============================================================================
--- doctools/trunk/sphinx/util/compat.py (original)
+++ doctools/trunk/sphinx/util/compat.py Fri Nov 7 09:12:29 2008
@@ -15,11 +15,11 @@
# function missing in 0.5 SVN
def make_admonition(node_class, name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
- if not content:
- error = state_machine.reporter.error(
- 'The "%s" admonition is empty; content required.' % (name),
- nodes.literal_block(block_text, block_text), line=lineno)
- return [error]
+ #if not content:
+ # error = state_machine.reporter.error(
+ # 'The "%s" admonition is empty; content required.' % (name),
+ # nodes.literal_block(block_text, block_text), line=lineno)
+ # return [error]
text = '\n'.join(content)
admonition_node = node_class(text)
if arguments:
@@ -33,5 +33,5 @@
classes = ['admonition-' + nodes.make_id(title_text)]
admonition_node['classes'] += classes
state.nested_parse(content, content_offset, admonition_node)
- return admonition_node
+ return [admonition_node]
More information about the Python-checkins
mailing list