Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support templating #5

Open
gsemet opened this issue May 30, 2018 · 5 comments
Open

Support templating #5

gsemet opened this issue May 30, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@gsemet
Copy link

gsemet commented May 30, 2018

Hello

Is it possible to add an option to change the default menu item names:

  • the first level has the name of the module while I'd like to have something like "API Reference". Could be an option such as apidoc_title = "API Reference"
  • is it possible to display the content of a module before its sub-modules?
  • using a lot git submodules, seeing "Submodules" in the menu is weird. Is it possible to simply skip this level and gather all sub-module inside the package?

So instead of:

mypackage_name
    mypackage_name package
        Submodules
            mypackage_name.one_module module
            mypackage_name.another_module module
            mypackage_name.yet_another_one module
        Module contents

We would have something like:

API Reference
    mypackage_name package
        Module contents
        mypackage_name.one_module module
        mypackage_name.another_module module
        mypackage_name.yet_another_one module
@stephenfin
Copy link
Member

This is not currently possible as the original Sphinx application that this extension utilizes, sphinx-apidoc, does not support templates or the likes. If we wanted to support this feature, we'd need to essentially vendor and rewrite that application or modify the application upstream so that we would get support for free with the next version of Sphinx. I'd be happy to help produce a PRs for either approach but it's not important enough for me to do solo.

@stephenfin stephenfin changed the title Option to override the default menu items name Support templating May 30, 2018
@stephenfin stephenfin added the enhancement New feature or request label May 30, 2018
@gsemet
Copy link
Author

gsemet commented May 30, 2018

Ok, I dig into it to see what can be done

  • module first is an option of sphinx apidoc: --module-first
  • the toc file can be skiped and manually recreated, that pretty much do the job.

So for the moment, sadly, I have disabled sphinx-contrib/apidoc and added this in my general makefile:

DOCS_EXCLUSION=$(foreach m, $(MODULES), $m/tests)

docs: clean-docs sdist docs-generate-apidoc docs-run-sphinx

docs-generate-apidoc:
	pipenv run sphinx-apidoc \
		--force \
		--separate \
		--module-first \
		--doc-project "API Reference" \
		-o docs/source/reference \
		$(PACKAGE_NAME) \
			$(DOCS_EXCLUSION)

docs-run-sphinx:
	pipenv run make -C docs/ html

clean-docs:
	rm -rf docs/_build docs/source/reference/*.rst

docs-open:
	xdg-open docs/_build/html/index.html

I'll see if I have time to exposes this in sphinxcontrib-apidoc in the future. Thanks for this package anyway!

@paulmelnikow
Copy link
Contributor

Is the solution to provide additional additional arguments to sphinx-apidoc? As far as I can tell --doc-project is ignored unless you use --full. However #9 adds an apidoc_module_first option and lets you specify whichever additional arguments you'd like.

@stephenfin
Copy link
Member

Is the solution to provide additional additional arguments to sphinx-apidoc? As far as I can tell --doc-project is ignored unless you use --full. However #9 adds an apidoc_module_first option and lets you specify whichever additional arguments you'd like.

Indeed, that's what I'd take out of this. @gsemet Thoughts?

@gsemet
Copy link
Author

gsemet commented Oct 3, 2018

seems great! thanks will try it asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants