Update docdown to fix doc bugs related to params that are properties of other params. [ci skip]

This commit is contained in:
John-David Dalton
2013-12-19 00:00:00 -08:00
parent 1d8b152758
commit bbc0c97329
3 changed files with 29 additions and 22 deletions

View File

@@ -30,12 +30,15 @@
/** Used to assign each benchmark an incrimented id */
var counter = 0;
/** Used to make every compiled test unique */
var uidCounter = 0;
/** Detect the popular CommonJS extension `module.exports` */
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
/** Used to detect primitive types */
var rePrimitive = /^(?:boolean|number|string|undefined)$/;
/** Used to make every compiled test unique */
var uidCounter = 0;
/** Used to assign default `context` object properties */
var contextProps = [
'Array', 'Date', 'Function', 'Math', 'Object', 'RegExp', 'String', '_',
@@ -2846,18 +2849,18 @@
var Benchmark = runInContext();
// check for `exports` after `define` in case a build optimizer adds an `exports` object
if (freeExports && !freeExports.nodeType) {
// in Node.js or RingoJS v0.8.0+
if (freeModule) {
if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Benchmark).Benchmark = Benchmark;
}
// in Narwhal or RingoJS v0.7.0-
// in Narwhal or Rhino -require
else {
freeExports.Benchmark = Benchmark;
}
}
// in a browser or Rhino
else {
// in a browser or Rhino
root.Benchmark = Benchmark;
}
}

View File

@@ -141,12 +141,16 @@ class Entry {
// compose parts
$result = array($result);
$params = $this->getParams();
$paramNames = array();
foreach ($params as $param) {
// skip params that are properties of other params (e.g. `options.leading`)
if (!preg_match('/\w+\.[\w.]+\s*=/', $param[1])) {
preg_match('/\w+(?=\.[\w.]+)/', $param[1], $parentParam);
$parentParam = $parentParam[0];
if (!in_array($parentParam, $paramNames)) {
$result[] = $param[1];
}
$paramNames[] = preg_replace('/^\[|\]$/', '', $param[1]);
}
// format
$result = $name .'('. implode(array_slice($result, 1), ', ') .')';