FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-docs-es/conf.py at 3.8 · erickgnavar/python-docs-es · GitHub
erickgnavar
/
python-docs-es
Public
forked from
python/python-docs-es
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-docs-es
/
conf.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
90 lines (71 loc) · 3.2 KB
Breadcrumbs
python-docs-es
/
conf.py
Copy path
File metadata and controls
90 lines (71 loc) · 3.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Sphinx configuration file.
#
# - import original configurations from cpython/Doc/conf.py
# - append the path considering the cpython submodule is at ./cpython
# - create the symbolic links under ./cpython/locale/es/LC_MESSAGES
# - make the build to work under Read the Docs
#
# The git submodule was created using this Stack Overflow answer
# to fetch only the commit that I needed and avoid clonning the whole history
# https://stackoverflow.com/a/27445058
#
# This can be built locally using `sphinx-build` by running
#
# $ sphinx-build -b html -n -d _build/doctrees -D language=es . _build/html
import
sys
,
os
,
time
sys
.
path
.
append
(
os
.
path
.
abspath
(
'cpython/Doc/tools/extensions'
))
sys
.
path
.
append
(
os
.
path
.
abspath
(
'cpython/Doc/includes'
))
# Import all the Sphinx settings from cpython
sys
.
path
.
append
(
os
.
path
.
abspath
(
'cpython/Doc'
))
from
conf
import
*
# Call patchlevel with the proper path to get the version from
# instead of hardcoding it
import
patchlevel
version
,
release
=
patchlevel
.
get_header_version_info
(
os
.
path
.
abspath
(
'cpython/Doc'
))
project
=
'Python en Español'
copyright
=
'2001-%s, Python Software Foundation'
%
time
.
strftime
(
'%Y'
)
html_theme_path
=
[
'cpython/Doc/tools'
]
templates_path
=
[
'cpython/Doc/tools/templates'
]
html_static_path
=
[
'cpython/Doc/tools/static'
]
os
.
system
(
'mkdir -p cpython/locales/es/'
)
os
.
system
(
'ln -nfs `pwd` cpython/locales/es/LC_MESSAGES'
)
if
not
os
.
environ
.
get
(
'SPHINX_GETTEXT'
)
==
'True'
:
# Override all the files from ``.overrides`` directory
import
glob
for
root
,
dirs
,
files
in
os
.
walk
(
'.overrides'
):
for
fname
in
files
:
if
fname
==
'README.rst'
and
root
==
'.overrides'
:
continue
destroot
=
root
.
replace
(
'.overrides'
,
''
).
lstrip
(
'/'
)
outputdir
=
os
.
path
.
join
(
'cpython'
,
'Doc'
,
destroot
,
fname
,
)
os
.
system
(
f'ln -nfs `pwd`/
{
root
}
/
{
fname
}
{
outputdir
}
'
)
gettext_compact
=
False
locale_dirs
=
[
'../locales'
,
'cpython/locales'
]
# relative to the sourcedir
def
setup
(
app
):
def
add_contributing_banner
(
app
,
doctree
):
"""
Insert a banner at the top of the index.
This way, we can easily communicate people to help with the translation,
pointing them to different resources.
"""
if
app
.
builder
.
format
!=
'html'
:
# Do not include the banner when building with other formats
# (this is useful when using -b gettext)
return
from
docutils
import
nodes
,
core
message
=
'¡Ayúdanos a traducir la documentación oficial de Python al Español! '
\
f'Puedes encontrar más información en `Como contribuir </es/
{
version
}
/CONTRIBUTING.html>`_. '
\
'Ayuda a acercar Python a más personas de habla hispana.'
paragraph
=
core
.
publish_doctree
(
message
)[
0
]
banner
=
nodes
.
warning
(
ids
=
[
'contributing-banner'
])
banner
.
append
(
paragraph
)
for
document
in
doctree
.
traverse
(
nodes
.
document
):
document
.
insert
(
0
,
banner
)
# Change the sourcedir programmatically because Read the Docs always call it with `.`
app
.
srcdir
=
'cpython/Doc'
app
.
connect
(
'doctree-read'
,
add_contributing_banner
)
Back
|
FazBrowse Home
|
New Git URL