diff --git a/CONTRIBUTING.rst b/.overrides/CONTRIBUTING.rst similarity index 100% rename from CONTRIBUTING.rst rename to .overrides/CONTRIBUTING.rst diff --git a/.overrides/README.rst b/.overrides/README.rst new file mode 100644 index 0000000000..cb924fa52d --- /dev/null +++ b/.overrides/README.rst @@ -0,0 +1,11 @@ +Overrides +========= + +This directory is recursively copied into `cpython/Doc`. +It needs to have the same structure than `cpython/Doc`. + +It allows us + +- to have our own `CONTRIBUTING.rst` guide +- change the index sidebar with links that are interesting for translators +- etc diff --git a/.overrides/tools/templates/customsourcelink.html b/.overrides/tools/templates/customsourcelink.html new file mode 100644 index 0000000000..25758c2065 --- /dev/null +++ b/.overrides/tools/templates/customsourcelink.html @@ -0,0 +1,13 @@ +{%- if show_source and has_source and sourcename %} +
+

{{ _('This Page') }}

+ +
+{%- endif %} diff --git a/.overrides/tools/templates/indexsidebar.html b/.overrides/tools/templates/indexsidebar.html new file mode 100644 index 0000000000..0b57a66a20 --- /dev/null +++ b/.overrides/tools/templates/indexsidebar.html @@ -0,0 +1,11 @@ +

¡Ayúdanos a traducir!

+ + +

Recursos

+ diff --git a/conf.py b/conf.py index 9b63559aff..f53eac6d1a 100644 --- a/conf.py +++ b/conf.py @@ -33,7 +33,22 @@ os.system('mkdir -p cpython/locales/es/') os.system('ln -nfs `pwd` cpython/locales/es/LC_MESSAGES') -os.system('ln -nfs `pwd`/CONTRIBUTING.rst cpython/Doc/CONTRIBUTING.rst') + + +# 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