Skip to content

Commit 3cf35f9

Browse files
committed
Update vendors & docs.
1 parent 56e27e0 commit 3cf35f9

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

vendor/docdown/src/DocDown/MarkdownGenerator.php

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,21 @@ private static function format( $string ) {
132132
return trim($string);
133133
}
134134

135+
/**
136+
* Escapes special Markdown characters.
137+
*
138+
* @private
139+
* @memberOf Entry
140+
* @param {string} $string The string to escape.
141+
* @returns {string} Returns the escaped string.
142+
*/
143+
private function escape( $string ) {
144+
$string = preg_replace('/(?<!\\\)\*/', '&#42;', $string);
145+
$string = preg_replace('/(?<!\\\)\[/', '&#91;', $string);
146+
$string = preg_replace('/(?<!\\\)\]/', '&#93;', $string);
147+
return $string;
148+
}
149+
135150
/**
136151
* Modify a string by replacing named tokens with matching assoc. array values.
137152
*
@@ -188,7 +203,14 @@ private function addEntries( &$result, $entries ) {
188203
array_push(
189204
$result,
190205
$this->openTag,
191-
MarkdownGenerator::interpolate("### <a id=\"#{hash}\"></a>`#{member}#{separator}#{call}`\n<a href=\"##{hash}\">#</a> [&#x24C8;](#{href} \"View in source\") [&#x24C9;][1]\n\n#{desc}", $entry)
206+
MarkdownGenerator::interpolate("### <a id=\"#{hash}\"></a>`#{member}#{separator}#{call}`\n<a href=\"##{hash}\">#</a> [&#x24C8;](#{href} \"View in source\") [&#x24C9;][1]\n\n#{desc}", array(
207+
'call' => $entry->getCall(),
208+
'desc' => $this->escape($entry->getDesc()),
209+
'hash' => $entry->hash,
210+
'href' => $entry->href,
211+
'member' => $entry->member,
212+
'separator' => $entry->separator
213+
))
192214
);
193215

194216
// @alias
@@ -204,10 +226,10 @@ private function addEntries( &$result, $entries ) {
204226
array_push($result, '', '#### Arguments');
205227
foreach ($params as $index => $param) {
206228
$result[] = MarkdownGenerator::interpolate('#{num}. `#{name}` (#{type}): #{desc}', array(
207-
'desc' => $param[2],
229+
'desc' => $this->escape($param[2]),
208230
'name' => $param[1],
209231
'num' => $index + 1,
210-
'type' => preg_replace('/(?<!\\\)(\*)/', '\\\$1', $param[0])
232+
'type' => $this->escape($param[0])
211233
));
212234
}
213235
}
@@ -217,8 +239,8 @@ private function addEntries( &$result, $entries ) {
217239
$result, '',
218240
'#### Returns',
219241
MarkdownGenerator::interpolate('(#{type}): #{desc}', array(
220-
'desc' => $returns[1],
221-
'type' => preg_replace('/(?<!\\\)(\*)/', '\\\$1', $returns[0])
242+
'desc' => $this->escape($returns[1]),
243+
'type' => $this->escape($returns[0])
222244
))
223245
);
224246
}
@@ -246,7 +268,7 @@ private function getHash( $entry, $member = '' ) {
246268
$result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall();
247269
$result = preg_replace('/\(\[|\[\]/', '', $result);
248270
$result = preg_replace('/[\t =|\'"{}.()\]]/', '', $result);
249-
$result = preg_replace('/[[#,]/', '-', $result);
271+
$result = preg_replace('/[\[#,]+/', '-', $result);
250272
return strtolower($result);
251273
}
252274

@@ -347,6 +369,7 @@ public function generate() {
347369
foreach ($api as $entry) {
348370
$entry->hash = $this->getHash($entry);
349371
$entry->href = $this->getLineUrl($entry);
372+
$entry->separator = '';
350373

351374
$member = $entry->getMembers(0);
352375
$member = ($member ? $member . $this->getSeparator($entry) : '') . $entry->getName();
@@ -448,7 +471,7 @@ function sortCompare($a, $b) {
448471
}
449472
// assign TOC hash
450473
if (count($result) == 2) {
451-
$toc = $category;
474+
$toc = strtolower($category);
452475
}
453476
// add category
454477
array_push(
@@ -564,4 +587,4 @@ function sortCompare($a, $b) {
564587
return trim(preg_replace('/[\t ]+\n/', "\n", join($result, "\n")));
565588
}
566589
}
567-
?>
590+
?>

vendor/qunit-clib/qunit-clib.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,23 @@
173173
console.log(' Finished in ' + details.runtime + ' milliseconds.');
174174
console.log(hr);
175175

176-
var fails = details.failed,
177-
error = fails + ' of ' + details.total + ' tests failed.';
178-
179176
// exit out of Node.js or PhantomJS
180177
try {
181178
var process = context.process || context.phantom;
182-
if (fails) {
183-
console.error('Error: ' + error);
179+
if (details.failed) {
184180
process.exit(1);
185181
} else {
186182
process.exit(0);
187183
}
188-
} catch(e) {
189-
if (fails) {
190-
throw new Error(error);
191-
}
192-
}
193-
// exit out of Narhwal, Rhino, or RingoJS
184+
} catch(e) { }
185+
186+
// exit out of Narwhal, Rhino, or RingoJS
194187
try {
195-
quit();
188+
if (details.failed) {
189+
java.lang.System.exit(1);
190+
} else {
191+
quit();
192+
}
196193
} catch(e) { }
197194
};
198195
}());

0 commit comments

Comments
 (0)