Fix issue with spacing when inserting gmt link
Make the entry a single line to avoid leading white space problems.
@@ -9,8 +9,8 @@ def gmt_docs_link(module_func):
"""
Add to a module docstring a link to the GMT docs for that module.
- The docstring must have the placeholder ``{gmt_mod}`` where you want the
- link to appear.
+ The docstring must have the placeholder ``{gmt_module_docs}`` where you
+ want the link to appear.
Assumes that the name of the GMT module is the same as the function name.
@@ -31,13 +31,21 @@ def gmt_docs_link(module_func):
--------
>>> @gmt_docs_link
- ... def psconvert(**kwargs):
- ... "Full docs at {gmt_mod}"
+ ... def gmtinfo(**kwargs):
+ ... '''
+ ... My nice module.
+ ... {gmt_module_docs}
+ ... '''
... pass
- >>> print(psconvert.__doc__)
- Full docs at http://gmt.soest.hawaii.edu/doc/latest/psconvert.html
+ >>> print(gmtinfo.__doc__)
+ <BLANKLINE>
+ My nice module.
+ Full option list at http://gmt.soest.hawaii.edu/doc/latest/gmtinfo.html
+ <BLANKLINE>
"""
url = "{}/{}.html".format(GMT_DOCS, module_func.__name__)
- module_func.__doc__ = module_func.__doc__.format(gmt_mod=url)
+ text = "Full option list at"
+ full_text = ' '.join([text, url])
+ module_func.__doc__ = module_func.__doc__.format(gmt_module_docs=full_text)
return module_func
