From: krzychb Date: Sat, 3 Feb 2018 21:12:13 +0000 (+0100) Subject: Adjusted Sphinx configuration to handle 'en' and 'zh_CN' language versions X-Git-Tag: v3.1-beta1~360^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56d5647d3fdaa4ee47548525d228ab7ea3511ae9;p=esp-idf Adjusted Sphinx configuration to handle 'en' and 'zh_CN' language versions --- diff --git a/docs/en/conf.py b/docs/en/conf.py index a2cafdbf0a..7031188b93 100644 --- a/docs/en/conf.py +++ b/docs/en/conf.py @@ -14,13 +14,13 @@ import sys, os import re -from subprocess import call, Popen, PIPE +from subprocess import Popen, PIPE import shlex # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) from local_util import run_cmd_get_output, copy_if_modified @@ -30,17 +30,17 @@ if 'BUILDDIR' in os.environ: # Call Doxygen to get XML files from the header files print "Calling Doxygen to generate latest XML files" -call('doxygen') +os.system("doxygen ../Doxyfile") # Doxygen has generated XML files in 'xml' directory. # Copy them to 'xml_in', only touching the files which have changed. copy_if_modified('xml/', 'xml_in/') # Generate 'api_name.inc' files using the XML files by Doxygen -os.system('python gen-dxd.py') +os.system('python ../gen-dxd.py') # Generate 'kconfig.inc' file from components' Kconfig files kconfig_inc_path = '{}/inc/kconfig.inc'.format(builddir) -os.system('python gen-kconfig-doc.py > ' + kconfig_inc_path + '.in') +os.system('python ../gen-kconfig-doc.py > ' + kconfig_inc_path + '.in') copy_if_modified(kconfig_inc_path + '.in', kconfig_inc_path) # http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format @@ -66,12 +66,12 @@ extensions = ['breathe', ] # Set up font for blockdiag, nwdiag, rackdiag and packetdiag -blockdiag_fontpath = '_static/DejaVuSans.ttf' -seqdiag_fontpath = '_static/DejaVuSans.ttf' -actdiag_fontpath = '_static/DejaVuSans.ttf' -nwdiag_fontpath = '_static/DejaVuSans.ttf' -rackdiag_fontpath = '_static/DejaVuSans.ttf' -packetdiag_fontpath = '_static/DejaVuSans.ttf' +blockdiag_fontpath = '../_static/DejaVuSans.ttf' +seqdiag_fontpath = '../_static/DejaVuSans.ttf' +actdiag_fontpath = '../_static/DejaVuSans.ttf' +nwdiag_fontpath = '../_static/DejaVuSans.ttf' +rackdiag_fontpath = '../_static/DejaVuSans.ttf' +packetdiag_fontpath = '../_static/DejaVuSans.ttf' # Breathe extension variables @@ -120,7 +120,7 @@ print 'Version: {0} Release: {1}'.format(version, release) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -190,7 +190,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/docs/gen-dxd.py b/docs/gen-dxd.py index 4ebf06b43d..0737d94f6d 100644 --- a/docs/gen-dxd.py +++ b/docs/gen-dxd.py @@ -16,10 +16,10 @@ if 'BUILDDIR' in os.environ: builddir = os.environ['BUILDDIR'] # Script configuration -header_file_path_prefix = "../components/" +header_file_path_prefix = "../../components/" """string: path prefix for header files. """ -doxyfile_path = "Doxyfile" +doxyfile_path = "../Doxyfile" """string: path to a file containing header files to processs. """ xml_directory_path = "xml" diff --git a/docs/gen-kconfig-doc.py b/docs/gen-kconfig-doc.py index 0c35dc60b1..a141641199 100755 --- a/docs/gen-kconfig-doc.py +++ b/docs/gen-kconfig-doc.py @@ -106,7 +106,7 @@ def print_all_components(): heading_level = INITIAL_HEADING_LEVEL # Currently this works only for IDF components. # TODO: figure out if this can be re-used for documenting applications? - components_path = os.path.join(os.path.curdir, '..', 'components') + components_path = os.path.join(os.path.curdir, '../..', 'components') for component_name in os.listdir(components_path): if component_name.startswith('.'): continue # skip system thumbnail folders diff --git a/docs/zh_CN/conf.py b/docs/zh_CN/conf.py index aee4803d43..bb24f6caa4 100644 --- a/docs/zh_CN/conf.py +++ b/docs/zh_CN/conf.py @@ -14,23 +14,23 @@ import sys, os import re -from subprocess import call, Popen, PIPE +from subprocess import Popen, PIPE import shlex # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('..')) from repo_util import run_cmd_get_output # Call Doxygen to get XML files from the header files print "Calling Doxygen to generate latest XML files" -call('doxygen') +os.system("doxygen ../Doxyfile") # Generate 'api_name.inc' files using the XML files by Doxygen -os.system("python gen-dxd.py") +os.system("python ../gen-dxd.py") # Generate 'kconfig.inc' file from components' Kconfig files -os.system("python gen-kconfig-doc.py > _build/inc/kconfig.inc") +os.system("python ../gen-kconfig-doc.py > _build/inc/kconfig.inc") # http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format # @@ -55,12 +55,12 @@ extensions = ['breathe', ] # Set up font for blockdiag, nwdiag, rackdiag and packetdiag -blockdiag_fontpath = '_static/DejaVuSans.ttf' -seqdiag_fontpath = '_static/DejaVuSans.ttf' -actdiag_fontpath = '_static/DejaVuSans.ttf' -nwdiag_fontpath = '_static/DejaVuSans.ttf' -rackdiag_fontpath = '_static/DejaVuSans.ttf' -packetdiag_fontpath = '_static/DejaVuSans.ttf' +blockdiag_fontpath = '../_static/DejaVuSans.ttf' +seqdiag_fontpath = '../_static/DejaVuSans.ttf' +actdiag_fontpath = '../_static/DejaVuSans.ttf' +nwdiag_fontpath = '../_static/DejaVuSans.ttf' +rackdiag_fontpath = '../_static/DejaVuSans.ttf' +packetdiag_fontpath = '../_static/DejaVuSans.ttf' # Breathe extension variables breathe_projects = { "esp32-idf": "xml/" } @@ -105,7 +105,7 @@ print 'Version: {0} Release: {1}'.format(version, release) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +language = 'zh_CN' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -175,7 +175,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied