Created
March 10, 2017 16:30
-
-
Save rhelmer/5203dd4aef3530527d4c2c120d76a83a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sphinx_js/__init__.py b/sphinx_js/__init__.py | |
index 7f2e6b4..09073c3 100644 | |
--- a/sphinx_js/__init__.py | |
+++ b/sphinx_js/__init__.py | |
@@ -24,6 +24,7 @@ def setup(app): | |
# TODO: We could add a js:module with app.add_directive_to_domain(). | |
app.add_config_value('js_source_path', '../', 'env') | |
+ app.add_config_value('js_config_path', None, 'env') | |
def read_all_docs(app, env, doc_names): | |
diff --git a/sphinx_js/jsdoc.py b/sphinx_js/jsdoc.py | |
index cb34875..7b73f56 100644 | |
--- a/sphinx_js/jsdoc.py | |
+++ b/sphinx_js/jsdoc.py | |
@@ -5,7 +5,10 @@ from subprocess import check_output | |
def run_jsdoc(app): | |
"""Run JSDoc across a whole codebase, and squirrel away its results.""" | |
# JSDoc defaults to utf8-encoded output. | |
- doclets = loads(check_output(['jsdoc', app.config.js_source_path, '-X']).decode('utf8')) | |
+ jsdoc_command = ['jsdoc', app.config.js_source_path, '-X'] | |
+ if app.config.js_config_path: | |
+ jsdoc_command.extend(['-c', app.config.js_config_path]) | |
+ doclets = loads(check_output(jsdoc_command).decode('utf8')) | |
app._sphinxjs_jsdoc_output = dict((d['longname'], d) for d in doclets | |
if d.get('comment') | |
and not d.get('undocumented')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment