summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py38
1 files changed, 21 insertions, 17 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index 3f03ffa7..dec9c13c 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -37,12 +37,10 @@ from sphinx.util.osutil import ENOENT
from sphinx.util.console import bold
-# Directive is either new-style or old-style
-clstypes = (type, types.ClassType)
-
# List of all known core events. Maps name to arguments description.
events = {
'builder-inited': '',
+ 'env-get-outdated': 'env, added, changed, removed',
'env-purge-doc': 'env, docname',
'source-read': 'docname, source text',
'doctree-read': 'the doctree before being pickled',
@@ -136,9 +134,8 @@ class Sphinx(object):
self._init_builder(buildername)
def _init_i18n(self):
- """
- Load translated strings from the configured localedirs if
- enabled in the configuration.
+ """Load translated strings from the configured localedirs if enabled in
+ the configuration.
"""
if self.config.language is not None:
self.info(bold('loading translations [%s]... ' %
@@ -368,6 +365,9 @@ class Sphinx(object):
elif key == 'man':
from sphinx.writers.manpage import ManualPageTranslator \
as translator
+ elif key == 'texinfo':
+ from sphinx.writers.texinfo import TexinfoTranslator \
+ as translator
else:
# ignore invalid keys for compatibility
continue
@@ -472,8 +472,11 @@ class Sphinx(object):
def add_stylesheet(self, filename):
from sphinx.builders.html import StandaloneHTMLBuilder
- StandaloneHTMLBuilder.css_files.append(
- posixpath.join('_static', filename))
+ if '://' in filename:
+ StandaloneHTMLBuilder.css_files.append(filename)
+ else:
+ StandaloneHTMLBuilder.css_files.append(
+ posixpath.join('_static', filename))
def add_lexer(self, alias, lexer):
from sphinx.highlighting import lexers
@@ -490,6 +493,11 @@ class Sphinx(object):
from sphinx.ext import autodoc
autodoc.AutoDirective._special_attrgetters[type] = getter
+ def add_search_language(self, cls):
+ from sphinx.search import languages, SearchLanguage
+ assert isinstance(cls, SearchLanguage)
+ languages[cls.lang] = cls
+
class TemplateBridge(object):
"""
@@ -498,8 +506,7 @@ class TemplateBridge(object):
"""
def init(self, builder, theme=None, dirs=None):
- """
- Called by the builder to initialize the template system.
+ """Called by the builder to initialize the template system.
*builder* is the builder object; you'll probably want to look at the
value of ``builder.config.templates_path``.
@@ -510,23 +517,20 @@ class TemplateBridge(object):
raise NotImplementedError('must be implemented in subclasses')
def newest_template_mtime(self):
- """
- Called by the builder to determine if output files are outdated
+ """Called by the builder to determine if output files are outdated
because of template changes. Return the mtime of the newest template
file that was changed. The default implementation returns ``0``.
"""
return 0
def render(self, template, context):
- """
- Called by the builder to render a template given as a filename with a
- specified context (a Python dictionary).
+ """Called by the builder to render a template given as a filename with
+ a specified context (a Python dictionary).
"""
raise NotImplementedError('must be implemented in subclasses')
def render_string(self, template, context):
- """
- Called by the builder to render a template given as a string with a
+ """Called by the builder to render a template given as a string with a
specified context (a Python dictionary).
"""
raise NotImplementedError('must be implemented in subclasses')