summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa+bitbucket@gmail.com>2013-09-23 23:01:48 +0900
committerTakayuki Shimizukawa <shimizukawa+bitbucket@gmail.com>2013-09-23 23:01:48 +0900
commit1ad300bd9ccf0619a5221ddedd1210dbaebb376b (patch)
tree7a560dcc32b524c27e8797fb837d2238d5113cfe
parentca287866446f05686f9c351cf99b8c13263977fc (diff)
parentd77152916b265d1739c33d6b59a89b04bb6ce923 (diff)
downloadsphinx-1ad300bd9ccf0619a5221ddedd1210dbaebb376b.tar.gz
Merged in alimony/sphinx/add_missing_epub_options (pull request #170)
Add two missing epub options to the default conf.py
-rw-r--r--CHANGES20
-rw-r--r--doc/config.rst6
-rw-r--r--doc/develop.rst1
-rw-r--r--sphinx/quickstart.py2
-rw-r--r--sphinx/transforms.py7
-rw-r--r--sphinx/writers/latex.py12
-rw-r--r--tests/roots/test-intl/label_target.po6
-rw-r--r--tests/roots/test-intl/label_target.txt12
-rw-r--r--tests/test_build_latex.py2
-rw-r--r--tests/test_build_texinfo.py4
-rw-r--r--tests/test_intl.py10
11 files changed, 75 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 2207ba30..ee71a916 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,23 @@
+Release 1.2 (in development)
+============================
+
+Features added
+--------------
+
+Incompatible changes
+--------------------
+
+* PR#154: Remove "sphinx" prefix from LaTeX class name except 'sphinxmanual'
+ and 'sphinxhowto'. Now you can use your custom document class without
+ 'sphinx' prefix. Thanks to Erik B.
+
+Bugs fixed
+----------
+
+* #1265: Fix i18n: crash when translating section name that is pointed from
+ named target.
+
+
Release 1.2 beta2 (released Sep 17, 2013)
=========================================
diff --git a/doc/config.rst b/doc/config.rst
index 70ebacb4..70ccd26e 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -1016,11 +1016,17 @@ These options influence LaTeX output.
"sphinx" package in order to define Sphinx' custom LaTeX commands.
"howto" documents will not get appendices. Also, howtos will have a simpler
title page.
+
* *toctree_only*: Must be ``True`` or ``False``. If ``True``, the *startdoc*
document itself is not included in the output, only the documents
referenced by it via TOC trees. With this option, you can put extra stuff
in the master document that shows up in the HTML, but not the LaTeX output.
+ .. versionadded:: 1.2
+ In the past including your own document class required you to prepend the
+ document class name with the string "sphinx". This is not necessary
+ anymore.
+
.. versionadded:: 0.3
The 6th item ``toctree_only``. Tuples with 5 items are still accepted.
diff --git a/doc/develop.rst b/doc/develop.rst
index 4181cde8..fad5982e 100644
--- a/doc/develop.rst
+++ b/doc/develop.rst
@@ -11,6 +11,7 @@ Sphinx is a maintained by a group of volunteers. We value every contribution!
<http://bitbucket.org/birkenfeld/sphinx/issues/>`_.
* The mailing list for development is at `Google Groups
<http://groups.google.com/group/sphinx-dev/>`_.
+* There is also #sphinx-doc IRC channel on `freenode <http://freenode.net/>`_.
For more about our development process and methods, see the :doc:`devguide`.
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index f1797ad3..a4dca333 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -236,7 +236,7 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
-# author, documentclass [howto/manual]).
+# author, documentclass [howto, manual, or own class]).
latex_documents = [
('%(master_str)s', '%(project_fn)s.tex', u'%(project_doc_texescaped_str)s',
u'%(author_texescaped_str)s', 'manual'),
diff --git a/sphinx/transforms.py b/sphinx/transforms.py
index cf1040cf..338d4739 100644
--- a/sphinx/transforms.py
+++ b/sphinx/transforms.py
@@ -242,6 +242,13 @@ class Locale(Transform):
self.document.note_implicit_target(
section_node, section_node)
+ # replace target's refname to new target name
+ def is_named_target(node):
+ return isinstance(node, nodes.target) and \
+ node.get('refname') == old_name
+ for old_target in self.document.traverse(is_named_target):
+ old_target['refname'] = new_name
+
processed = True
# glossary terms update refid
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index b67638a2..ce92edfc 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -167,6 +167,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
'transition': '\n\n\\bigskip\\hrule{}\\bigskip\n\n',
}
+ # sphinx specific document classes
+ docclasses = ('howto', 'manual')
+
def __init__(self, document, builder):
nodes.NodeVisitor.__init__(self, document)
self.builder = builder
@@ -179,7 +182,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.elements = self.default_elements.copy()
self.elements.update({
- 'wrapperclass': 'sphinx' + document.settings.docclass,
+ 'wrapperclass': self.format_docclass(document.settings.docclass),
'papersize': papersize,
'pointsize': builder.config.latex_font_size,
# if empty, the title is set to the first section title
@@ -276,6 +279,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.previous_spanning_column = 0
self.remember_multirow = {}
+ def format_docclass(self, docclass):
+ """ prepends prefix to sphinx document classes
+ """
+ if docclass in self.docclasses:
+ docclass = 'sphinx' + docclass
+ return docclass
+
def astext(self):
return (HEADER % self.elements +
self.highlighter.get_stylesheet() +
diff --git a/tests/roots/test-intl/label_target.po b/tests/roots/test-intl/label_target.po
index 2e600f6d..69844016 100644
--- a/tests/roots/test-intl/label_target.po
+++ b/tests/roots/test-intl/label_target.po
@@ -50,3 +50,9 @@ msgid ""
msgstr ""
"`X DUPLICATED SUB SECTION`_ IS BROKEN LINK."
+msgid "label bridged target section"
+msgstr "X LABEL BRIDGED TARGET SECTION"
+
+msgid "`bridge label`_ is not translatable but linked to translated section title."
+msgstr "X `bridge label`_ IS NOT TRANSLATABLE BUT LINKED TO TRANSLATED SECTION TITLE."
+
diff --git a/tests/roots/test-intl/label_target.txt b/tests/roots/test-intl/label_target.txt
index b597abe7..635de847 100644
--- a/tests/roots/test-intl/label_target.txt
+++ b/tests/roots/test-intl/label_target.txt
@@ -47,8 +47,18 @@ duplicated sub section
------------------------
.. This section have no label, but the section was a duplicate name.
-.. THis case, a duplicated target id is generated by docutils.
+.. This case, a duplicated target id is generated by docutils.
.. There is no way to link to this section's duplicated id like ``id2`` by
.. using formal reStructuredText markup.
+
+.. _bridge label: `label bridged target section`_
+
+label bridged target section
+=============================
+
+.. This section is targeted through label definition.
+
+`bridge label`_ is not translatable but linked to translated section title.
+
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index 50aef045..016c7aae 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -86,7 +86,7 @@ def test_latex(app):
p = Popen(['pdflatex', '--interaction=nonstopmode',
'SphinxTests.tex'], stdout=PIPE, stderr=PIPE)
except OSError:
- pass # most likely pdflatex was not found
+ raise SkipTest # most likely pdflatex was not found
else:
stdout, stderr = p.communicate()
if p.returncode != 0:
diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py
index eb60fb8f..bf3cc49f 100644
--- a/tests/test_build_texinfo.py
+++ b/tests/test_build_texinfo.py
@@ -17,7 +17,7 @@ from subprocess import Popen, PIPE
from sphinx.writers.texinfo import TexinfoTranslator
-from util import with_app, test_root, remove_unicode_literals
+from util import test_root, SkipTest, remove_unicode_literals, with_app
from test_build_html import ENV_WARNINGS
@@ -56,7 +56,7 @@ def test_texinfo(app):
p = Popen(['makeinfo', '--no-split', 'SphinxTests.texi'],
stdout=PIPE, stderr=PIPE)
except OSError:
- pass # most likely makeinfo was not found
+ raise SkipTest # most likely makeinfo was not found
else:
stdout, stderr = p.communicate()
retcode = p.returncode
diff --git a/tests/test_intl.py b/tests/test_intl.py
index 67ab9578..13cdc84a 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -420,7 +420,7 @@ def test_i18n_role_xref(app):
@with_intl_app(buildername='xml', warning=warnfile)
def test_i18n_label_target(app):
- # regression test for #1193
+ # regression test for #1193, #1265
app.builder.build(['label_target'])
et = ElementTree.parse(app.outdir / 'label_target.xml')
secs = et.findall('section')
@@ -455,6 +455,14 @@ def test_i18n_label_target(app):
texts=['`X DUPLICATED SUB SECTION`_', 'IS BROKEN LINK.'],
refs=[])
+ para3 = secs[3].findall('paragraph')
+ assert_elem(
+ para3[0],
+ texts=['X', 'bridge label',
+ 'IS NOT TRANSLATABLE BUT LINKED TO TRANSLATED ' +
+ 'SECTION TITLE.'],
+ refs=['label-bridged-target-section'])
+
@with_intl_app(buildername='text', warning=warnfile)
def test_i18n_glossary_terms_inconsistency(app):