mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixup windows newlines.
This commit is contained in:
parent
df53ece2f7
commit
24d303706f
@ -1,9 +1,9 @@
|
|||||||
:tocdepth: 2
|
:tocdepth: 2
|
||||||
|
|
||||||
.. _authors:
|
.. _authors:
|
||||||
|
|
||||||
Sphinx authors
|
Sphinx authors
|
||||||
==============
|
==============
|
||||||
|
|
||||||
.. include:: ../AUTHORS
|
.. include:: ../AUTHORS
|
||||||
|
|
||||||
|
2
sphinx/themes/basic/static/jquery.js
vendored
2
sphinx/themes/basic/static/jquery.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,89 +1,89 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
sphinx.util.i18n
|
sphinx.util.i18n
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Builder superclass for all builders.
|
Builder superclass for all builders.
|
||||||
|
|
||||||
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from babel.messages.pofile import read_po
|
from babel.messages.pofile import read_po
|
||||||
from babel.messages.mofile import write_mo
|
from babel.messages.mofile import write_mo
|
||||||
|
|
||||||
from sphinx.util.osutil import walk
|
from sphinx.util.osutil import walk
|
||||||
|
|
||||||
|
|
||||||
LocaleFileInfoBase = namedtuple('CatalogInfo', 'base_dir,domain')
|
LocaleFileInfoBase = namedtuple('CatalogInfo', 'base_dir,domain')
|
||||||
|
|
||||||
|
|
||||||
class CatalogInfo(LocaleFileInfoBase):
|
class CatalogInfo(LocaleFileInfoBase):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def po_file(self):
|
def po_file(self):
|
||||||
return self.domain + '.po'
|
return self.domain + '.po'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mo_file(self):
|
def mo_file(self):
|
||||||
return self.domain + '.mo'
|
return self.domain + '.mo'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def po_path(self):
|
def po_path(self):
|
||||||
return path.join(self.base_dir, self.po_file)
|
return path.join(self.base_dir, self.po_file)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mo_path(self):
|
def mo_path(self):
|
||||||
return path.join(self.base_dir, self.mo_file)
|
return path.join(self.base_dir, self.mo_file)
|
||||||
|
|
||||||
def is_outdated(self):
|
def is_outdated(self):
|
||||||
return (
|
return (
|
||||||
not path.exists(self.mo_path) or
|
not path.exists(self.mo_path) or
|
||||||
path.getmtime(self.mo_path) < path.getmtime(self.po_path))
|
path.getmtime(self.mo_path) < path.getmtime(self.po_path))
|
||||||
|
|
||||||
def write_mo(self, locale):
|
def write_mo(self, locale):
|
||||||
with open(self.po_path, 'rt') as po:
|
with open(self.po_path, 'rt') as po:
|
||||||
with open(self.mo_path, 'wb') as mo:
|
with open(self.mo_path, 'wb') as mo:
|
||||||
write_mo(mo, read_po(po, locale))
|
write_mo(mo, read_po(po, locale))
|
||||||
|
|
||||||
|
|
||||||
def get_catalogs(locale_dirs, locale, gettext_compact=False, force_all=False):
|
def get_catalogs(locale_dirs, locale, gettext_compact=False, force_all=False):
|
||||||
"""
|
"""
|
||||||
:param list locale_dirs:
|
:param list locale_dirs:
|
||||||
list of path as `['locale_dir1', 'locale_dir2', ...]` to find
|
list of path as `['locale_dir1', 'locale_dir2', ...]` to find
|
||||||
translation catalogs. Each path contains a structure such as
|
translation catalogs. Each path contains a structure such as
|
||||||
`<locale>/LC_MESSAGES/domain.po`.
|
`<locale>/LC_MESSAGES/domain.po`.
|
||||||
:param str locale: a language as `'en'`
|
:param str locale: a language as `'en'`
|
||||||
:param boolean gettext_compact:
|
:param boolean gettext_compact:
|
||||||
* False: keep domains directory structure (default).
|
* False: keep domains directory structure (default).
|
||||||
* True: domains in the sub directory will be merged into 1 file.
|
* True: domains in the sub directory will be merged into 1 file.
|
||||||
:param boolean force_all:
|
:param boolean force_all:
|
||||||
Set True if you want to get all catalogs rather than updated catalogs.
|
Set True if you want to get all catalogs rather than updated catalogs.
|
||||||
default is False.
|
default is False.
|
||||||
:return: [CatalogInfo(), ...]
|
:return: [CatalogInfo(), ...]
|
||||||
"""
|
"""
|
||||||
if not locale:
|
if not locale:
|
||||||
return [] # locale is not specified
|
return [] # locale is not specified
|
||||||
|
|
||||||
catalogs = set()
|
catalogs = set()
|
||||||
for locale_dir in locale_dirs:
|
for locale_dir in locale_dirs:
|
||||||
base_dir = path.join(locale_dir, locale, 'LC_MESSAGES')
|
base_dir = path.join(locale_dir, locale, 'LC_MESSAGES')
|
||||||
|
|
||||||
if not path.exists(base_dir):
|
if not path.exists(base_dir):
|
||||||
continue # locale path is not found
|
continue # locale path is not found
|
||||||
|
|
||||||
for dirpath, dirnames, filenames in walk(base_dir, followlinks=True):
|
for dirpath, dirnames, filenames in walk(base_dir, followlinks=True):
|
||||||
filenames = [f for f in filenames if f.endswith('.po')]
|
filenames = [f for f in filenames if f.endswith('.po')]
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
base = path.splitext(filename)[0]
|
base = path.splitext(filename)[0]
|
||||||
domain = path.relpath(path.join(dirpath, base), base_dir)
|
domain = path.relpath(path.join(dirpath, base), base_dir)
|
||||||
if gettext_compact and path.sep in domain:
|
if gettext_compact and path.sep in domain:
|
||||||
domain = path.split(domain)[0]
|
domain = path.split(domain)[0]
|
||||||
cat = CatalogInfo(base_dir, domain)
|
cat = CatalogInfo(base_dir, domain)
|
||||||
if force_all or cat.is_outdated():
|
if force_all or cat.is_outdated():
|
||||||
catalogs.add(cat)
|
catalogs.add(cat)
|
||||||
|
|
||||||
return catalogs
|
return catalogs
|
||||||
|
@ -1,80 +1,80 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
## set this by test
|
## set this by test
|
||||||
# import os
|
# import os
|
||||||
# import sys
|
# import sys
|
||||||
# sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
from sphinx.writers.html import HTMLTranslator
|
from sphinx.writers.html import HTMLTranslator
|
||||||
from sphinx.writers.latex import LaTeXTranslator
|
from sphinx.writers.latex import LaTeXTranslator
|
||||||
from sphinx.writers.manpage import ManualPageTranslator
|
from sphinx.writers.manpage import ManualPageTranslator
|
||||||
from sphinx.writers.texinfo import TexinfoTranslator
|
from sphinx.writers.texinfo import TexinfoTranslator
|
||||||
from sphinx.writers.text import TextTranslator
|
from sphinx.writers.text import TextTranslator
|
||||||
from sphinx.writers.websupport import WebSupportTranslator
|
from sphinx.writers.websupport import WebSupportTranslator
|
||||||
from docutils.writers.docutils_xml import XMLTranslator
|
from docutils.writers.docutils_xml import XMLTranslator
|
||||||
|
|
||||||
|
|
||||||
project = 'test'
|
project = 'test'
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
|
|
||||||
class ConfHTMLTranslator(HTMLTranslator):
|
class ConfHTMLTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfDirHTMLTranslator(HTMLTranslator):
|
class ConfDirHTMLTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfSingleHTMLTranslator(HTMLTranslator):
|
class ConfSingleHTMLTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfPickleTranslator(HTMLTranslator):
|
class ConfPickleTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfJsonTranslator(HTMLTranslator):
|
class ConfJsonTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfLaTeXTranslator(LaTeXTranslator):
|
class ConfLaTeXTranslator(LaTeXTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfManualPageTranslator(ManualPageTranslator):
|
class ConfManualPageTranslator(ManualPageTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfTexinfoTranslator(TexinfoTranslator):
|
class ConfTexinfoTranslator(TexinfoTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfTextTranslator(TextTranslator):
|
class ConfTextTranslator(TextTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfWebSupportTranslator(WebSupportTranslator):
|
class ConfWebSupportTranslator(WebSupportTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfXMLTranslator(XMLTranslator):
|
class ConfXMLTranslator(XMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfPseudoXMLTranslator(XMLTranslator):
|
class ConfPseudoXMLTranslator(XMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.set_translator('html', ConfHTMLTranslator)
|
app.set_translator('html', ConfHTMLTranslator)
|
||||||
app.set_translator('dirhtml', ConfDirHTMLTranslator)
|
app.set_translator('dirhtml', ConfDirHTMLTranslator)
|
||||||
app.set_translator('singlehtml', ConfSingleHTMLTranslator)
|
app.set_translator('singlehtml', ConfSingleHTMLTranslator)
|
||||||
app.set_translator('pickle', ConfPickleTranslator)
|
app.set_translator('pickle', ConfPickleTranslator)
|
||||||
app.set_translator('json', ConfJsonTranslator)
|
app.set_translator('json', ConfJsonTranslator)
|
||||||
app.set_translator('latex', ConfLaTeXTranslator)
|
app.set_translator('latex', ConfLaTeXTranslator)
|
||||||
app.set_translator('man', ConfManualPageTranslator)
|
app.set_translator('man', ConfManualPageTranslator)
|
||||||
app.set_translator('texinfo', ConfTexinfoTranslator)
|
app.set_translator('texinfo', ConfTexinfoTranslator)
|
||||||
app.set_translator('text', ConfTextTranslator)
|
app.set_translator('text', ConfTextTranslator)
|
||||||
app.set_translator('websupport', ConfWebSupportTranslator)
|
app.set_translator('websupport', ConfWebSupportTranslator)
|
||||||
app.set_translator('xml', ConfXMLTranslator)
|
app.set_translator('xml', ConfXMLTranslator)
|
||||||
app.set_translator('pseudoxml', ConfPseudoXMLTranslator)
|
app.set_translator('pseudoxml', ConfPseudoXMLTranslator)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
=======================
|
=======================
|
||||||
Test API set_translator
|
Test API set_translator
|
||||||
=======================
|
=======================
|
@ -1,9 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.abspath('.')))
|
sys.path.insert(0, os.path.dirname(os.path.abspath('.')))
|
||||||
|
|
||||||
project = 'test'
|
project = 'test'
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from sphinx.writers.html import HTMLTranslator
|
from sphinx.writers.html import HTMLTranslator
|
||||||
|
|
||||||
class ExtHTMLTranslator(HTMLTranslator):
|
class ExtHTMLTranslator(HTMLTranslator):
|
||||||
pass
|
pass
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
docutils conf
|
docutils conf
|
||||||
=============
|
=============
|
||||||
|
|
||||||
field-name-limit
|
field-name-limit
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
:short: desc
|
:short: desc
|
||||||
:long long long long: long title
|
:long long long long: long title
|
||||||
|
|
||||||
option-limit
|
option-limit
|
||||||
------------
|
------------
|
||||||
|
|
||||||
--short short desc
|
--short short desc
|
||||||
--long-long-long-long long desc
|
--long-long-long-long long desc
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from .mod1 import func1, Class1
|
from .mod1 import func1, Class1
|
||||||
from .mod2 import (
|
from .mod2 import (
|
||||||
func2,
|
func2,
|
||||||
Class2,
|
Class2,
|
||||||
)
|
)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
mod1
|
mod1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def func1(a, b):
|
def func1(a, b):
|
||||||
"""
|
"""
|
||||||
this is func1
|
this is func1
|
||||||
"""
|
"""
|
||||||
return a, b
|
return a, b
|
||||||
|
|
||||||
|
|
||||||
class Class1(object):
|
class Class1(object):
|
||||||
"""
|
"""
|
||||||
this is Class1
|
this is Class1
|
||||||
"""
|
"""
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
mod2
|
mod2
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def func2(a, b):
|
def func2(a, b):
|
||||||
"""
|
"""
|
||||||
this is func2
|
this is func2
|
||||||
"""
|
"""
|
||||||
return a, b
|
return a, b
|
||||||
|
|
||||||
|
|
||||||
class Class2(object):
|
class Class2(object):
|
||||||
"""
|
"""
|
||||||
this is Class2
|
this is Class2
|
||||||
"""
|
"""
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
:tocdepth: 2
|
:tocdepth: 2
|
||||||
|
|
||||||
i18n with python domain refs
|
i18n with python domain refs
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
.. currentmodule:: sensitive
|
.. currentmodule:: sensitive
|
||||||
|
|
||||||
See this decorator: :func:`sensitive_variables`.
|
See this decorator: :func:`sensitive_variables`.
|
||||||
|
|
||||||
.. function:: sensitive_variables(*variables)
|
.. function:: sensitive_variables(*variables)
|
||||||
|
|
||||||
Some description
|
Some description
|
||||||
|
|
||||||
.. currentmodule:: reporting
|
.. currentmodule:: reporting
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
subdir contents
|
subdir contents
|
||||||
===============
|
===============
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
contents
|
contents
|
||||||
=========
|
=========
|
||||||
|
|
||||||
spam egg ham
|
spam egg ham
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user