8000 Polish English and update version history. · pyodide/sphinx-js@cde306d · GitHub
[go: up one dir, main page]

Skip to content

Commit cde306d

Browse files
committed
Polish English and update version history.
1 parent 0360bdf commit cde306d

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

README.rst

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,16 @@ optional parameters::
9898

9999
.. js:autofunction:: someFunction(foo, bar[, baz])
100100

101-
Parametter's properties and destructuring parameters can also be documented::
101+
Parameter properties and destructuring parameters also work fine, using `standard JSDoc syntax <http://usejsdoc.org/tags-param.html#parameters-with-properties>`_::
102102

103103
/**
104104
* Export an image from the given canvas and save it to the disk.
105105
*
106-
* @param {string} filename The name of the output file.
107-
* @param {Object} options Output options.
108-
* @param {string} options.format The output format (``jpeg``, ``png`` or ``webp``).
109-
* @param {number} options.quality The output quality when format is ``jpeg`` or ``webp`` (from ``0.00`` to ``1.00``).
106+
* @param {Object} options Output options
107+
* @param {string} options.format The output format (``jpeg``, ``png``, or ``webp``)
108+
* @param {number} options.quality The output quality when format is ``jpeg`` or ``webp`` (from ``0.00`` to ``1.00``)
110109
*/
111-
function saveCanvas(filename, options) {
112-
// ...
113-
}
114-
115-
/**
116-
* Export an image from the given canvas and save it to the disk.
117-
*
118-
* @param {string} filename The name of the output file.
119-
* @param {Object} options Output options.
120-
* @param {string} options.format The output format (``jpeg``, ``png`` or ``webp``).
121-
* @param {number} options.quality The output quality when format is ``jpeg`` or ``webp`` (from ``0.00`` to ``1.00``).
122-
*/
123-
function saveCanvas(filename, { format, quality }) {
110+
function saveCanvas({ format, quality }) {
124111
// ...
125112
}
126113

@@ -292,6 +279,10 @@ Run ``python setup.py test``. Run ``tox`` to test across Python versions.
292279
Version History
293280
===============
294281

282+
2.4.1
283+
* Use documented ``@params`` to help fill out the formal param list for a
284+
function. This keeps us from missing params that use destructuring. (flozz)
285+
295286
2.4
296287
* Support the ``@example`` tag. (lidavidm)
297288

sphinx_js/renderers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,15 @@ def _formal_params(self, doclet):
113113
if self._explicit_formal_params:
114114
return self._explicit_formal_params
115115

116-
# Try to use documented params (@param) first
116+
# Harvest params from the @param tag unless they collide with an
117+
# explicit formal param. Even look at params that are really
118+
# documenting subproperties of formal params.
117119
params = reduce(
118-
lambda l, v: l + [v] if not v in l else l,
119-
[param['name'].split(".")[0] for param in doclet.get('params', [])],
120-
[])
120+
lambda l, v: l + [v] if not v in l else l,
121+
[param['name'].split('.')[0] for param in doclet.get('params', [])],
122+
[])
121123

122-
# Use params from js code if there is no documented params
124+
# Use params from JS code if there are no documented params:
123125
if not params:
124126
params = doclet['meta']['code'].get('paramnames', [])
125127

0 commit comments

Comments
 (0)
0