From b06ad3a455278064dfa3ef4ef1ca08dac7f0493a Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Wed, 10 Nov 2021 01:04:22 -0800 Subject: [PATCH] Fix up init_sphinx_extension_doc (#71) --- hdmf_docutils/init_sphinx_extension_doc.py | 31 +++++++--------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/hdmf_docutils/init_sphinx_extension_doc.py b/hdmf_docutils/init_sphinx_extension_doc.py index befda0f..7091d05 100644 --- a/hdmf_docutils/init_sphinx_extension_doc.py +++ b/hdmf_docutils/init_sphinx_extension_doc.py @@ -263,8 +263,8 @@ def get_format_rst(spec_output_dir, output_master, project): def get_index_rst(project, format_master, custom_description=None, custom_release_notes=None): index_rst = \ """Specification for the %s extension -================================== -""" % project +%s +""" % (project, '=' * (len(project) + 32)) if custom_description is not None: index_rst += \ @@ -346,7 +346,9 @@ def get_custom_settings(utils_dir, """ # Define the base html and latex settings custom_sphinx_settings = \ -"""############################################################################ +""" + +############################################################################ # CUSTOM CONFIGURATIONS ADDED BY THE NWB TOOL FOR GENERATING FORMAT DOCS ########################################################################### @@ -354,7 +356,10 @@ def get_custom_settings(utils_dir, import textwrap # noqa: E402 # -- Options for intersphinx --------------------------------------------- -intersphinx_mapping = {'core': ('https://nwb-schema.readthedocs.io/en/latest/', None)} +intersphinx_mapping.update({ + 'core': ('https://nwb-schema.readthedocs.io/en/latest/', None), + 'hdmf-common': ('https://hdmf-common-schema.readthedocs.io/en/latest/', None), +}) # -- Generate sources from YAML--------------------------------------------------- # Always rebuild the source docs from YAML even if the folder with the source files already exists @@ -758,7 +763,7 @@ def define_cl_args(): parser.add_argument('--release', dest='release', action='store', type=str, required=True, help='Release of the project/docs') parser.add_argument('--language', dest='language', action='store', type=str, required=False, - help='Document language', default='English') + help='Document language', default='en') parser.add_argument('--master', dest='master', action='store', type=str, required=False, help='Master document name', default='index.rst') parser.add_argument('--credits_master', dest='credits_master', action='store', type=str, required=False, @@ -920,26 +925,10 @@ def init_sphinx(project, author, version, release, language, sphinx_master, outp print("Cleaning file %s" % conf_py) - # Remove example of intersphinx configuration - _remove_lines( - conf_py, - ['# Example configuration for intersphinx: refer to the Python standard library.', - 'intersphinx_mapping = {\'https://docs.python.org/\': None}'] - ) - - # Fix indent of intersphinx extension list - _replace_line_text(conf_py, ' \'sphinx.ext.', ' \'sphinx.ext.') - - # Remove timestamp info added by sphinx-quickstart - _remove_lines_after(conf_py, '# simulation_output documentation build configuration file, created by', 5) - _remove_lines(conf_py, ['# simulation_output documentation build configuration file, created by']) - # Remove empty directories os.rmdir(os.path.join(output, "build")) os.rmdir(os.path.join(output, "source", "_templates")) - # Remove empty lines from the end of files - _write_lines(conf_py, _read_lines(conf_py)[:-2]) except CalledProcessError: exit(0)