mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge stable into default
This commit is contained in:
commit
865d677eb8
13
CHANGES
13
CHANGES
@ -21,6 +21,19 @@ Bugs fixed
|
||||
* #1340: Can't search alphabetical words on the HTML quick search generated
|
||||
with language='ja'.
|
||||
|
||||
* #1319: Do not crash if the ``html_logo`` file does not exist.
|
||||
|
||||
* #603: Do not use the HTML-ized title for building the search index (that
|
||||
resulted in "literal" being found on every page with a literal in the
|
||||
title).
|
||||
|
||||
* #751: Allow production lists longer than a page in LaTeX by using longtable.
|
||||
|
||||
* #764: Always look for stopwords lowercased in JS search.
|
||||
|
||||
* #814: autodoc: Guard against strange type objects that don't have
|
||||
``__bases__``.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
|
42
doc/intl.rst
42
doc/intl.rst
@ -71,7 +71,7 @@ Translating with sphinx-intl
|
||||
----------------------------
|
||||
|
||||
Quick guide
|
||||
^^^^^^^^^^^^
|
||||
^^^^^^^^^^^
|
||||
|
||||
`sphinx-intl`_ is a useful tool to work with Sphinx translation flow.
|
||||
This section describe a easy way to translate with sphinx-intl.
|
||||
@ -81,8 +81,8 @@ This section describe a easy way to translate with sphinx-intl.
|
||||
|
||||
#. Add configurations to your `conf.py`::
|
||||
|
||||
locale_dirs = ['locale/'] #path is example but recommended.
|
||||
gettext_compact = False #optional.
|
||||
locale_dirs = ['locale/'] # path is example but recommended.
|
||||
gettext_compact = False # optional.
|
||||
|
||||
This case-study assumes that :confval:`locale_dirs` is set to 'locale/' and
|
||||
:confval:`gettext_compact` is set to `False` (the Sphinx document is
|
||||
@ -108,19 +108,18 @@ This section describe a easy way to translate with sphinx-intl.
|
||||
|
||||
#. Build mo files and make translated document.
|
||||
|
||||
You need :confval:`language` parameter in ``conf.py`` or you may also
|
||||
You need a :confval:`language` parameter in ``conf.py`` or you may also
|
||||
specify the parameter on the command line::
|
||||
|
||||
$ sphinx-intl build
|
||||
$ make -e SPHINXOPTS="-D language='de'" html
|
||||
|
||||
|
||||
Congratulations!! You got the translated document in ``_build/html``
|
||||
Congratulations! You got the translated documentation in the ``_build/html``
|
||||
directory.
|
||||
|
||||
|
||||
Translating
|
||||
^^^^^^^^^^^^
|
||||
^^^^^^^^^^^
|
||||
|
||||
Translate po file under ``./locale/de/LC_MESSAGES`` directory.
|
||||
The case of builders.po file for sphinx document:
|
||||
@ -146,16 +145,17 @@ syntax:
|
||||
"FILL HERE BY TARGET LANGUAGE FILL HERE BY TARGET LANGUAGE FILL HERE "
|
||||
"BY TARGET LANGUAGE :ref:`EXTENSIONS <extensions>` FILL HERE."
|
||||
|
||||
Please be careful not to break reST notation.
|
||||
Please be careful not to break reST notation. Most po-editors will help you
|
||||
with that.
|
||||
|
||||
|
||||
Update your po files by new pot files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If the document is updated, it is necessary to generate updated pot files
|
||||
If a document is updated, it is necessary to generate updated pot files
|
||||
and to apply differences to translated po files.
|
||||
In order to apply the updating difference of a pot file to po file,
|
||||
using :command:`sphinx-intl update` command.
|
||||
use the :command:`sphinx-intl update` command.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -165,6 +165,10 @@ using :command:`sphinx-intl update` command.
|
||||
Using Transifex service for team translation
|
||||
--------------------------------------------
|
||||
|
||||
`Transifex <http://transifex.com>`_ is one of several services that allow
|
||||
collaborative translation via a web interface. It has a nifty Python-based
|
||||
command line client that makes it easy to fetch and push translations.
|
||||
|
||||
.. TODO: why use transifex?
|
||||
|
||||
|
||||
@ -181,9 +185,9 @@ Using Transifex service for team translation
|
||||
|
||||
#. Create your transifex_ account and create new project for your document
|
||||
|
||||
Currently, transifex does not allow for a translation project to
|
||||
have more than one version of document, so you'd better include a
|
||||
version number in your project name.
|
||||
Currently, transifex does not allow for a translation project to have more
|
||||
than one version of the document, so you'd better include a version number in
|
||||
your project name.
|
||||
|
||||
For example:
|
||||
|
||||
@ -193,8 +197,8 @@ Using Transifex service for team translation
|
||||
|
||||
#. Create config files for tx command
|
||||
|
||||
This process will create ``.tx/config`` in the current directory, as
|
||||
well as ``~/.transifexrc`` file that includes auth information.
|
||||
This process will create ``.tx/config`` in the current directory, as well as
|
||||
a ``~/.transifexrc`` file that includes auth information.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -253,11 +257,11 @@ Using Transifex service for team translation
|
||||
That's all!
|
||||
|
||||
|
||||
.. tip:: Translating on local and Transifex
|
||||
.. tip:: Translating locally and on Transifex
|
||||
|
||||
If you want to push all language's po files, you can be done by using
|
||||
:command:`tx push -t` command.
|
||||
Watch out! this operation overwrites translations in transifex.
|
||||
Watch out! This operation overwrites translations in transifex.
|
||||
|
||||
In other words, if you have updated each in the service and local po files,
|
||||
it would take much time and effort to integrate them.
|
||||
@ -270,7 +274,7 @@ Contributing to Sphinx reference translation
|
||||
The recommended way for new contributors to translate Sphinx reference
|
||||
is to join the translation team on Transifex.
|
||||
|
||||
There is `sphinx translation page`_ for Sphinx-1.2 document.
|
||||
There is `sphinx translation page`_ for Sphinx-1.2 documentation.
|
||||
|
||||
1. Login to transifex_ service.
|
||||
2. Go to `sphinx translation page`_.
|
||||
|
@ -66,3 +66,12 @@ Usage
|
||||
|
||||
See :doc:`tutorial` for an introduction. It also contains links to more
|
||||
advanced sections in this manual for the topics it discusses.
|
||||
|
||||
|
||||
Hosting
|
||||
-------
|
||||
|
||||
Need a place to host your Sphinx docs? `readthedocs.org
|
||||
<http://readthedocs.org>`_ hosts a lot of Sphinx docs already, and integrates
|
||||
well with projects' source control. It also features a powerful built-in search
|
||||
that exceeds the possibilities of Sphinx' JavaScript-based offline search.
|
||||
|
@ -597,7 +597,9 @@ class StandaloneHTMLBuilder(Builder):
|
||||
if self.config.html_logo:
|
||||
logobase = path.basename(self.config.html_logo)
|
||||
logotarget = path.join(self.outdir, '_static', logobase)
|
||||
if not path.isfile(logotarget):
|
||||
if not path.isfile(logobase):
|
||||
self.warn('logo file %r does not exist' % logobase)
|
||||
elif not path.isfile(logotarget):
|
||||
copyfile(path.join(self.confdir, self.config.html_logo),
|
||||
logotarget)
|
||||
if self.config.html_favicon:
|
||||
|
@ -1052,7 +1052,7 @@ class ClassDocumenter(ModuleLevelDocumenter):
|
||||
# add inheritance info, if wanted
|
||||
if not self.doc_as_attr and self.options.show_inheritance:
|
||||
self.add_line(u'', '<autodoc>')
|
||||
if len(self.object.__bases__):
|
||||
if hasattr(self.object, '__bases__') and len(self.object.__bases__):
|
||||
bases = [b.__module__ == '__builtin__' and
|
||||
u':class:`%s`' % b.__name__ or
|
||||
u':class:`%s.%s`' % (b.__module__, b.__name__)
|
||||
|
@ -215,7 +215,7 @@ def init(locale_dirs, language, catalog='sphinx'):
|
||||
except Exception:
|
||||
# Language couldn't be found in the specified path
|
||||
pass
|
||||
# guarantee translations[catalog] exists
|
||||
# guarantee translators[catalog] exists
|
||||
if translator is None:
|
||||
translator = gettext.NullTranslations()
|
||||
has_translation = False
|
||||
|
@ -18,7 +18,8 @@ __all__ = ["Driver", "load_grammar"]
|
||||
# Python imports
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import sphinx
|
||||
|
||||
# Pgen imports
|
||||
from sphinx.pycode.pgen2 import grammar, parse, token, tokenize, pgen
|
||||
@ -120,7 +121,8 @@ def load_grammar(gt="Grammar.txt", gp=None,
|
||||
head, tail = os.path.splitext(gt)
|
||||
if tail == ".txt":
|
||||
tail = ""
|
||||
gp = head + tail + ".".join(map(str, sys.version_info[:2])) + ".pickle"
|
||||
# embed Sphinx major version for the case we ever change the grammar...
|
||||
gp = head + tail + ".".join(map(str, sphinx.version_info[:2])) + ".pickle"
|
||||
if force or not _newer(gp, gt):
|
||||
logger.info("Generating grammar tables from %s", gt)
|
||||
g = pgen.generate_grammar(gt)
|
||||
|
@ -306,8 +306,7 @@ class IndexBuilder(object):
|
||||
return self._stem_cache[word]
|
||||
_filter = self.lang.word_filter
|
||||
|
||||
for word in itertools.chain(visitor.found_title_words,
|
||||
self.lang.split(title)):
|
||||
for word in visitor.found_title_words:
|
||||
word = stem(word)
|
||||
if _filter(word):
|
||||
self._title_mapping.setdefault(word, set()).add(filename)
|
||||
|
@ -238,9 +238,11 @@
|
||||
\def\productioncont##1{\\& &\code{##1}}
|
||||
\parindent=2em
|
||||
\indent
|
||||
\begin{tabular}{lcl}
|
||||
\setlength{\LTpre}{0pt}
|
||||
\setlength{\LTpost}{0pt}
|
||||
\begin{longtable}[l]{lcl}
|
||||
}{%
|
||||
\end{tabular}
|
||||
\end{longtable}
|
||||
}
|
||||
|
||||
% Notices / Admonitions
|
||||
|
@ -150,7 +150,7 @@ var Search = {
|
||||
objectterms.push(tmp[i].toLowerCase());
|
||||
}
|
||||
|
||||
if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
|
||||
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
|
||||
tmp[i] === "") {
|
||||
// skip this "word"
|
||||
continue;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
from util import TestApp
|
||||
|
||||
from nose.tools import assert_equals
|
||||
from nose.tools import assert_equal
|
||||
|
||||
|
||||
app = env = None
|
||||
@ -64,6 +64,6 @@ def test_docinfo():
|
||||
}
|
||||
# I like this way of comparing dicts - easier to see the error.
|
||||
for key in exampledocinfo:
|
||||
yield assert_equals, exampledocinfo.get(key), expecteddocinfo.get(key)
|
||||
yield assert_equal, exampledocinfo.get(key), expecteddocinfo.get(key)
|
||||
# but then we still have to check for missing keys
|
||||
yield assert_equals, set(expecteddocinfo.keys()), set(exampledocinfo.keys())
|
||||
yield assert_equal, set(expecteddocinfo.keys()), set(exampledocinfo.keys())
|
||||
|
Loading…
Reference in New Issue
Block a user