Преглед изворни кода

Adjusted Sphinx configuration to handle 'en' and 'zh_CN' language versions

krzychb пре 8 година
родитељ
комит
56d5647d3f
4 измењених фајлова са 29 додато и 29 уклоњено
  1. 13 13
      docs/en/conf.py
  2. 2 2
      docs/gen-dxd.py
  3. 1 1
      docs/gen-kconfig-doc.py
  4. 13 13
      docs/zh_CN/conf.py

+ 13 - 13
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

+ 2 - 2
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"

+ 1 - 1
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

+ 13 - 13
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