summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-24 12:57:07 +0200
committerGeorg Brandl <georg@python.org>2010-05-24 12:57:07 +0200
commit980c0782ae573b97163e06feaf94811d7ad58927 (patch)
treed381671d66895cf8a5dd8a599de9459a3a39763c /sphinx
parentd20fca253699e3d85e66e4d203fb5b2a95ee23a4 (diff)
parentbfc13ad26a4eacd0396942cf4b94bda8bffe2549 (diff)
downloadsphinx-980c0782ae573b97163e06feaf94811d7ad58927.tar.gz
Merge with http://bitbucket.org/tpowers/sphinx/ (rewriting the external/internal distinction code)
In HTML output, references now get the class ``internal`` if they are internal to the whole project, as opposed to internal to the current page. The ``menuselection`` and ``guilabel`` roles now support ampersand accelerators.
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/builders/html.py40
-rw-r--r--sphinx/builders/htmlhelp.py9
-rw-r--r--sphinx/builders/linkcheck.py4
-rw-r--r--sphinx/builders/qthelp.py82
-rw-r--r--sphinx/config.py2
-rw-r--r--sphinx/directives/code.py4
-rw-r--r--sphinx/domains/__init__.py18
-rw-r--r--sphinx/domains/c.py12
-rw-r--r--sphinx/domains/cpp.py13
-rw-r--r--sphinx/domains/javascript.py11
-rw-r--r--sphinx/domains/python.py7
-rw-r--r--sphinx/domains/rst.py6
-rw-r--r--sphinx/domains/std.py128
-rw-r--r--sphinx/environment.py134
-rw-r--r--sphinx/ext/extlinks.py2
-rw-r--r--sphinx/ext/intersphinx.py61
-rw-r--r--sphinx/ext/pngmath.py10
-rw-r--r--sphinx/ext/todo.py3
-rw-r--r--sphinx/locale/__init__.py3
-rw-r--r--sphinx/locale/ca/LC_MESSAGES/sphinx.mobin8114 -> 8114 bytes
-rw-r--r--sphinx/locale/cs/LC_MESSAGES/sphinx.mobin7926 -> 7926 bytes
-rw-r--r--sphinx/locale/de/LC_MESSAGES/sphinx.mobin8276 -> 8276 bytes
-rw-r--r--sphinx/locale/es/LC_MESSAGES/sphinx.mobin6919 -> 6919 bytes
-rw-r--r--sphinx/locale/fi/LC_MESSAGES/sphinx.mobin7599 -> 7644 bytes
-rw-r--r--sphinx/locale/fi/LC_MESSAGES/sphinx.po4
-rw-r--r--sphinx/locale/fr/LC_MESSAGES/sphinx.mobin7626 -> 7626 bytes
-rw-r--r--sphinx/locale/hr/LC_MESSAGES/sphinx.js1
-rw-r--r--sphinx/locale/hr/LC_MESSAGES/sphinx.mobin0 -> 8133 bytes
-rw-r--r--sphinx/locale/hr/LC_MESSAGES/sphinx.po606
-rw-r--r--sphinx/locale/it/LC_MESSAGES/sphinx.mobin8243 -> 8243 bytes
-rw-r--r--sphinx/locale/ja/LC_MESSAGES/sphinx.mobin7647 -> 7647 bytes
-rw-r--r--sphinx/locale/nl/LC_MESSAGES/sphinx.mobin8159 -> 8159 bytes
-rw-r--r--sphinx/locale/pl/LC_MESSAGES/sphinx.mobin8291 -> 8291 bytes
-rw-r--r--sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mobin7582 -> 7582 bytes
-rw-r--r--sphinx/locale/ru/LC_MESSAGES/sphinx.mobin10230 -> 10230 bytes
-rw-r--r--sphinx/locale/sl/LC_MESSAGES/sphinx.mobin8046 -> 8056 bytes
-rw-r--r--sphinx/locale/sl/LC_MESSAGES/sphinx.po54
-rw-r--r--sphinx/locale/tr/LC_MESSAGES/sphinx.mobin8333 -> 8333 bytes
-rw-r--r--sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mobin9911 -> 9911 bytes
-rw-r--r--sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mobin7657 -> 7657 bytes
-rw-r--r--sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mobin7732 -> 7732 bytes
-rw-r--r--sphinx/quickstart.py4
-rw-r--r--sphinx/roles.py39
-rw-r--r--sphinx/search.py7
-rw-r--r--sphinx/setup_command.py18
-rw-r--r--sphinx/texinputs/sphinxhowto.cls8
-rw-r--r--sphinx/texinputs/sphinxmanual.cls9
-rw-r--r--sphinx/themes/basic/static/basic.css30
-rw-r--r--sphinx/themes/basic/static/searchtools.js12
-rw-r--r--sphinx/themes/default/static/default.css_t38
-rw-r--r--sphinx/themes/default/theme.conf2
-rw-r--r--sphinx/util/nodes.py2
-rw-r--r--sphinx/writers/html.py35
-rw-r--r--sphinx/writers/latex.py18
54 files changed, 1046 insertions, 390 deletions
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index 7d6a1f52..94665dcf 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -10,6 +10,7 @@
"""
import os
+import sys
import zlib
import codecs
import posixpath
@@ -107,10 +108,15 @@ class StandaloneHTMLBuilder(Builder):
self.link_suffix = self.out_suffix
if self.config.language is not None:
- jsfile = path.join(package_dir, 'locale', self.config.language,
- 'LC_MESSAGES', 'sphinx.js')
- if path.isfile(jsfile):
- self.script_files.append('_static/translations.js')
+ jsfile_list = [path.join(package_dir, 'locale',
+ self.config.language, 'LC_MESSAGES', 'sphinx.js'),
+ path.join(sys.prefix, 'share/sphinx/locale',
+ self.config.language, 'sphinx.js')]
+
+ for jsfile in jsfile_list:
+ if path.isfile(jsfile):
+ self.script_files.append('_static/translations.js')
+ break
def get_theme_config(self):
return self.config.html_theme, self.config.html_theme_options
@@ -526,11 +532,15 @@ class StandaloneHTMLBuilder(Builder):
f.close()
# then, copy translations JavaScript file
if self.config.language is not None:
- jsfile = path.join(package_dir, 'locale', self.config.language,
- 'LC_MESSAGES', 'sphinx.js')
- if path.isfile(jsfile):
- copyfile(jsfile, path.join(self.outdir, '_static',
- 'translations.js'))
+ jsfile_list = [path.join(package_dir, 'locale',
+ self.config.language, 'LC_MESSAGES', 'sphinx.js'),
+ path.join(sys.prefix, 'share/sphinx/locale',
+ self.config.language, 'sphinx.js')]
+ for jsfile in jsfile_list:
+ if path.isfile(jsfile):
+ copyfile(jsfile, path.join(self.outdir, '_static',
+ 'translations.js'))
+ break
# then, copy over theme-supplied static files
if self.theme:
themeentries = [path.join(themepath, 'static')
@@ -597,7 +607,7 @@ class StandaloneHTMLBuilder(Builder):
# the parent node here.
continue
uri = node['uri']
- reference = nodes.reference()
+ reference = nodes.reference('', '', internal=True)
if uri in self.images:
reference['refuri'] = posixpath.join(self.imgpath,
self.images[uri])
@@ -732,13 +742,17 @@ class StandaloneHTMLBuilder(Builder):
f.write('# The remainder of this file is compressed using zlib.\n')
compressor = zlib.compressobj(9)
for domainname, domain in self.env.domains.iteritems():
- for name, type, docname, anchor, prio in domain.get_objects():
+ for name, dispname, type, docname, anchor, prio in \
+ domain.get_objects():
if anchor.endswith(name):
# this can shorten the inventory by as much as 25%
anchor = anchor[:-len(name)] + '$'
+ uri = self.get_target_uri(docname) + '#' + anchor
+ if dispname == name:
+ dispname = '-'
f.write(compressor.compress(
- '%s %s:%s %s %s\n' % (name, domainname, type, prio,
- self.get_target_uri(docname) + '#' + anchor)))
+ '%s %s:%s %s %s %s\n' % (name, domainname, type, prio,
+ uri, dispname)))
f.write(compressor.flush())
finally:
f.close()
diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py
index 9bbe0a5d..538f4c84 100644
--- a/sphinx/builders/htmlhelp.py
+++ b/sphinx/builders/htmlhelp.py
@@ -18,7 +18,6 @@ from os import path
from docutils import nodes
from sphinx import addnodes
-from sphinx.locale import _
from sphinx.builders.html import StandaloneHTMLBuilder
@@ -58,7 +57,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder
project_template = '''\
[OPTIONS]
-Binary TOC=Yes
+Binary TOC=No
Binary Index=No
Compiled file=%(outname)s.chm
Contents file=%(outname)s.hhc
@@ -217,9 +216,9 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder):
# special books
f.write('<LI> ' + object_sitemap % (self.config.html_short_title,
'index.html'))
- for index in self.domain_indices:
- f.write('<LI> ' + object_sitemap % (index[2],
- '%s-%s.html' % index[0:2]))
+ for indexname, indexcls, content, collapse in self.domain_indices:
+ f.write('<LI> ' + object_sitemap % (indexcls.localname,
+ '%s.html' % indexname))
# the TOC
tocdoc = self.env.get_and_resolve_doctree(
self.config.master_doc, self, prune_toctrees=False)
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index 3f9f16d9..c9bc363d 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -65,8 +65,10 @@ class CheckExternalLinksBuilder(Builder):
return
lineno = None
- while lineno is None and node:
+ while lineno is None:
node = node.parent
+ if node is None:
+ break
lineno = node.line
if uri[0:5] == 'http:' or uri[0:6] == 'https:':
diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py
index 72708803..ffc52334 100644
--- a/sphinx/builders/qthelp.py
+++ b/sphinx/builders/qthelp.py
@@ -11,16 +11,17 @@
import os
import re
-import cgi
import codecs
+import posixpath
from os import path
+from cgi import escape
from docutils import nodes
from sphinx import addnodes
-from sphinx.locale import _
from sphinx.builders.html import StandaloneHTMLBuilder
+
_idpattern = re.compile(
r'(?P<title>.+) (\((?P<id>[\w\.]+)( (?P<descr>\w+))?\))$')
@@ -33,6 +34,11 @@ _idpattern = re.compile(
collection_template = u'''\
<?xml version="1.0" encoding="utf-8" ?>
<QHelpCollectionProject version="1.0">
+ <assistant>
+ <title>%(title)s</title>
+ <homePage>%(homepage)s</homePage>
+ <startPage>%(startpage)s</startPage>
+ </assistant>
<docFiles>
<generate>
<file>
@@ -53,9 +59,9 @@ collection_template = u'''\
# actual documentation files (*.html).
# In addition it defines a unique namespace for the documentation.
project_template = u'''\
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="utf-8" ?>
<QtHelpProject version="1.0">
- <namespace>%(outname)s.org.%(outname)s.%(nversion)s</namespace>
+ <namespace>%(namespace)s</namespace>
<virtualFolder>doc</virtualFolder>
<customFilter name="%(project)s %(version)s">
<filterAttribute>%(outname)s</filterAttribute>
@@ -106,17 +112,8 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
#self.config.html_style = 'traditional.css'
def handle_finish(self):
- self.build_qhcp(self.outdir, self.config.qthelp_basename)
self.build_qhp(self.outdir, self.config.qthelp_basename)
- def build_qhcp(self, outdir, outname):
- self.info('writing collection project file...')
- f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8')
- try:
- f.write(collection_template % {'outname': outname})
- finally:
- f.close()
-
def build_qhp(self, outdir, outname):
self.info('writing project file...')
@@ -130,9 +127,9 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
for node in tocdoc.traverse(istoctree):
sections.extend(self.write_toc(node))
- for index in self.domain_indices:
- item = section_template % {'title': index[2],
- 'ref': '%s-%s.html' % index[0:2]}
+ for indexname, indexcls, content, collapse in self.domain_indices:
+ item = section_template % {'title': indexcls.localname,
+ 'ref': '%s.html' % indexname}
sections.append(' '*4*4 + item)
sections = '\n'.join(sections)
@@ -158,24 +155,45 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
if (resourcedir and not fn.endswith('.js')) or \
fn.endswith('.html'):
filename = path.join(root, fn)[olen:]
- #filename = filename.replace(os.sep, '\\') # XXX
- projectfiles.append(file_template % {'filename': filename})
+ projectfiles.append(file_template %
+ {'filename': escape(filename)})
projectfiles = '\n'.join(projectfiles)
+ # it seems that the "namespace" may not contain non-alphanumeric
+ # characters, and more than one successive dot, or leading/trailing
+ # dots, are also forbidden
+ nspace = 'org.sphinx.%s.%s' % (outname, self.config.version)
+ nspace = re.sub('[^a-zA-Z0-9.]', '', nspace)
+ nspace = re.sub(r'\.+', '.', nspace).strip('.')
+
# write the project file
f = codecs.open(path.join(outdir, outname+'.qhp'), 'w', 'utf-8')
try:
- nversion = self.config.version.replace('.', '_')
- nversion = nversion.replace(' ', '_')
- f.write(project_template % {'outname': outname,
- 'title': self.config.html_title,
- 'version': self.config.version,
- 'project': self.config.project,
- 'nversion': nversion,
- 'masterdoc': self.config.master_doc,
- 'sections': sections,
- 'keywords': keywords,
- 'files': projectfiles})
+ f.write(project_template % {
+ 'outname': escape(outname),
+ 'title': escape(self.config.html_title),
+ 'version': escape(self.config.version),
+ 'project': escape(self.config.project),
+ 'namespace': escape(nspace),
+ 'masterdoc': escape(self.config.master_doc),
+ 'sections': sections,
+ 'keywords': keywords,
+ 'files': projectfiles})
+ finally:
+ f.close()
+
+ homepage = 'qthelp://' + posixpath.join(
+ nspace, 'doc', self.get_target_uri(self.config.master_doc))
+ startpage = 'qthelp://' + posixpath.join(nspace, 'doc', 'index.html')
+
+ self.info('writing collection project file...')
+ f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8')
+ try:
+ f.write(collection_template % {
+ 'outname': escape(outname),
+ 'title': escape(self.config.html_short_title),
+ 'homepage': escape(homepage),
+ 'startpage': escape(startpage)})
finally:
f.close()
@@ -197,7 +215,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
if self.isdocnode(node):
refnode = node.children[0][0]
link = refnode['refuri']
- title = cgi.escape(refnode.astext()).replace('"','&quot;')
+ title = escape(refnode.astext()).replace('"','&quot;')
item = '<section title="%(title)s" ref="%(ref)s">' % {
'title': title,
'ref': link}
@@ -210,7 +228,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
parts.extend(self.write_toc(subnode, indentlevel))
elif isinstance(node, nodes.reference):
link = node['refuri']
- title = cgi.escape(node.astext()).replace('"','&quot;')
+ title = escape(node.astext()).replace('"','&quot;')
item = section_template % {'title': title, 'ref': link}
item = ' '*4*indentlevel + item.encode('ascii', 'xmlcharrefreplace')
parts.append(item.encode('ascii', 'xmlcharrefreplace'))
@@ -247,7 +265,7 @@ class QtHelpBuilder(StandaloneHTMLBuilder):
def build_keywords(self, title, refs, subitems):
keywords = []
- title = cgi.escape(title)
+ title = escape(title)
# if len(refs) == 0: # XXX
# write_param('See Also', title)
if len(refs) == 1:
diff --git a/sphinx/config.py b/sphinx/config.py
index e9de2970..806025b9 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -61,7 +61,7 @@ class Config(object):
rst_epilog = (None, 'env'),
rst_prolog = (None, 'env'),
trim_doctest_flags = (True, 'env'),
- default_domain = ('py', 'env'),
+ primary_domain = ('py', 'env'),
needs_sphinx = (None, None),
nitpicky = (False, 'env'),
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 5497a365..d82dd76d 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -117,8 +117,10 @@ class LiteralInclude(Directive):
line=self.lineno)]
encoding = self.options.get('encoding', env.config.source_encoding)
+ codec_info = codecs.lookup(encoding)
try:
- f = codecs.open(fn, 'rU', encoding)
+ f = codecs.StreamReaderWriter(open(fn, 'U'),
+ codec_info.streamreader, codec_info.streamwriter, 'strict')
lines = f.readlines()
f.close()
except (IOError, OSError):
diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py
index 64306b70..d133a812 100644
--- a/sphinx/domains/__init__.py
+++ b/sphinx/domains/__init__.py
@@ -11,6 +11,7 @@
"""
from sphinx.errors import SphinxError
+from sphinx.locale import _
class ObjType(object):
@@ -21,7 +22,7 @@ class ObjType(object):
Constructor arguments:
- - *lname*: localized name of the type
+ - *lname*: localized name of the type (do not include domain name)
- *roles*: all the roles that can refer to an object of this type
- *attrs*: object attributes -- currently only "searchprio" is known,
which defines the object's priority in the full-text search index,
@@ -199,6 +200,12 @@ class Domain(object):
"""
pass
+ def process_doc(self, env, docname, document):
+ """
+ Process a document after it is read by the environment.
+ """
+ pass
+
def resolve_xref(self, env, fromdocname, builder,
typ, target, node, contnode):
"""
@@ -223,6 +230,7 @@ class Domain(object):
five items:
* `name` -- fully qualified name
+ * `dispname` -- name to display when searching/linking
* `type` -- object type, a key in ``self.object_types``
* `docname` -- the document where it is to be found
* `anchor` -- the anchor name for the object
@@ -236,6 +244,14 @@ class Domain(object):
"""
return []
+ def get_type_name(self, type, primary=False):
+ """
+ Return full name for given ObjType.
+ """
+ if primary:
+ return type.lname
+ return _('%s %s') % (self.label, type.lname)
+
from sphinx.domains.c import CDomain
from sphinx.domains.cpp import CPPDomain
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py
index 1edec525..c49dc284 100644
--- a/sphinx/domains/c.py
+++ b/sphinx/domains/c.py
@@ -168,11 +168,11 @@ class CDomain(Domain):
name = 'c'
label = 'C'
object_types = {
- 'function': ObjType(l_('C function'), 'func'),
- 'member': ObjType(l_('C member'), 'member'),
- 'macro': ObjType(l_('C macro'), 'macro'),
- 'type': ObjType(l_('C type'), 'type'),
- 'var': ObjType(l_('C variable'), 'data'),
+ 'function': ObjType(l_('function'), 'func'),
+ 'member': ObjType(l_('member'), 'member'),
+ 'macro': ObjType(l_('macro'), 'macro'),
+ 'type': ObjType(l_('type'), 'type'),
+ 'var': ObjType(l_('variable'), 'data'),
}
directives = {
@@ -210,4 +210,4 @@ class CDomain(Domain):
def get_objects(self):
for refname, (docname, type) in self.data['objects'].iteritems():
- yield (refname, type, docname, refname, 1)
+ yield (refname, refname, type, docname, refname, 1)
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index 22b63953..62dec4ac 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -10,7 +10,6 @@
"""
import re
-import string
from copy import deepcopy
from docutils import nodes
@@ -22,7 +21,7 @@ from sphinx.domains import Domain, ObjType
from sphinx.directives import ObjectDescription
from sphinx.util.nodes import make_refnode
from sphinx.util.compat import Directive
-from sphinx.util.docfields import Field, TypedField
+from sphinx.util.docfields import TypedField
_identifier_re = re.compile(r'\b(~?[a-zA-Z_][a-zA-Z0-9_]*)\b')
@@ -1028,10 +1027,10 @@ class CPPDomain(Domain):
name = 'cpp'
label = 'C++'
object_types = {
- 'class': ObjType(l_('C++ class'), 'class'),
- 'function': ObjType(l_('C++ function'), 'func'),
- 'member': ObjType(l_('C++ member'), 'member'),
- 'type': ObjType(l_('C++ type'), 'type')
+ 'class': ObjType(l_('class'), 'class'),
+ 'function': ObjType(l_('function'), 'func'),
+ 'member': ObjType(l_('member'), 'member'),
+ 'type': ObjType(l_('type'), 'type')
}
directives = {
@@ -1094,4 +1093,4 @@ class CPPDomain(Domain):
def get_objects(self):
for refname, (docname, type) in self.data['objects'].iteritems():
- yield (refname, type, docname, refname, 1)
+ yield (refname, refname, type, docname, refname, 1)
diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py
index a3a4abec..31a76987 100644
--- a/sphinx/domains/javascript.py
+++ b/sphinx/domains/javascript.py
@@ -8,7 +8,6 @@
:copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
-import re
from sphinx import addnodes
from sphinx.domains import Domain, ObjType
@@ -93,7 +92,7 @@ class JSObject(ObjectDescription):
fullname = name_obj[0]
if fullname not in self.state.document.ids:
signode['names'].append(fullname)
- signode['ids'].append(fullname)
+ signode['ids'].append(fullname.replace('$', '_S_'))
signode['first'] = not self.names
self.state.document.note_explicit_target(signode)
objects = self.env.domaindata['js']['objects']
@@ -164,9 +163,9 @@ class JavaScriptDomain(Domain):
label = 'JavaScript'
# if you add a new object type make sure to edit JSObject.get_index_string
object_types = {
- 'function': ObjType(l_('JavaScript function'), 'func'),
- 'data': ObjType(l_('JavaScript data'), 'data'),
- 'attribute': ObjType(l_('JavaScript attribute'), 'attr'),
+ 'function': ObjType(l_('function'), 'func'),
+ 'data': ObjType(l_('data'), 'data'),
+ 'attribute': ObjType(l_('attribute'), 'attr'),
}
directives = {
'function': JSCallable,
@@ -215,4 +214,4 @@ class JavaScriptDomain(Domain):
def get_objects(self):
for refname, (docname, type) in self.data['objects'].iteritems():
- yield refname, type, docname, refname, 1
+ yield refname, refname, type, docname, refname, 1
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index de1ab84c..b97b9b42 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -188,7 +188,8 @@ class PyObject(ObjectDescription):
self.env.docname,
'duplicate object description of %s, ' % fullname +
'other instance in ' +
- self.env.doc2path(objects[fullname][0]),
+ self.env.doc2path(objects[fullname][0]) +
+ ', use :noindex: for one of them',
self.lineno)
objects[fullname] = (self.env.docname, self.objtype)
@@ -616,6 +617,6 @@ class PythonDomain(Domain):
def get_objects(self):
for modname, info in self.data['modules'].iteritems():
- yield (modname, 'module', info[0], 'module-' + modname, 0)
+ yield (modname, modname, 'module', info[0], 'module-' + modname, 0)
for refname, (docname, type) in self.data['objects'].iteritems():
- yield (refname, type, docname, refname, 1)
+ yield (refname, refname, type, docname, refname, 1)
diff --git a/sphinx/domains/rst.py b/sphinx/domains/rst.py
index 8578a84a..5c25e085 100644
--- a/sphinx/domains/rst.py
+++ b/sphinx/domains/rst.py
@@ -100,8 +100,8 @@ class ReSTDomain(Domain):
label = 'reStructuredText'
object_types = {
- 'directive': ObjType(l_('reStructuredText directive'), 'dir'),
- 'role': ObjType(l_('reStructuredText role'), 'role'),
+ 'directive': ObjType(l_('directive'), 'dir'),
+ 'role': ObjType(l_('role'), 'role'),
}
directives = {
'directive': ReSTDirective,
@@ -131,4 +131,4 @@ class ReSTDomain(Domain):
def get_objects(self):
for (typ, name), docname in self.data['objects'].iteritems():
- yield name, typ, docname, name, 1
+ yield name, name, typ, docname, name, 1
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 3d617e1d..68bff15e 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -20,7 +20,7 @@ from sphinx.locale import l_, _
from sphinx.domains import Domain, ObjType
from sphinx.directives import ObjectDescription
from sphinx.util import ws_re
-from sphinx.util.nodes import make_refnode
+from sphinx.util.nodes import clean_astext, make_refnode
from sphinx.util.compat import Directive
@@ -327,6 +327,7 @@ class StandardDomain(Domain):
object_types = {
'term': ObjType(l_('glossary term'), 'term', searchprio=-1),
'token': ObjType(l_('grammar token'), 'token', searchprio=-1),
+ 'label': ObjType(l_('reference label'), 'ref', searchprio=-1),
'envvar': ObjType(l_('environment variable'), 'envvar'),
'cmdoption': ObjType(l_('program option'), 'option'),
}
@@ -340,15 +341,31 @@ class StandardDomain(Domain):
'productionlist': ProductionList,
}
roles = {
- 'option': OptionXRefRole(innernodeclass=addnodes.literal_emphasis),
- 'envvar': EnvVarXRefRole(),
- 'token': XRefRole(),
- 'term': XRefRole(lowercase=True, innernodeclass=nodes.emphasis),
+ 'option': OptionXRefRole(innernodeclass=addnodes.literal_emphasis),
+ 'envvar': EnvVarXRefRole(),
+ # links to tokens in grammar productions
+ 'token': XRefRole(),
+ # links to terms in glossary
+ 'term': XRefRole(lowercase=True, innernodeclass=nodes.emphasis),
+ # links to headings or arbitrary labels
+ 'ref': XRefRole(lowercase=True, innernodeclass=nodes.emphasis),
+ # links to labels, without a different title
+ 'keyword': XRefRole(),
}
initial_data = {
'progoptions': {}, # (program, name) -> docname, labelid
'objects': {}, # (type, name) -> docname, labelid
+ 'labels': { # labelname -> docname, labelid, sectionname
+ 'genindex': ('genindex', '', l_('Index')),
+ 'modindex': ('py-modindex', '', l_('Module Index')),
+ 'search': ('search', '', l_('Search Page')),
+ },
+ 'anonlabels': { # labelname -> docname, labelid
+ 'genindex': ('genindex', ''),
+ 'modindex': ('py-modindex', ''),
+ 'search': ('search', ''),
+ },
}
def clear_doc(self, docname):
@@ -358,10 +375,99 @@ class StandardDomain(Domain):
for key, (fn, _) in self.data['objects'].items():
if fn == docname:
del self.data['objects'][key]
+ for key, (fn, _, _) in self.data['labels'].items():
+ if fn == docname:
+ del self.data['labels'][key]
+ for key, (fn, _) in self.data['anonlabels'].items():
+ if fn == docname:
+ del self.data['anonlabels'][key]
+
+ def process_doc(self, env, docname, document):
+ labels, anonlabels = self.data['labels'], self.data['anonlabels']
+ for name, explicit in document.nametypes.iteritems():
+ if not explicit:
+ continue
+ labelid = document.nameids[name]
+ if labelid is None:
+ continue
+ node = document.ids[labelid]
+ if name.isdigit() or node.has_key('refuri') or \
+ node.tagname.startswith('desc_'):
+ # ignore footnote labels, labels automatically generated from a
+ # link and object descriptions
+ continue
+ if name in labels:
+ env.warn(docname, 'duplicate label %s, ' % name +
+ 'other instance in ' + env.doc2path(labels[name][0]),
+ node.line)
+ anonlabels[name] = docname, labelid
+ if node.tagname == 'section':
+ sectname = clean_astext(node[0]) # node[0] == title node
+ elif node.tagname == 'figure':
+ for n in node:
+ if n.tagname == 'caption':
+ sectname = clean_astext(n)
+ break
+ else:
+ continue
+ else:
+ # anonymous-only labels
+ continue
+ labels[name] = docname, labelid, sectname
def resolve_xref(self, env, fromdocname, builder,
typ, target, node, contnode):
- if typ == 'option':
+ if typ == 'ref':
+ #refdoc = node.get('refdoc', fromdocname)
+ if node['refexplicit']:
+ # reference to anonymous label; the reference uses
+ # the supplied link caption
+ docname, labelid = self.data['anonlabels'].get(target, ('',''))
+ sectname = node.astext()
+ # XXX warn somehow if not resolved by intersphinx
+ #if not docname:
+ # env.warn(refdoc, 'undefined label: %s' %
+ # target, node.line)
+ else:
+ # reference to named label; the final node will
+ # contain the section name after the label
+ docname, labelid, sectname = self.data['labels'].get(target,
+ ('','',''))
+ # XXX warn somehow if not resolved by intersphinx
+ #if not docname:
+ # env.warn(refdoc,
+ # 'undefined label: %s' % target + ' -- if you '
+ # 'don\'t give a link caption the label must '
+ # 'precede a section header.', node.line)
+ if not docname:
+ return None
+ newnode = nodes.reference('', '', internal=True)
+ innernode = nodes.emphasis(sectname, sectname)
+ if docname == fromdocname:
+ newnode['refid'] = labelid
+ else:
+ # set more info in contnode; in case the
+ # get_relative_uri call raises NoUri,
+ # the builder will then have to resolve these
+ contnode = addnodes.pending_xref('')
+ contnode['refdocname'] = docname
+ contnode['refsectname'] = sectname
+ newnode['refuri'] = builder.get_relative_uri(
+ fromdocname, docname)
+ if labelid:
+ newnode['refuri'] += '#' + labelid
+ newnode.append(innernode)
+ return newnode
+ elif typ == 'keyword':
+ # keywords are oddballs: they are referenced by named labels
+ docname, labelid, _ = self.data['labels'].get(target, ('','',''))
+ if not docname:
+ #env.warn(refdoc, 'unknown keyword: %s' % target)
+ return None
+ else:
+ return make_refnode(builder, fromdocname, docname,
+ labelid, contnode)
+ elif typ == 'option':
progname = node['refprogram']
docname, labelid = self.data['progoptions'].get((progname, target),
('', ''))
@@ -383,7 +489,13 @@ class StandardDomain(Domain):
def get_objects(self):
for (prog, option), info in self.data['progoptions'].iteritems():
- yield (option, 'option', info[0], info[1], 1)
+ yield (option, option, 'option', info[0], info[1], 1)
for (type, name), info in self.data['objects'].iteritems():
- yield (name, type, info[0], info[1],
+ yield (name, name, type, info[0], info[1],
self.object_types[type].attrs['searchprio'])
+ for name, info in self.data['labels'].iteritems():
+ yield (name, info[2], 'label', info[0], info[1], -1)
+
+ def get_type_name(self, type, primary=False):
+ # never prepend "Default"
+ return type.lname
diff --git a/sphinx/environment.py b/sphinx/environment.py
index 27ed93cf..c8b3f018 100644
--- a/sphinx/environment.py
+++ b/sphinx/environment.py
@@ -61,7 +61,7 @@ default_settings = {
# This is increased every time an environment attribute is added
# or changed to properly invalidate pickle files.
-ENV_VERSION = 35
+ENV_VERSION = 36
default_substitutions = set([
@@ -168,26 +168,13 @@ class CitationReferences(Transform):
refnode += nodes.Text('[' + cittext + ']')
citnode.parent.replace(citnode, refnode)
-class CategorizeReferences(Transform):
- """Categorize references (hyperlinks) as link outside or link inside"""
-
- default_priority = 619
- def apply(self):
- for reference in self.document.traverse(nodes.reference):
- if reference.hasattr('refuri'):
- refuri = reference['refuri']
- if re.match(r"(?i)(?:http|https|ftp)://", refuri):
- classes = ("link", "outside")
- else:
- classes = ("link", "inside")
- reference["classes"].extend(classes)
class SphinxStandaloneReader(standalone.Reader):
"""
Add our own transforms.
"""
transforms = [CitationReferences, DefaultSubstitutions, MoveModuleTargets,
- HandleCodeBlocks, SortIds, CategorizeReferences]
+ HandleCodeBlocks, SortIds]
def get_transforms(self):
return standalone.Reader.get_transforms(self) + self.transforms
@@ -317,12 +304,8 @@ class BuildEnvironment:
# domain-specific inventories, here to be pickled
self.domaindata = {} # domainname -> domain-specific dict
- # X-ref target inventory
- self.labels = {} # labelname -> docname, labelid, sectionname
- self.anonlabels = {} # labelname -> docname, labelid
- self.citations = {} # citation name -> docname, labelid
-
# Other inventories
+ self.citations = {} # citation name -> docname, labelid
self.indexentries = {} # docname -> list of
# (type, string, target, aliasname)
self.versionchanges = {} # version -> list of (type, docname,
@@ -335,16 +318,6 @@ class BuildEnvironment:
# temporary data storage while reading a document
self.temp_data = {}
- # Some magically present labels
- def add_magic_label(name, description, target=None):
- self.labels[name] = (target or name, '', description)
- self.anonlabels[name] = (target or name, '')
- add_magic_label('genindex', _('Index'))
- # XXX add per domain?
- # compatibility alias
- add_magic_label('modindex', _('Module Index'), 'py-modindex')
- add_magic_label('search', _('Search Page'))
-
def set_warnfunc(self, func):
self._warnfunc = func
self.settings['warning_stream'] = WarningStream(func)
@@ -379,9 +352,6 @@ class BuildEnvironment:
fnset.discard(docname)
if not fnset:
del self.files_to_rebuild[subfn]
- for labelname, (fn, _, _) in self.labels.items():
- if fn == docname:
- del self.labels[labelname]
for key, (fn, _) in self.citations.items():
if fn == docname:
del self.citations[key]
@@ -624,7 +594,7 @@ class BuildEnvironment:
self.temp_data['docname'] = docname
# defaults to the global default, but can be re-set in a document
self.temp_data['default_domain'] = \
- self.domains.get(self.config.default_domain)
+ self.domains.get(self.config.primary_domain)
self.settings['input_encoding'] = self.config.source_encoding
self.settings['trim_footnote_reference_space'] = \
@@ -682,10 +652,11 @@ class BuildEnvironment:
self.process_metadata(docname, doctree)
self.process_refonly_bullet_lists(docname, doctree)
self.create_title_from(docname, doctree)
- self.note_labels_from(docname, doctree)
self.note_indexentries_from(docname, doctree)
self.note_citations_from(docname, doctree)
self.build_toc_from(docname, doctree)
+ for domain in self.domains.itervalues():
+ domain.process_doc(self, docname, doctree)
# allow extension-specific post-processing
if app:
@@ -962,39 +933,6 @@ class BuildEnvironment:
self.titles[docname] = titlenode
self.longtitles[docname] = longtitlenode
- def note_labels_from(self, docname, document):
- for name, explicit in document.nametypes.iteritems():
- if not explicit:
- continue
- labelid = document.nameids[name]
- if labelid is None:
- continue
- node = document.ids[labelid]
- if name.isdigit() or node.has_key('refuri') or \
- node.tagname.startswith('desc_'):
- # ignore footnote labels, labels automatically generated from a
- # link and object descriptions
- continue
- if name in self.labels:
- self.warn(docname, 'duplicate label %s, ' % name +
- 'other instance in ' +
- self.doc2path(self.labels[name][0]),
- node.line)
- self.anonlabels[name] = docname, labelid
- if node.tagname == 'section':
- sectname = clean_astext(node[0]) # node[0] == title node
- elif node.tagname == 'figure':
- for n in node:
- if n.tagname == 'caption':
- sectname = clean_astext(n)
- break
- else:
- continue
- else:
- # anonymous-only labels
- continue
- self.labels[name] = docname, labelid, sectname
-
def note_indexentries_from(self, docname, document):
entries = self.indexentries[docname] = []
for node in document.traverse(addnodes.index):
@@ -1070,9 +1008,9 @@ class BuildEnvironment:
else:
anchorname = '#' + sectionnode['ids'][0]
numentries[0] += 1
- reference = nodes.reference('', '', refuri=docname,
- anchorname=anchorname,
- *nodetext)
+ reference = nodes.reference(
+ '', '', internal=True, refuri=docname,
+ anchorname=anchorname, *nodetext)
para = addnodes.compact_paragraph('', '', reference)
item = nodes.list_item('', para)
if maxdepth == 0 or depth < maxdepth:
@@ -1210,7 +1148,7 @@ class BuildEnvironment:
for (title, ref) in refs:
try:
if url_re.match(ref):
- reference = nodes.reference('', '',
+ reference = nodes.reference('', '', internal=False,
refuri=ref, anchorname='',
*[nodes.Text(title)])
para = addnodes.compact_paragraph('', '', reference)
@@ -1222,7 +1160,7 @@ class BuildEnvironment:
ref = toctreenode['parent']
if not title:
title = clean_astext(self.titles[ref])
- reference = nodes.reference('', '',
+ reference = nodes.reference('', '', internal=True,
refuri=ref,
anchorname='',
*[nodes.Text(title)])
@@ -1322,44 +1260,6 @@ class BuildEnvironment:
newnode = domain.resolve_xref(self, fromdocname, builder,
typ, target, node, contnode)
# really hardwired reference types
- elif typ == 'ref':
- if node['refexplicit']:
- # reference to anonymous label; the reference uses
- # the supplied link caption
- docname, labelid = self.anonlabels.get(target, ('',''))
- sectname = node.astext()
- if not docname:
- self.warn(refdoc, 'undefined label: %s' %
- target, node.line)
- warned = True
- else:
- # reference to named label; the final node will
- # contain the section name after the label
- docname, labelid, sectname = self.labels.get(target,
- ('','',''))
- if not docname:
- self.warn(refdoc,
- 'undefined label: %s' % target + ' -- if you '
- 'don\'t give a link caption the label must '
- 'precede a section header.', node.line)
- warned = True
- if docname:
- newnode = nodes.reference('', '')
- innernode = nodes.emphasis(sectname, sectname)
- if docname == fromdocname:
- newnode['refid'] = labelid
- else:
- # set more info in contnode; in case the
- # get_relative_uri call raises NoUri,
- # the builder will then have to resolve these
- contnode = addnodes.pending_xref('')
- contnode['refdocname'] = docname
- contnode['refsectname'] = sectname
- newnode['refuri'] = builder.get_relative_uri(
- fromdocname, docname)
- if labelid:
- newnode['refuri'] += '#' + labelid
- newnode.append(innernode)
elif typ == 'doc':
# directly reference to document by source name;
# can be absolute or relative
@@ -1375,7 +1275,7 @@ class BuildEnvironment:
else:
caption = clean_astext(self.titles[docname])
innernode = nodes.emphasis(caption, caption)
- newnode = nodes.reference('', '')
+ newnode = nodes.reference('', '', internal=True)
newnode['refuri'] = builder.get_relative_uri(
fromdocname, docname)
newnode.append(innernode)
@@ -1388,16 +1288,6 @@ class BuildEnvironment:
else:
newnode = make_refnode(builder, fromdocname, docname,
labelid, contnode)
- elif typ == 'keyword':
- # keywords are oddballs: they are referenced by named labels
- docname, labelid, _ = self.labels.get(target, ('','',''))
- if not docname:
- #self.warn(refdoc, 'unknown keyword: %s' % target)
- pass
- else:
- newnode = make_refnode(builder, fromdocname, docname,
- labelid, contnode)
-
# no new node found? try the missing-reference event
if newnode is None:
newnode = builder.app.emit_firstresult(
diff --git a/sphinx/ext/extlinks.py b/sphinx/ext/extlinks.py
index 36f4d697..9a29918a 100644
--- a/sphinx/ext/extlinks.py
+++ b/sphinx/ext/extlinks.py
@@ -46,7 +46,7 @@ def make_link_role(base_url, prefix):
title = full_url
else:
title = prefix + part
- pnode = nodes.reference(title, title, refuri=full_url)
+ pnode = nodes.reference(title, title, internal=False, refuri=full_url)
return [pnode], []
return role
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index 3cf64980..1608c230 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -58,7 +58,7 @@ def read_inventory_v1(f, uri, join):
else:
type = 'py:' + type
location += '#' + name
- invdata.setdefault(type, {})[name] = (projname, version, location)
+ invdata.setdefault(type, {})[name] = (projname, version, location, '-')
return invdata
@@ -90,11 +90,12 @@ def read_inventory_v2(f, uri, join, bufsize=16*1024):
assert not buf
for line in split_lines(read_chunks()):
- name, type, prio, location = line.rstrip().split(None, 3)
+ name, type, prio, location, dispname = line.rstrip().split(None, 4)
if location.endswith('$'):
location = location[:-1] + name
location = join(uri, location)
- invdata.setdefault(type, {})[name] = (projname, version, location)
+ invdata.setdefault(type, {})[name] = (projname, version,
+ location, dispname)
return invdata
@@ -142,7 +143,15 @@ def load_mappings(app):
env.intersphinx_cache = {}
cache = env.intersphinx_cache
update = False
- for uri, inv in app.config.intersphinx_mapping.iteritems():
+ for key, value in app.config.intersphinx_mapping.iteritems():
+ if isinstance(value, tuple):
+ # new format
+ name, (uri, inv) = key, value
+ if not name.isalnum():
+ env.warn('intersphinx identifier %r is not alphanumeric' % name)
+ else:
+ # old format, no name
+ name, uri, inv = None, key, value
# we can safely assume that the uri<->inv mapping is not changed
# during partial rebuilds since a changed intersphinx_mapping
# setting will cause a full environment reread
@@ -152,12 +161,19 @@ def load_mappings(app):
# files; remote ones only if the cache time is expired
if '://' not in inv or uri not in cache \
or cache[uri][0] < cache_time:
+ app.info('loading intersphinx inventory from %s...' % inv)
invdata = fetch_inventory(app, uri, inv)
- cache[uri] = (now, invdata)
+ if invdata:
+ cache[uri] = (name, now, invdata)
+ else:
+ cache.pop(uri, None)
update = True
if update:
env.intersphinx_inventory = {}
- for _, invdata in cache.itervalues():
+ env.intersphinx_named_inventory = {}
+ for name, _, invdata in cache.itervalues():
+ if name:
+ env.intersphinx_named_inventory[name] = invdata
for type, objects in invdata.iteritems():
env.intersphinx_inventory.setdefault(
type, {}).update(objects)
@@ -173,20 +189,25 @@ def missing_reference(app, env, node, contnode):
objtypes = env.domains[domain].objtypes_for_role(node['reftype'])
if not objtypes:
return
- for objtype in objtypes:
- fulltype = '%s:%s' % (domain, objtype)
- if fulltype in env.intersphinx_inventory and \
- target in env.intersphinx_inventory[fulltype]:
- break
- else:
- return
- proj, version, uri = env.intersphinx_inventory[fulltype][target]
- newnode = nodes.reference('', '')
- newnode['refuri'] = uri
- newnode['reftitle'] = '(in %s v%s)' % (proj, version)
- newnode['class'] = 'external-xref'
- newnode.append(contnode)
- return newnode
+ objtypes = ['%s:%s' % (domain, objtype) for objtype in objtypes]
+ to_try = [(env.intersphinx_inventory, target)]
+ if ':' in target:
+ # first part may be the foreign doc set name
+ setname, newtarget = target.split(':', 1)
+ if setname in env.intersphinx_named_inventory:
+ to_try.append((env.intersphinx_named_inventory[setname], newtarget))
+ for inventory, target in to_try:
+ for objtype in objtypes:
+ if objtype not in inventory or target not in inventory[objtype]:
+ continue
+ proj, version, uri, dispname = inventory[objtype][target]
+ newnode = nodes.reference('', '', internal=False, refuri=uri,
+ reftitle='(in %s v%s)' % (proj, version))
+ if dispname == '-':
+ newnode.append(contnode)
+ else:
+ newnode.append(contnode.__class__(dispname, dispname))
+ return newnode
def setup(app):
diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py
index 93fa301d..7f399754 100644
--- a/sphinx/ext/pngmath.py
+++ b/sphinx/ext/pngmath.py
@@ -10,6 +10,7 @@
"""
import re
+import codecs
import shutil
import tempfile
import posixpath
@@ -33,7 +34,7 @@ class MathExtError(SphinxError):
DOC_HEAD = r'''
\documentclass[12pt]{article}
-\usepackage[utf8]{inputenc}
+\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
@@ -89,8 +90,6 @@ def render_math(self, math):
latex = DOC_HEAD + self.builder.config.pngmath_latex_preamble
latex += (use_preview and DOC_BODY_PREVIEW or DOC_BODY) % math
- if isinstance(latex, unicode):
- latex = latex.encode('utf-8')
# use only one tempdir per build -- the use of a directory is cleaner
# than using temporary files, since we can clean up everything at once
@@ -100,7 +99,7 @@ def render_math(self, math):
else:
tempdir = self.builder._mathpng_tempdir
- tf = open(path.join(tempdir, 'math.tex'), 'w')
+ tf = codecs.open(path.join(tempdir, 'math.tex'), 'w', 'utf-8')
tf.write(latex)
tf.close()
@@ -183,7 +182,8 @@ def html_visit_math(self, node):
try:
fname, depth = render_math(self, '$'+node['latex']+'$')
except MathExtError, exc:
- sm = nodes.system_message(str(exc), type='WARNING', level=2,
+ msg = unicode(str(exc), 'utf-8', 'replace')
+ sm = nodes.system_message(msg, type='WARNING', level=2,
backrefs=[], source=node['latex'])
sm.walkabout(self)
self.builder.warn('display latex %r: ' % node['latex'] + str(exc))
diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py
index ac362919..a6c33202 100644
--- a/sphinx/ext/todo.py
+++ b/sphinx/ext/todo.py
@@ -113,9 +113,8 @@ def process_todo_nodes(app, doctree, fromdocname):
para += nodes.Text(desc1, desc1)
# Create a reference
- newnode = nodes.reference('', '')
+ newnode = nodes.reference('', '', internal=True)
innernode = nodes.emphasis(_('original entry'), _('original entry'))
- newnode['refdocname'] = todo_info['docname']
try:
newnode['refuri'] = app.builder.get_relative_uri(
fromdocname, todo_info['docname'])
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py
index badcca1c..43e0942c 100644
--- a/sphinx/locale/__init__.py
+++ b/sphinx/locale/__init__.py
@@ -32,6 +32,9 @@ class _TranslationProxy(UserString.UserString, object):
return unicode(func)
return object.__new__(cls)
+ def __getnewargs__(self):
+ return (self._func,) + self._args
+
def __init__(self, func, *args):
self._func = func
self._args = args
diff --git a/sphinx/locale/ca/LC_MESSAGES/sphinx.mo b/sphinx/locale/ca/LC_MESSAGES/sphinx.mo
index d9cc44ce..d88717c0 100644
--- a/sphinx/locale/ca/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/ca/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/cs/LC_MESSAGES/sphinx.mo b/sphinx/locale/cs/LC_MESSAGES/sphinx.mo
index 93ec36d7..af8b4776 100644
--- a/sphinx/locale/cs/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/cs/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/de/LC_MESSAGES/sphinx.mo b/sphinx/locale/de/LC_MESSAGES/sphinx.mo
index 65932481..1fa7ae3d 100644
--- a/sphinx/locale/de/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/de/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/es/LC_MESSAGES/sphinx.mo b/sphinx/locale/es/LC_MESSAGES/sphinx.mo
index c63cad23..eda70a31 100644
--- a/sphinx/locale/es/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/es/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/fi/LC_MESSAGES/sphinx.mo b/sphinx/locale/fi/LC_MESSAGES/sphinx.mo
index 5e47dcba..61d8da8f 100644
--- a/sphinx/locale/fi/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/fi/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/fi/LC_MESSAGES/sphinx.po b/sphinx/locale/fi/LC_MESSAGES/sphinx.po
index 97cdace1..5cad377e 100644
--- a/sphinx/locale/fi/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/fi/LC_MESSAGES/sphinx.po
@@ -589,10 +589,10 @@ msgstr ""
#: sphinx/writers/latex.py:651
#, fuzzy
msgid "Continued on next page"
-msgstr "Hakemisto yhtenä luettelona"
+msgstr ""
#: sphinx/writers/text.py:166
-#, fuzzy, python-format
+#, python-format
msgid "Platform: %s"
msgstr "Ympäristö: %s"
diff --git a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo
index d6c051de..704ddef0 100644
--- a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.js b/sphinx/locale/hr/LC_MESSAGES/sphinx.js
new file mode 100644
index 00000000..8db6b8f8
--- /dev/null
+++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.js
@@ -0,0 +1 @@
+Documentation.addTranslations({"locale": "hr", "plural_expr": "0", "messages": {"Search Results": "Rezultati pretrage", "Preparing search...": "Pripremam pretra\u017eivanje...", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "Za va\u0161u pretragu nema rezultata. Molimo pregledajte da li so sve rije\u010di ispravno napisane i da li ste izbrali dovoljno kategorija.", "Search finished, found %s page(s) matching the search query.": "Pretra\u017eivanje je zaklju\u010deno, prona\u0111eno %s stranica, koje odgovaraju tra\u017eenom nizu.", ", in ": ", u ", "Permalink to this headline": "Link na taj naslov", "Searching": "Tra\u017eim", "Permalink to this definition": "Link na tu definiciju", "module, in ": "modul, u ", "Hide Search Matches": "Sakrij rezultate pretrage"}}); \ No newline at end of file
diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.mo b/sphinx/locale/hr/LC_MESSAGES/sphinx.mo
new file mode 100644
index 00000000..b314dbd6
--- /dev/null
+++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/hr/LC_MESSAGES/sphinx.po b/sphinx/locale/hr/LC_MESSAGES/sphinx.po
new file mode 100644
index 00000000..d4b1fa3c
--- /dev/null
+++ b/sphinx/locale/hr/LC_MESSAGES/sphinx.po
@@ -0,0 +1,606 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Sphinx\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2010-09-11 23:58+0200\n"
+"PO-Revision-Date: 2009-08-06 23:04+0200\n"
+"Last-Translator: Bojan Mihelač <bmihelac@mihelac.org>\n"
+"Language-Team: Bojan Mihelač <bmihelac@mihelac.org>\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.4\n"
+
+#: sphinx/environment.py:103 sphinx/writers/latex.py:184
+#, python-format
+msgid "%B %d, %Y"
+msgstr "%d %B, %Y"
+
+#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2
+#: sphinx/themes/basic/genindex-split.html:2
+#: sphinx/themes/basic/genindex-split.html:5
+#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5
+#: sphinx/themes/basic/genindex.html:48 sphinx/themes/basic/layout.html:134
+#: sphinx/writers/latex.py:190
+msgid "Index"
+msgstr "Abecedni popis"
+
+#: sphinx/environment.py:325 sphinx/writers/latex.py:189
+msgid "Module Index"
+msgstr "Popis modula"
+
+#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16
+msgid "Search Page"
+msgstr "Tražilica"
+
+#: sphinx/roles.py:55 sphinx/directives/desc.py:747
+#, python-format
+msgid "environment variable; %s"
+msgstr "varijabla okruženja; %s"
+
+#: sphinx/roles.py:62
+#, python-format
+msgid "Python Enhancement Proposals!PEP %s"
+msgstr "Python Enhancement Proposals!PEP %s"
+
+#: sphinx/builders/changes.py:71
+msgid "Builtins"
+msgstr "Ugrađeni dijelovi"
+
+#: sphinx/builders/changes.py:73
+msgid "Module level"
+msgstr "Nivo modula"
+
+#: sphinx/builders/html.py:222
+#, python-format
+msgid "%b %d, %Y"
+msgstr "%d %b, %Y"
+
+#: sphinx/builders/html.py:241 sphinx/themes/basic/defindex.html:21
+msgid "General Index"
+msgstr "Opceniti abecedni indeks"
+
+#: sphinx/builders/html.py:241
+msgid "index"
+msgstr "abecedni indeks"
+
+#: sphinx/builders/html.py:243 sphinx/builders/htmlhelp.py:219
+#: sphinx/builders/qthelp.py:133 sphinx/themes/basic/defindex.html:19
+#: sphinx/themes/basic/modindex.html:2 sphinx/themes/basic/modindex.html:13
+msgid "Global Module Index"
+msgstr "Općeniti popis modula"
+
+#: sphinx/builders/html.py:244
+msgid "modules"
+msgstr "Moduli"
+
+#: sphinx/builders/html.py:300
+msgid "next"
+msgstr "naprijed"
+
+#: sphinx/builders/html.py:309
+msgid "previous"
+msgstr "nazad"
+
+#: sphinx/builders/latex.py:162
+msgid " (in "
+msgstr " (u "
+
+#: sphinx/directives/desc.py:97
+msgid "Raises"
+msgstr "Podiže"
+
+#: sphinx/directives/desc.py:101
+msgid "Variable"
+msgstr "Varijabla"
+
+#: sphinx/directives/desc.py:104
+msgid "Returns"
+msgstr "Vraća"
+
+#: sphinx/directives/desc.py:113
+msgid "Return type"
+msgstr "Vraća tip"
+
+#: sphinx/directives/desc.py:186
+msgid "Parameter"
+msgstr "Parametar"
+
+#: sphinx/directives/desc.py:190
+msgid "Parameters"
+msgstr "Parametri"
+
+#: sphinx/directives/desc.py:418
+#, python-format
+msgid "%s() (built-in function)"
+msgstr "%s() (ugrađene funkcije)"
+
+#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476
+#: sphinx/directives/desc.py:488
+#, python-format
+msgid "%s() (in module %s)"
+msgstr "%s() (u modulu %s)"
+
+#: sphinx/directives/desc.py:422
+#, python-format
+msgid "%s (built-in variable)"
+msgstr "%s (ugrađene variable)"
+
+#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514
+#, python-format
+msgid "%s (in module %s)"
+msgstr "%s (u modulu %s)"
+
+#: sphinx/directives/desc.py:439
+#, python-format
+msgid "%s (built-in class)"
+msgstr "%s (ugrađen razred)"
+
+#: sphinx/directives/desc.py:440
+#, python-format
+msgid "%s (class in %s)"
+msgstr "%s (razred u %s)"
+
+#: sphinx/directives/desc.py:480
+#, python-format
+msgid "%s() (%s.%s method)"
+msgstr "%s() (%s.%s metoda)"
+
+#: sphinx/directives/desc.py:482
+#, python-format
+msgid "%s() (%s method)"
+msgstr "%s() (%s metoda)"
+
+#: sphinx/directives/desc.py:492
+#, python-format
+msgid "%s() (%s.%s static method)"
+msgstr "%s() (%s.%s statična metoda)"
+
+#: sphinx/directives/desc.py:495
+#, python-format
+msgid "%s() (%s static method)"
+msgstr "%s() (%s statična metoda)"
+
+#: sphinx/directives/desc.py:518
+#, python-format
+msgid "%s (%s.%s attribute)"
+msgstr "%s (%s.%s atribut)"
+
+#: sphinx/directives/desc.py:520
+#, python-format
+msgid "%s (%s attribute)"
+msgstr "%s (%s atribut)"
+
+#: sphinx/directives/desc.py:609
+#, python-format
+msgid "%s (C function)"
+msgstr "%s (C funkcija)"
+
+#: sphinx/directives/desc.py:611
+#, python-format
+msgid "%s (C member)"
+msgstr "%s (C član)"
+
+#: sphinx/directives/desc.py:613
+#, python-format
+msgid "%s (C macro)"
+msgstr "%s (C makro)"
+
+#: sphinx/directives/desc.py:615
+#, python-format
+msgid "%s (C type)"
+msgstr "%s (C tip)"
+
+#: sphinx/directives/desc.py:617
+#, python-format
+msgid "%s (C variable)"
+msgstr "%s (C varijabla)"
+
+#: sphinx/directives/desc.py:665
+#, python-format
+msgid "%scommand line option; %s"
+msgstr "%scommand line parameter; %s"
+
+#: sphinx/directives/other.py:140
+msgid "Platforms: "
+msgstr "Platforme:"
+
+#: sphinx/directives/other.py:146
+#, python-format
+msgid "%s (module)"
+msgstr "%s (modul)"
+
+#: sphinx/directives/other.py:195
+msgid "Section author: "
+msgstr "Autor sekcije:"
+
+#: sphinx/directives/other.py:197
+msgid "Module author: "
+msgstr "Autor modula:"
+
+#: sphinx/directives/other.py:199
+msgid "Author: "
+msgstr "Autor:"
+
+#: sphinx/directives/other.py:319
+msgid "See also"
+msgstr "Pogledaj i"
+
+#: sphinx/ext/autodoc.py:889
+#, python-format
+msgid " Bases: %s"
+msgstr " Osnove: %s"
+
+#: sphinx/ext/autodoc.py:922
+#, python-format
+msgid "alias of :class:`%s`"
+msgstr "nadimak za :class:`%s`"
+
+#: sphinx/ext/todo.py:41
+msgid "Todo"
+msgstr "Todo"
+
+#: sphinx/ext/todo.py:99
+#, python-format
+msgid "(The original entry is located in %s, line %d and can be found "
+msgstr "(Originalan unos se nalazi u %s, u retku %d, i može biti pronađen "
+
+#: sphinx/ext/todo.py:105
+msgid "here"
+msgstr "ovdje"
+
+#: sphinx/locale/__init__.py:15
+msgid "Attention"
+msgstr "Pozor"
+
+#: sphinx/locale/__init__.py:16
+msgid "Caution"
+msgstr "Pažnja"
+
+#: sphinx/locale/__init__.py:17
+msgid "Danger"
+msgstr "Opasnost"
+
+#: sphinx/locale/__init__.py:18
+msgid "Error"
+msgstr "Greška"
+
+#: sphinx/locale/__init__.py:19
+msgid "Hint"
+msgstr "Savjet"
+
+#: sphinx/locale/__init__.py:20
+msgid "Important"
+msgstr "Važno"
+
+#: sphinx/locale/__init__.py:21
+msgid "Note"
+msgstr "Napomena"
+
+#: sphinx/locale/__init__.py:22
+msgid "See Also"
+msgstr "Pogledaj i"
+
+#: sphinx/locale/__init__.py:23
+msgid "Tip"
+msgstr "Savjet"
+
+#: sphinx/locale/__init__.py:24
+msgid "Warning"
+msgstr "Upozorenje"
+
+#: sphinx/locale/__init__.py:28
+#, python-format
+msgid "New in version %s"
+msgstr "Novo u verziji %s"
+
+#: sphinx/locale/__init__.py:29
+#, python-format
+msgid "Changed in version %s"
+msgstr "Promijenjeno u verziji %s"
+
+#: sphinx/locale/__init__.py:30
+#, python-format
+msgid "Deprecated since version %s"
+msgstr "Zastarijelo od verzije %s"
+
+#: sphinx/locale/__init__.py:34
+msgid "module"
+msgstr "modul"
+
+#: sphinx/locale/__init__.py:35
+msgid "keyword"
+msgstr "ključna riječ"
+
+#: sphinx/locale/__init__.py:36
+msgid "operator"
+msgstr "operator"
+
+#: sphinx/locale/__init__.py:37
+msgid "object"
+msgstr "objekt"
+
+#: sphinx/locale/__init__.py:38
+msgid "exception"
+msgstr "izuzetak"
+
+#: sphinx/locale/__init__.py:39
+msgid "statement"
+msgstr "izjava"
+
+#: sphinx/locale/__init__.py:40
+msgid "built-in function"
+msgstr "ugrađen funkcije"
+
+#: sphinx/themes/basic/defindex.html:2
+msgid "Overview"
+msgstr "Pregled"
+
+#: sphinx/themes/basic/defindex.html:11
+msgid "Indices and tables:"
+msgstr "Kazala i tabele:"
+
+#: sphinx/themes/basic/defindex.html:14
+msgid "Complete Table of Contents"
+msgstr "Potpuna tabela sadržaja"
+
+#: sphinx/themes/basic/defindex.html:15
+msgid "lists all sections and subsections"
+msgstr "prikaži sve sekcije i podsekcije"
+
+#: sphinx/themes/basic/defindex.html:17
+msgid "search this documentation"
+msgstr "traži po dokumentaciji"
+
+#: sphinx/themes/basic/defindex.html:20
+msgid "quick access to all modules"
+msgstr "brz dostup do svih modulov"
+
+#: sphinx/themes/basic/defindex.html:22
+msgid "all functions, classes, terms"
+msgstr "sve funkcije, razredi, izrazi"
+
+#: sphinx/themes/basic/genindex-single.html:5
+#, python-format
+msgid "Index &ndash; %(key)s"
+msgstr "Index &ndash; %(key)s"
+
+#: sphinx/themes/basic/genindex-single.html:44
+#: sphinx/themes/basic/genindex-split.html:14
+#: sphinx/themes/basic/genindex-split.html:27
+#: sphinx/themes/basic/genindex.html:54
+msgid "Full index on one page"
+msgstr "Potpun indeks na jednoj strani"
+
+#: sphinx/themes/basic/genindex-split.html:7
+msgid "Index pages by letter"
+msgstr "Indeksiraj stranice po slovu"
+
+#: sphinx/themes/basic/genindex-split.html:15
+msgid "can be huge"
+msgstr "može biti veliko"
+
+#: sphinx/themes/basic/layout.html:10
+msgid "Navigation"
+msgstr "Navigacija"
+
+#: sphinx/themes/basic/layout.html:42
+msgid "Table Of Contents"
+msgstr "Pregled sadržaja"
+
+#: sphinx/themes/basic/layout.html:48
+msgid "Previous topic"
+msgstr "Prijašnja tema"
+
+#: sphinx/themes/basic/layout.html:50
+msgid "previous chapter"
+msgstr "Prijašnje poglavje"
+
+#: sphinx/themes/basic/layout.html:53
+msgid "Next topic"
+msgstr "Slijedeća tema"
+
+#: sphinx/themes/basic/layout.html:55
+msgid "next chapter"
+msgstr "slijedeće poglavje"
+
+#: sphinx/themes/basic/layout.html:60
+msgid "This Page"
+msgstr "Trenutna stranica"
+
+#: sphinx/themes/basic/layout.html:63
+msgid "Show Source"
+msgstr "Prikaži izvorni kod"
+
+#: sphinx/themes/basic/layout.html:73
+msgid "Quick search"
+msgstr "Brzo pretraživanje"
+
+#: sphinx/themes/basic/layout.html:76
+msgid "Go"
+msgstr "Naprijed"
+
+#: sphinx/themes/basic/layout.html:81
+msgid "Enter search terms or a module, class or function name."
+msgstr "Unesi ime modula, razreda ili funkcije."
+
+#: sphinx/themes/basic/layout.html:122
+#, python-format
+msgid "Search within %(docstitle)s"
+msgstr "Traži između %(docstitle)s"
+
+#: sphinx/themes/basic/layout.html:131
+msgid "About these documents"
+msgstr "O ovim dokumentima"
+
+#: sphinx/themes/basic/layout.html:137 sphinx/themes/basic/search.html:2
+#: sphinx/themes/basic/search.html:5
+msgid "Search"
+msgstr "Traži"
+
+#: sphinx/themes/basic/layout.html:140
+msgid "Copyright"
+msgstr "Sva prava zadržana"
+
+#: sphinx/themes/basic/layout.html:187
+#, python-format
+msgid "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
+msgstr "&copy; <a href=\"%(path)s\">Sva prava zadržana</a> %(copyright)s."
+
+#: sphinx/themes/basic/layout.html:189
+#, python-format
+msgid "&copy; Copyright %(copyright)s."
+msgstr "&copy; Sva prava zadržana %(copyright)s."
+
+#: sphinx/themes/basic/layout.html:193
+#, python-format
+msgid "Last updated on %(last_updated)s."
+msgstr "Zadnji put ažurirano %(last_updated)s."
+
+#: sphinx/themes/basic/layout.html:196
+#, python-format
+msgid ""
+"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
+"%(sphinx_version)s."
+msgstr ""
+"Izrađeno sa <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
+"%(sphinx_version)s."
+
+#: sphinx/themes/basic/modindex.html:36
+msgid "Deprecated"
+msgstr "Zastarjelo"
+
+#: sphinx/themes/basic/opensearch.xml:4
+#, python-format
+msgid "Search %(docstitle)s"
+msgstr "Traži %(docstitle)s"
+
+#: sphinx/themes/basic/search.html:9
+msgid ""
+"Please activate JavaScript to enable the search\n"
+" functionality."
+msgstr ""
+"Molimo omogućite JavaScript\n"
+" za djelovanje tražilice."
+
+#: sphinx/themes/basic/search.html:14
+msgid ""
+"From here you can search these documents. Enter your search\n"
+" words into the box below and click \"search\". Note that the search\n"
+" function will automatically search for all of the words. Pages\n"
+" containing fewer words won't appear in the result list."
+msgstr ""
+"From here you can search these documents. Enter your search\n"
+" words into the box below and click \"search\". Note that the search\n"
+" function will automatically search for all of the words. Pages\n"
+" containing fewer words won't appear in the result list."
+
+#: sphinx/themes/basic/search.html:21
+msgid "search"
+msgstr "traži"
+
+#: sphinx/themes/basic/search.html:25
+#: sphinx/themes/basic/static/searchtools.js:462
+msgid "Search Results"
+msgstr "Rezultati pretrage"
+
+#: sphinx/themes/basic/search.html:27
+msgid "Your search did not match any results."
+msgstr "Your search did not match any results."
+
+#: sphinx/themes/basic/changes/frameset.html:5
+#: sphinx/themes/basic/changes/versionchanges.html:12
+#, python-format
+msgid "Changes in Version %(version)s &mdash; %(docstitle)s"
+msgstr "Changes in Version %(version)s &mdash; %(docstitle)s"
+
+#: sphinx/themes/basic/changes/rstsource.html:5
+#, python-format
+msgid "%(filename)s &mdash; %(docstitle)s"
+msgstr "%(filename)s &mdash; %(docstitle)s"
+
+#: sphinx/themes/basic/changes/versionchanges.html:17
+#, python-format
+msgid "Automatically generated list of changes in version %(version)s"
+msgstr "Automatically generated list of changes in version %(version)s"
+
+#: sphinx/themes/basic/changes/versionchanges.html:18
+msgid "Library changes"
+msgstr "Library changes"
+
+#: sphinx/themes/basic/changes/versionchanges.html:23
+msgid "C API changes"
+msgstr "C API changes"
+
+#: sphinx/themes/basic/changes/versionchanges.html:25
+msgid "Other changes"
+msgstr "Ostale promjene"
+
+#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473
+#: sphinx/writers/html.py:478
+msgid "Permalink to this headline"
+msgstr "Link na taj naslov"
+
+#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80
+msgid "Permalink to this definition"
+msgstr "Link na tu definiciju"
+
+#: sphinx/themes/basic/static/doctools.js:174
+msgid "Hide Search Matches"
+msgstr "Sakrij rezultate pretrage"
+
+#: sphinx/themes/basic/static/searchtools.js:274
+msgid "Searching"
+msgstr "Tražim"
+
+#: sphinx/themes/basic/static/searchtools.js:279
+msgid "Preparing search..."
+msgstr "Pripremam pretraživanje..."
+
+#: sphinx/themes/basic/static/searchtools.js:347
+msgid "module, in "
+msgstr "modul, u "
+
+#: sphinx/themes/basic/static/searchtools.js:356
+msgid ", in "
+msgstr ", u "
+
+#: sphinx/themes/basic/static/searchtools.js:464
+msgid ""
+"Your search did not match any documents. Please make sure that all words "
+"are spelled correctly and that you've selected enough categories."
+msgstr ""
+"Za vašu pretragu nema rezultata. Molimo pregledajte da li so sve riječi "
+"ispravno napisane i da li ste izbrali dovoljno kategorija."
+
+#: sphinx/themes/basic/static/searchtools.js:466
+#, python-format
+msgid "Search finished, found %s page(s) matching the search query."
+msgstr "Pretraživanje je zaključeno, pronađeno %s stranica, koje odgovaraju traženom nizu."
+
+#: sphinx/writers/latex.py:187
+msgid "Release"
+msgstr "Distribucija"
+
+#: sphinx/writers/latex.py:578
+msgid "Footnotes"
+msgstr ""
+
+#: sphinx/writers/latex.py:646
+msgid "continued from previous page"
+msgstr "nastavak sa prethodne stranice"
+
+#: sphinx/writers/latex.py:651
+msgid "Continued on next page"
+msgstr "nastavak na slijedećoj stranici"
+
+#: sphinx/writers/text.py:166
+#, python-format
+msgid "Platform: %s"
+msgstr "Platforma: %s"
+
+#: sphinx/writers/text.py:428
+msgid "[image]"
+msgstr "[slika]"
+
diff --git a/sphinx/locale/it/LC_MESSAGES/sphinx.mo b/sphinx/locale/it/LC_MESSAGES/sphinx.mo
index 20e25ac7..0a79fafe 100644
--- a/sphinx/locale/it/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/it/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/ja/LC_MESSAGES/sphinx.mo b/sphinx/locale/ja/LC_MESSAGES/sphinx.mo
index 28f8ee0c..c6a40e96 100644
--- a/sphinx/locale/ja/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/ja/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/nl/LC_MESSAGES/sphinx.mo b/sphinx/locale/nl/LC_MESSAGES/sphinx.mo
index 9d9dd4d4..09ea107c 100644
--- a/sphinx/locale/nl/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/nl/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo
index 1d6fc6ce..1abf2801 100644
--- a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo
index 84bd4e28..472809ee 100644
--- a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/ru/LC_MESSAGES/sphinx.mo b/sphinx/locale/ru/LC_MESSAGES/sphinx.mo
index ea2cd656..63d91873 100644
--- a/sphinx/locale/ru/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/ru/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/sl/LC_MESSAGES/sphinx.mo b/sphinx/locale/sl/LC_MESSAGES/sphinx.mo
index 856c41e1..6d8fde06 100644
--- a/sphinx/locale/sl/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/sl/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/sl/LC_MESSAGES/sphinx.po b/sphinx/locale/sl/LC_MESSAGES/sphinx.po
index 07fb84f1..47a807d7 100644
--- a/sphinx/locale/sl/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/sl/LC_MESSAGES/sphinx.po
@@ -1,11 +1,10 @@
-
msgid ""
msgstr ""
-"Project-Id-Version: Sphinx\n"
+"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2008-09-11 23:58+0200\n"
-"PO-Revision-Date: 2009-08-06 23:04+0200\n"
-"Last-Translator: Domen Kožar <domen@dev.si>\n"
+"PO-Revision-Date: 2010-04-20 09:19+0100\n"
+"Last-Translator: Luka Marinko <luka.marinko@simt.si>\n"
"Language-Team: Rok Garbas <rok.garbas@gmail.com>\n"
"Plural-Forms: nplurals=1; plural=0\n"
"MIME-Version: 1.0\n"
@@ -18,7 +17,8 @@ msgstr ""
msgid "%B %d, %Y"
msgstr "%d %B, %Y"
-#: sphinx/environment.py:324 sphinx/themes/basic/genindex-single.html:2
+#: sphinx/environment.py:324
+#: sphinx/themes/basic/genindex-single.html:2
#: sphinx/themes/basic/genindex-split.html:2
#: sphinx/themes/basic/genindex-split.html:5
#: sphinx/themes/basic/genindex.html:2 sphinx/themes/basic/genindex.html:5
@@ -31,11 +31,13 @@ msgstr "Abecedni seznam"
msgid "Module Index"
msgstr "Seznam modulov"
-#: sphinx/environment.py:326 sphinx/themes/basic/defindex.html:16
+#: sphinx/environment.py:326
+#: sphinx/themes/basic/defindex.html:16
msgid "Search Page"
msgstr "Iskalnik"
-#: sphinx/roles.py:55 sphinx/directives/desc.py:747
+#: sphinx/roles.py:55
+#: sphinx/directives/desc.py:747
#, python-format
msgid "environment variable; %s"
msgstr "okoljska spremenljivka; %s"
@@ -117,7 +119,8 @@ msgstr "Parametri"
msgid "%s() (built-in function)"
msgstr "%s() (vgrajene funkcije)"
-#: sphinx/directives/desc.py:419 sphinx/directives/desc.py:476
+#: sphinx/directives/desc.py:419
+#: sphinx/directives/desc.py:476
#: sphinx/directives/desc.py:488
#, python-format
msgid "%s() (in module %s)"
@@ -128,7 +131,8 @@ msgstr "%s() (v modulu %s)"
msgid "%s (built-in variable)"
msgstr "%s (vgrajene spremenljivke)"
-#: sphinx/directives/desc.py:423 sphinx/directives/desc.py:514
+#: sphinx/directives/desc.py:423
+#: sphinx/directives/desc.py:514
#, python-format
msgid "%s (in module %s)"
msgstr "%s (v modulu %s)"
@@ -231,7 +235,7 @@ msgstr "Poglej Tudi"
#: sphinx/ext/autodoc.py:889
#, python-format
msgid " Bases: %s"
-msgstr " Osnove: %s"
+msgstr " Baza: %s"
#: sphinx/ext/autodoc.py:922
#, python-format
@@ -461,12 +465,8 @@ msgstr "Zadnjič posodobljeno %(last_updated)s."
#: sphinx/themes/basic/layout.html:196
#, python-format
-msgid ""
-"Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
-"%(sphinx_version)s."
-msgstr ""
-"Narejeno s <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> "
-"%(sphinx_version)s."
+msgid "Created using <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)s."
+msgstr "Narejeno s <a href=\"http://sphinx.pocoo.org/\">Sphinx</a> %(sphinx_version)s."
#: sphinx/themes/basic/modindex.html:36
msgid "Deprecated"
@@ -482,8 +482,8 @@ msgid ""
"Please activate JavaScript to enable the search\n"
" functionality."
msgstr ""
-"Prosimo omogočite JavaScript\n"
-" za delovanje iskalnika."
+"Za pravilno delovanje Iskanja morete vklopiti\n"
+" JavaScript."
#: sphinx/themes/basic/search.html:14
msgid ""
@@ -538,12 +538,14 @@ msgstr "C API spremembe"
msgid "Other changes"
msgstr "Ostale spremembe"
-#: sphinx/themes/basic/static/doctools.js:139 sphinx/writers/html.py:473
+#: sphinx/themes/basic/static/doctools.js:139
+#: sphinx/writers/html.py:473
#: sphinx/writers/html.py:478
msgid "Permalink to this headline"
msgstr "Povezava na naslov"
-#: sphinx/themes/basic/static/doctools.js:145 sphinx/writers/html.py:80
+#: sphinx/themes/basic/static/doctools.js:145
+#: sphinx/writers/html.py:80
msgid "Permalink to this definition"
msgstr "Povezava na to definicijo"
@@ -568,12 +570,8 @@ msgid ", in "
msgstr ", v "
#: sphinx/themes/basic/static/searchtools.js:464
-msgid ""
-"Your search did not match any documents. Please make sure that all words "
-"are spelled correctly and that you've selected enough categories."
-msgstr ""
-"Za vaše iskanje ni rezultatov. Prosimo preglejte ali so vse besede "
-"pravilno črkovane in ali ste izbrali dovolj kategorij."
+msgid "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories."
+msgstr "Za vaše iskanje ni rezultatov. Prosimo preglejte ali so vse besede pravilno črkovane in ali ste izbrali dovolj kategorij."
#: sphinx/themes/basic/static/searchtools.js:466
#, python-format
@@ -586,11 +584,11 @@ msgstr "Izdaja"
#: sphinx/writers/latex.py:578
msgid "Footnotes"
-msgstr ""
+msgstr "Opombe"
#: sphinx/writers/latex.py:646
msgid "continued from previous page"
-msgstr "nadaljevanje prejšnje strani"
+msgstr "nadaljevanje iz prejšnje strani"
#: sphinx/writers/latex.py:651
msgid "Continued on next page"
diff --git a/sphinx/locale/tr/LC_MESSAGES/sphinx.mo b/sphinx/locale/tr/LC_MESSAGES/sphinx.mo
index c783e66b..186a2fe3 100644
--- a/sphinx/locale/tr/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/tr/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo
index c85724e4..c401ab26 100644
--- a/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo
index 16c492ca..fc39d483 100644
--- a/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo
index 05f098b1..aa24573b 100644
--- a/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo
+++ b/sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo
Binary files differ
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index 8479575a..97ddfc32 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -405,8 +405,8 @@ latex:
\t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
\t@echo
\t@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
-\t@echo "Run \\`make all-pdf' or \\`make all-ps' in that directory to" \\
-\t "run these through (pdf)latex."
+\t@echo "Run \\`make' in that directory to run these through (pdf)latex" \\
+\t "(use \\`make latexpdf' here to do that automatically)."
latexpdf: latex
\t$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
diff --git a/sphinx/roles.py b/sphinx/roles.py
index 0f3eaf14..0164d757 100644
--- a/sphinx/roles.py
+++ b/sphinx/roles.py
@@ -1,4 +1,3 @@
-
# -*- coding: utf-8 -*-
"""
sphinx.roles
@@ -23,10 +22,16 @@ from sphinx.util.nodes import split_explicit_title
generic_docroles = {
+ 'command' : nodes.strong,
+ 'dfn' : nodes.emphasis,
+ 'kbd' : nodes.literal,
'mailheader' : addnodes.literal_emphasis,
+ 'makevar' : nodes.strong,
'manpage' : addnodes.literal_emphasis,
'mimetype' : addnodes.literal_emphasis,
'newsgroup' : addnodes.literal_emphasis,
+ 'program' : nodes.strong, # XXX should be an x-ref
+ 'regexp' : nodes.literal,
}
for rolename, nodeclass in generic_docroles.iteritems():
@@ -34,26 +39,6 @@ for rolename, nodeclass in generic_docroles.iteritems():
role = roles.CustomRole(rolename, generic, {'classes': [rolename]})
roles.register_local_role(rolename, role)
-simple_docroles = [
- 'command',
- 'dfn',
- 'kbd',
- 'makevar',
- 'program',
- 'regexp',
- ]
-
-def simple_docrole(typ, rawtext, text, lineno, inliner, options={}, content=[]):
- node = nodes.inline()
- textnode = nodes.Text(text, rawtext)
- node += textnode
- node["classes"].append(typ)
- return [node], []
-
-for rolename in simple_docroles:
- roles.register_local_role(rolename, simple_docrole)
-
-
# -- generic cross-reference role ----------------------------------------------
class XRefRole(object):
@@ -197,7 +182,7 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner,
return [prb], [msg]
ref = inliner.document.settings.pep_base_url + 'pep-%04d' % pepnum
sn = nodes.strong('PEP '+text, 'PEP '+text)
- rn = nodes.reference('', '', refuri=ref, classes=[typ])
+ rn = nodes.reference('', '', internal=False, refuri=ref, classes=[typ])
rn += sn
return [indexnode, targetnode, rn], []
elif typ == 'rfc':
@@ -212,19 +197,19 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner,
return [prb], [msg]
ref = inliner.document.settings.rfc_base_url + inliner.rfc_url % rfcnum
sn = nodes.strong('RFC '+text, 'RFC '+text)
- rn = nodes.reference('', '', refuri=ref, classes=[typ])
+ rn = nodes.reference('', '', internal=False, refuri=ref, classes=[typ])
rn += sn
return [indexnode, targetnode, rn], []
-_amp_re = re.compile(r'&(?![&\s])')
+_amp_re = re.compile(r'(?<!&)&(?![&\s])')
def menusel_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
if typ == 'menuselection':
text = utils.unescape(text).replace('-->', u'\N{TRIANGULAR BULLET}')
spans = _amp_re.split(text)
- node = nodes.inline(rawtext=rawtext)
+ node = nodes.emphasis(rawtext=rawtext)
for i, span in enumerate(spans):
span = span.replace('&&', '&')
if i == 0:
@@ -276,12 +261,8 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
specific_docroles = {
# links to download references
'download': XRefRole(nodeclass=addnodes.download_reference),
- # links to headings or arbitrary labels
- 'ref': XRefRole(lowercase=True, innernodeclass=nodes.emphasis),
# links to documents
'doc': XRefRole(),
- # links to labels, without a different title
- 'keyword': XRefRole(),
'pep': indexmarkup_role,
'rfc': indexmarkup_role,
diff --git a/sphinx/search.py b/sphinx/search.py
index 17a8354d..0d07fd72 100644
--- a/sphinx/search.py
+++ b/sphinx/search.py
@@ -153,7 +153,9 @@ class IndexBuilder(object):
otypes = self._objtypes
onames = self._objnames
for domainname, domain in self.env.domains.iteritems():
- for fullname, type, docname, anchor, prio in domain.get_objects():
+ for fullname, dispname, type, docname, anchor, prio in \
+ domain.get_objects():
+ # XXX use dispname?
if docname not in fn2index:
continue
if prio < 0:
@@ -168,7 +170,8 @@ class IndexBuilder(object):
otypes[domainname, type] = i
otype = domain.object_types.get(type)
if otype:
- onames[i] = str(otype.lname) # fire translation proxies
+ # use str() to fire translation proxies
+ onames[i] = str(domain.get_type_name(otype))
else:
onames[i] = type
pdict[name] = (fn2index[docname], i, prio)
diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py
index d4f87348..e2d83bc6 100644
--- a/sphinx/setup_command.py
+++ b/sphinx/setup_command.py
@@ -64,14 +64,16 @@ class BuildDoc(Command):
('all-files', 'a', 'build all files'),
('source-dir=', 's', 'Source directory'),
('build-dir=', None, 'Build directory'),
+ ('config-dir=', 'c', 'Location of the configuration directory'),
('builder=', 'b', 'The builder to use. Defaults to "html"'),
('project=', None, 'The documented project\'s name'),
('version=', None, 'The short X.Y version'),
('release=', None, 'The full version, including alpha/beta/rc tags'),
('today=', None, 'How to format the current date, used as the '
'replacement for |today|'),
+ ('link-index', 'i', 'Link index.html to the master doc'),
]
- boolean_options = ['fresh-env', 'all-files']
+ boolean_options = ['fresh-env', 'all-files', 'link-index']
def initialize_options(self):
@@ -81,6 +83,8 @@ class BuildDoc(Command):
self.version = ''
self.release = ''
self.today = ''
+ self.config_dir = None
+ self.link_index = False
def _guess_source_dir(self):
for guess in ('doc', 'docs'):
@@ -89,13 +93,18 @@ class BuildDoc(Command):
for root, dirnames, filenames in os.walk(guess):
if 'conf.py' in filenames:
return root
+ return None
def finalize_options(self):
if self.source_dir is None:
self.source_dir = self._guess_source_dir()
self.announce('Using source directory %s' % self.source_dir)
self.ensure_dirname('source_dir')
+ if self.source_dir is None:
+ self.source_dir = os.curdir
self.source_dir = os.path.abspath(self.source_dir)
+ if self.config_dir is None:
+ self.config_dir = self.source_dir
if self.build_dir is None:
build = self.get_finalized_command('build')
@@ -122,7 +131,7 @@ class BuildDoc(Command):
confoverrides['release'] = self.release
if self.today:
confoverrides['today'] = self.today
- app = Sphinx(self.source_dir, self.source_dir,
+ app = Sphinx(self.source_dir, self.config_dir,
self.builder_target_dir, self.doctree_dir,
self.builder, confoverrides, status_stream,
freshenv=self.fresh_env)
@@ -140,3 +149,8 @@ class BuildDoc(Command):
'backslashreplace')
else:
raise
+
+ if self.link_index:
+ src = app.config.master_doc + app.builder.out_suffix
+ dst = app.builder.get_outfilename('index')
+ os.symlink(src, dst)
diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls
index 204d7063..1ebdd434 100644
--- a/sphinx/texinputs/sphinxhowto.cls
+++ b/sphinx/texinputs/sphinxhowto.cls
@@ -33,10 +33,11 @@
\rule{\textwidth}{1pt}
\ifsphinxpdfoutput
\begingroup
- % This \def is required to deal with multi-line authors; it
+ % These \defs are required to deal with multi-line authors; it
% changes \\ to ', ' (comma-space), making it pass muster for
% generating document info in the PDF file.
\def\\{, }
+ \def\and{and }
\pdfinfo{
/Author (\@author)
/Title (\@title)
@@ -48,7 +49,10 @@
{\rm\Huge\py@HeaderFamily \@title} \par
{\em\large\py@HeaderFamily \py@release\releaseinfo} \par
\vspace{25pt}
- {\Large\py@HeaderFamily \@author} \par
+ {\Large\py@HeaderFamily
+ \begin{tabular}[t]{c}
+ \@author
+ \end{tabular}} \par
\vspace{25pt}
\@date \par
\py@authoraddress \par
diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls
index da805cdc..57517798 100644
--- a/sphinx/texinputs/sphinxmanual.cls
+++ b/sphinx/texinputs/sphinxmanual.cls
@@ -40,10 +40,11 @@
\rule{\textwidth}{1pt}%
\ifsphinxpdfoutput
\begingroup
- % This \def is required to deal with multi-line authors; it
+ % These \defs are required to deal with multi-line authors; it
% changes \\ to ', ' (comma-space), making it pass muster for
% generating document info in the PDF file.
\def\\{, }
+ \def\and{and }
\pdfinfo{
/Author (\@author)
/Title (\@title)
@@ -55,7 +56,11 @@
{\rm\Huge\py@HeaderFamily \@title \par}%
{\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par}
\vfill
- {\LARGE\py@HeaderFamily \@author \par}
+ {\LARGE\py@HeaderFamily
+ \begin{tabular}[t]{c}
+ \@author
+ \end{tabular}
+ \par}
\vfill\vfill
{\large
\@date \par
diff --git a/sphinx/themes/basic/static/basic.css b/sphinx/themes/basic/static/basic.css
index e78109f4..c317cc0a 100644
--- a/sphinx/themes/basic/static/basic.css
+++ b/sphinx/themes/basic/static/basic.css
@@ -368,36 +368,8 @@ dl.glossary dt {
margin-left: 1.5em;
}
-.command,
-.makevar,
-.program
-{
- font-weight: bold;
-}
-
-.kbd,
-.regexp
-{
- font-family: monospace;
- white-space: pre-wrap;
- background-color: #ecf0f3;
- padding: 0 1px 0 1px;
- font-size: 0.95em;
-}
-
-.dfn {
- font-style: italic;
-}
-
-.guilabel {
+.guilabel, .menuselection {
font-family: sans-serif;
- font-weight: bold;
-}
-
-.menuselection {
- font-family: sans-serif;
- font-style: italic;
- font-weight: bold;
}
.accelerator {
diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js
index ec1f3e0f..b96ff3d2 100644
--- a/sphinx/themes/basic/static/searchtools.js
+++ b/sphinx/themes/basic/static/searchtools.js
@@ -467,11 +467,13 @@ var Search = {
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
item[0] + '.txt', function(data) {
- listItem.append($.makeSearchSummary(data, searchterms, hlterms));
- Search.output.append(listItem);
- listItem.slideDown(5, function() {
- displayNextItem();
- });
+ if (data != '') {
+ listItem.append($.makeSearchSummary(data, searchterms, hlterms));
+ Search.output.append(listItem);
+ listItem.slideDown(5, function() {
+ displayNextItem();
+ });
+ }
});
} else {
// no source available, just display title
diff --git a/sphinx/themes/default/static/default.css_t b/sphinx/themes/default/static/default.css_t
index 8c44f1ef..8afa1a95 100644
--- a/sphinx/themes/default/static/default.css_t
+++ b/sphinx/themes/default/static/default.css_t
@@ -164,45 +164,17 @@ a:hover {
text-decoration: underline;
}
-div.toctree-wrapper a,
-div.toctree-wrapper a:visited,
-div#indices-and-tables a,
-div#indices-and-tables a:visited,
-div.sphinxsidebar a,
-div.sphinxsidebar a:visited,
-div.related a,
-div.related a:visited {
- text-decoration: none;
-}
-
-div.toctree-wrapper a:hover,
-div#indices-and-tables a:hover,
-div.sphinxsidebar a:hover,
-div.related a:hover {
- text-decoration: underline;
- }
-
-a.link.outside {
+{% if theme_externalrefs %}
+a.external {
text-decoration: none;
border-bottom: 1px dashed {{ theme_linkcolor }};
-}
+}
-a.link.outside:hover {
+a.external:hover {
text-decoration: none;
border-bottom: none;
-}
-
-/* To distinguish between internal & external references uncomment following */
-/*
-a.reference,
-a.reference em {
- font-style: normal;
}
-
-a.reference.internal em {
- font-style: italic;
-}
-*/
+{% endif %}
/* -- body styles ----------------------------------------------------------- */
diff --git a/sphinx/themes/default/theme.conf b/sphinx/themes/default/theme.conf
index 5035fae5..67eb0d66 100644
--- a/sphinx/themes/default/theme.conf
+++ b/sphinx/themes/default/theme.conf
@@ -7,6 +7,8 @@ pygments_style = sphinx
rightsidebar = false
stickysidebar = false
+externalrefs = false
+
footerbgcolor = #11303d
footertextcolor = #ffffff
sidebarbgcolor = #1c4e63
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 04185436..a4033947 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -80,7 +80,7 @@ def inline_all_toctrees(builder, docnameset, docname, tree, colorfunc):
def make_refnode(builder, fromdocname, todocname, targetid, child, title=None):
"""Shortcut to create a reference node."""
- node = nodes.reference('', '')
+ node = nodes.reference('', '', internal=True)
if fromdocname == todocname:
node['refid'] = targetid
else:
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 00496fa2..3fe1326a 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -157,14 +157,28 @@ class HTMLTranslator(BaseTranslator):
# overwritten
def visit_reference(self, node):
- BaseTranslator.visit_reference(self, node)
- if node.hasattr('reftitle'):
- # ugly hack to add a title attribute
- starttag = self.body[-1]
- if not starttag.startswith('<a '):
- return
- self.body[-1] = '<a title="%s"' % self.attval(node['reftitle']) + \
- starttag[2:]
+ atts = {'class': 'reference'}
+ if node.get('internal'):
+ atts['class'] += ' internal'
+ else:
+ atts['class'] += ' external'
+ if 'refuri' in node:
+ atts['href'] = node['refuri']
+ if self.settings.cloak_email_addresses and \
+ atts['href'].startswith('mailto:'):
+ atts['href'] = self.cloak_mailto(atts['href'])
+ self.in_mailto = 1
+ else:
+ assert 'refid' in node, \
+ 'References must have "refuri" or "refid" attribute.'
+ atts['href'] = '#' + node['refid']
+ if not isinstance(node.parent, nodes.TextElement):
+ assert len(node) == 1 and isinstance(node[0], nodes.image)
+ atts['class'] += ' image-reference'
+ if 'reftitle' in node:
+ atts['title'] = node['reftitle']
+ self.body.append(self.starttag(node, 'a', '', **atts))
+
if node.hasattr('secnumber'):
self.body.append(('%s' + self.secnumber_suffix) %
'.'.join(map(str, node['secnumber'])))
@@ -283,8 +297,9 @@ class HTMLTranslator(BaseTranslator):
def visit_download_reference(self, node):
if node.hasattr('filename'):
- self.body.append('<a href="%s">' % posixpath.join(
- self.builder.dlpath, node['filename']))
+ self.body.append(
+ '<a class="reference download internal" href="%s">' %
+ posixpath.join(self.builder.dlpath, node['filename']))
self.context.append('</a>')
else:
self.context.append('')
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 12dd1640..d018c3f6 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -207,8 +207,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.bibitems = []
self.table = None
self.next_table_colspec = None
- self.highlightlang = builder.config.highlight_language
- self.highlightlinenothreshold = sys.maxint
+ # stack of [language, linenothreshold] settings per file
+ # the first item here is the default and must not be changed
+ # the second item is the default for the master file and can be changed
+ # by .. highlight:: directive in the master file
+ self.hlsettingstack = 2 * [[builder.config.highlight_language,
+ sys.maxint]]
self.footnotestack = []
self.curfilestack = []
self.handled_abbrs = set()
@@ -331,6 +335,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
# also add a document target
self.next_section_ids.add(':doc')
self.curfilestack.append(node['docname'])
+ # use default highlight settings for new file
+ self.hlsettingstack.append(self.hlsettingstack[0])
def collect_footnotes(self, node):
fnotes = {}
@@ -351,10 +357,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
def depart_start_of_file(self, node):
self.footnotestack.pop()
self.curfilestack.pop()
+ self.hlsettingstack.pop()
def visit_highlightlang(self, node):
- self.highlightlang = node['lang']
- self.highlightlinenothreshold = node['linenothreshold']
+ self.hlsettingstack[-1] = [node['lang'], node['linenothreshold']]
raise nodes.SkipNode
def visit_section(self, node):
@@ -1148,8 +1154,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.verbatim = ''
def depart_literal_block(self, node):
code = self.verbatim.rstrip('\n')
- lang = self.highlightlang
- linenos = code.count('\n') >= self.highlightlinenothreshold - 1
+ lang = self.hlsettingstack[-1][0]
+ linenos = code.count('\n') >= self.hlsettingstack[-1][1] - 1
if node.has_key('language'):
# code-block directives
lang = node['language']