-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Implement mkdocs key from v2 config #4486
Changes from 1 commit
c1d791e
5918ce0
019fc27
8b077e9
050c974
c469d64
ce16fe7
9caace0
d9d2f25
b0d23a6
3962715
1aa8126
ca60dca
96f6241
a03da2b
357f034
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -555,6 +555,12 @@ class BuildConfigV2(BuildConfigBase): | |
'htmldir': 'sphinx_htmldir', | ||
'singlehtml': 'sphinx_singlehtml', | ||
} | ||
builders_display = { | ||
'mkdocs': 'MkDocs', | ||
'sphinx': 'Sphinx Html', | ||
'sphinx_htmldir': 'Sphinx HtmlDir', | ||
'sphinx_singlehtml': 'Sphinx Single Page HTML', | ||
} | ||
|
||
def validate(self): | ||
""" | ||
|
@@ -825,19 +831,19 @@ def validate_final_doc_type(self): | |
""" | ||
dashboard_doctype = self.defaults.get('doctype', 'sphinx') | ||
if self.doctype != dashboard_doctype: | ||
key = 'mkdocs' if self.doctype == 'mkdocs' else 'sphinx' | ||
needed_doctype = ( | ||
'mkdocs' if dashboard_doctype == 'mkdocs' else 'sphinx' | ||
) | ||
self.error( | ||
key, | ||
'Your project is configured as "{doctype}" in your admin ' | ||
'dashboard, but there is no "{key}" key specified.'.format( | ||
doctype=dashboard_doctype, | ||
key=needed_doctype, | ||
), | ||
code=INVALID_KEYS_COMBINATION, | ||
) | ||
error_msg = ( | ||
'Your project is configured as "{}" in your admin dashboard.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message shouldn't end with a period, it results in two sentence fragments:
It would be better as:
|
||
).format(self.builders_display[dashboard_doctype]) | ||
|
||
if dashboard_doctype == 'mkdocs' or not self.sphinx: | ||
error_msg += ' But there is no "{}" key specified.'.format( | ||
'mkdocs' if dashboard_doctype == 'mkdocs' else 'sphinx' | ||
) | ||
else: | ||
error_msg += ' But your "sphinx.builder" key does not match.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're no longer catching the case where the user has no sphinx key at all. I still think this needs to be a separate check on top of checking if there is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check for no sphinx key is above |
||
|
||
key = 'mkdocs' if self.doctype == 'mkdocs' else 'sphinx.builder' | ||
self.error(key, error_msg, code=INVALID_KEYS_COMBINATION) | ||
|
||
def validate_submodules(self): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to bring these from the db, as the config module is isolated from the other rtd code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably -1 on maintaining this in the config module separately. Was this to ensure we could move the config module out of rtd core?
I'd say either rely on the model field choices to report messages like ".. your project is configured as Sphinx HTMLdir", or skip all mentions of the Sphinx builder. I think what I was trying to describe in an earlier review was that we should skip mentioning the exact builder entirely if this complicates things too much (which seems like it is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was the reason. I think we can pair haha