Fix rendering of string-valued defaults
Summary
Before this patch, string defaults are formatted without quotes around them. However, if the default is a tuple or list of strings, quotes will be included:
default="a" ==> :default: ``a``
default=("a",) ==> :default: ``('a')``
This is a slightly annoying inconsistency, and leads to potential for confusion
between default="0" and default=0. Most bothersome is that in the case of an
empty string we get:
:default: ````
Which makes docutils angry:
CRITICAL: Unexpected section title or transition: ````
This fixes the trouble by formatting the repr of the default.
On top of #136.
Tasks
- [x] Added unit tests
- [x] Added documentation for new features (where applicable)
- [x] Added release notes (using
reno) - [x] Ran test suite and style checks and built documentation (
tox)
There's still a CRITICAL: Unexpected section title or transition if a multiple option has an empty list default.
You can rebase this now that #136 is merged too.
Thanks for maintaining sphinx-click @stephenfin!