Skip to content

Commit

Permalink
Fix up init_sphinx_extension_doc (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
rly authored Nov 10, 2021
1 parent b27c899 commit b06ad3a
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions hdmf_docutils/init_sphinx_extension_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += \
Expand Down Expand Up @@ -346,15 +346,20 @@ 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
###########################################################################
import sphinx_rtd_theme # noqa: E402
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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b06ad3a

Please sign in to comment.