mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 0.6
This commit is contained in:
11
CHANGES
11
CHANGES
@@ -135,6 +135,17 @@ Release 1.0 (in development)
|
||||
Release 0.6.6 (in development)
|
||||
==============================
|
||||
|
||||
* #409: Make the ``highlight_language`` config value work properly
|
||||
in the LaTeX builder.
|
||||
|
||||
* #418: Allow relocation of the translation JavaScript files to
|
||||
the system directory on Unix systems.
|
||||
|
||||
* #414: Fix handling of Windows newlines in files included with
|
||||
the ``literalinclude`` directive.
|
||||
|
||||
* #377: Fix crash in linkcheck builder.
|
||||
|
||||
* #387: Fix the display of search results in ``dirhtml`` output.
|
||||
|
||||
* #376: In autodoc, fix display of parameter defaults containing
|
||||
|
||||
@@ -18,6 +18,7 @@ help:
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files called index.html in directories"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make json files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " epub to make an epub file"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@@ -56,6 +57,10 @@ man:
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
|
||||
|
||||
json:
|
||||
mkdir -p _build/json _build/doctrees
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
|
||||
@echo
|
||||
|
||||
9
setup.py
9
setup.py
@@ -1,10 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
try:
|
||||
from setuptools import setup, find_packages
|
||||
except ImportError:
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
from distutils import log
|
||||
|
||||
import sphinx
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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:':
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -207,8 +207,11 @@ 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 +334,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 +356,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 +1153,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']
|
||||
|
||||
Reference in New Issue
Block a user