Skip to content

Commit

Permalink
Merge pull request #8556 from tk0miya/8549_gettext_compact=0
Browse files Browse the repository at this point in the history
Fix #8549: i18n: ``-D gettext_compact=0`` is no longer working
  • Loading branch information
tk0miya committed Dec 20, 2020
2 parents 6e8ea85 + 1977f3f commit 723294f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Bugs fixed
* #8501: autosummary: summary extraction splits text after "el at." unexpectedly
* #8524: html: Wrong url_root has been generated on a document named "index"
* #8419: html search: Do not load ``language_data.js`` in non-search pages
* #8549: i18n: ``-D gettext_compact=0`` is no longer working
* #8454: graphviz: The layout option for graph and digraph directives don't work
* #8131: linkcheck: Use GET when HEAD requests cause Too Many Redirects, to
accommodate infinite redirect loops on HEAD
Expand Down
2 changes: 1 addition & 1 deletion sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def finish(self) -> None:
def setup(app: Sphinx) -> Dict[str, Any]:
app.add_builder(MessageCatalogBuilder)

app.add_config_value('gettext_compact', True, 'gettext', Any)
app.add_config_value('gettext_compact', True, 'gettext', {bool, str})
app.add_config_value('gettext_location', True, 'gettext')
app.add_config_value('gettext_uuid', False, 'gettext')
app.add_config_value('gettext_auto_build', True, 'env')
Expand Down
8 changes: 8 additions & 0 deletions sphinx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ def convert_overrides(self, name: str, value: Any) -> Any:
defvalue = self.values[name][0]
if self.values[name][2] == Any:
return value
elif self.values[name][2] == {bool, str}:
if value == '0':
# given falsy string from command line option
return False
elif value == '1':
return True
else:
return value
elif type(defvalue) is bool or self.values[name][2] == [bool]:
if value == '0':
# given falsy string from command line option
Expand Down

0 comments on commit 723294f

Please sign in to comment.