Skip to content

Commit 5ef230a

Browse files
committed
Update docdown & qunit-clib. [ci skip]
1 parent 35c322c commit 5ef230a

File tree

3 files changed

+108
-37
lines changed

3 files changed

+108
-37
lines changed

vendor/docdown/src/DocDown/Entry.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ private function isFunction() {
7777
$this->isCtor() ||
7878
count($this->getParams()) ||
7979
count($this->getReturns()) ||
80-
preg_match('/\*[\t ]*@function\b/', $this->entry)
80+
preg_match('/\*[\t ]*@function\b/', $this->entry) ||
81+
preg_match('#\*/\s*function #', $this->entry)
8182
);
8283
}
8384
return $this->_isFunction;

vendor/docdown/src/DocDown/MarkdownGenerator.php

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class MarkdownGenerator {
2727
/**
2828
* The HTML for the open tag.
2929
*
30-
* @static
3130
* @memberOf MarkdownGenerator
3231
* @type string
3332
*/
@@ -49,6 +48,15 @@ class MarkdownGenerator {
4948
*/
5049
public $source = '';
5150

51+
/**
52+
* The array of code snippets that are tokenized by `escape`.
53+
*
54+
* @private
55+
* @memberOf MarkdownGenerator
56+
* @type Array
57+
*/
58+
private $snippets = array();
59+
5260
/*--------------------------------------------------------------------------*/
5361

5462
/**
@@ -132,21 +140,6 @@ private static function format( $string ) {
132140
return trim($string);
133141
}
134142

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-
150143
/**
151144
* Modify a string by replacing named tokens with matching assoc. array values.
152145
*
@@ -252,6 +245,23 @@ private function addEntries( &$result, $entries ) {
252245
}
253246
}
254247

248+
/**
249+
* Escapes special Markdown characters.
250+
*
251+
* @private
252+
* @memberOf Entry
253+
* @param {string} $string The string to escape.
254+
* @returns {string} Returns the escaped string.
255+
*/
256+
private function escape( $string ) {
257+
$string = preg_replace_callback('/`.*?\`/', array($this, 'swapSnippetsToTokens'), $string);
258+
$string = preg_replace('/(?<!\\\)\*/', '&#42;', $string);
259+
$string = preg_replace('/(?<!\\\)\[/', '&#91;', $string);
260+
$string = preg_replace('/(?<!\\\)\]/', '&#93;', $string);
261+
$string = preg_replace_callback('/@@token@@/', array($this, 'swapTokensToSnippets'), $string);
262+
return $string;
263+
}
264+
255265
/**
256266
* Resolves the entry's hash used to navigate the documentation.
257267
*
@@ -298,6 +308,32 @@ private function getSeparator( $entry ) {
298308
return $entry->isPlugin() ? '.prototype.' : '.';
299309
}
300310

311+
/**
312+
* Swaps code snippets with tokens as a `preg_replace_callback` callback
313+
* used by `escape`.
314+
*
315+
* @private
316+
* @memberOf Entry
317+
* @param {Array} $matches The array of regexp matches.
318+
* @returns {string} Returns the token.
319+
*/
320+
private function swapSnippetsToTokens( $matches ) {
321+
$this->snippets[] = $matches[0];
322+
return '@@token@@';
323+
}
324+
325+
/**
326+
* Swaps tokens with code snippets as a `preg_replace_callback` callback
327+
* used by `escape`.
328+
*
329+
* @private
330+
* @memberOf Entry
331+
* @returns {string} Returns the code snippet.
332+
*/
333+
private function swapTokensToSnippets() {
334+
return array_shift($this->snippets);
335+
}
336+
301337
/*--------------------------------------------------------------------------*/
302338

303339
/**

vendor/qunit-clib/qunit-clib.js

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@
3030
return;
3131
}
3232

33+
/** Used to report the test module for failing tests */
34+
var moduleName,
35+
modulePrinted;
36+
37+
/** Used to display the wait throbber */
38+
var throbberId,
39+
throbberDelay = 500,
40+
waitCount = -1;
41+
42+
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
43+
var console = context.console || (context.console = { 'log': context.print });
44+
45+
/** Used as a horizontal rule in console output */
46+
var hr = '----------------------------------------';
47+
48+
/** Used by `logInline` to clear previously logged messages */
49+
var prevLine = '';
50+
51+
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
52+
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
53+
54+
/*------------------------------------------------------------------------*/
55+
3356
/**
3457
* Schedules timer-based callbacks.
3558
*
@@ -108,24 +131,8 @@
108131

109132
/*------------------------------------------------------------------------*/
110133

111-
/** Used to report the test module for failing tests */
112-
var moduleName,
113-
modulePrinted;
114-
115-
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
116-
var console = context.console || (context.console = { 'log': context.print });
117-
118-
/** Used as a horizontal rule in console output */
119-
var hr = '----------------------------------------';
120-
121-
/** Used by `logInline` to clear previously logged messages */
122-
var prevLine = '';
123-
124-
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
125-
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
126-
127134
/**
128-
* Logs an inline message to standard output.
135+
* Writes an inline message to standard output.
129136
*
130137
* @private
131138
* @param {string} text The text to log.
@@ -142,7 +149,7 @@
142149
process.exit();
143150
});
144151
return function(text) {
145-
var blankLine = Array(prevLine.length + 1).join(' ');
152+
var blankLine = repeat(' ', prevLine.length);
146153
if (text.length > hr.length) {
147154
text = text.slice(0, hr.length - 3) + '...';
148155
}
@@ -151,6 +158,29 @@
151158
}
152159
}());
153160

161+
/**
162+
* Writes the wait throbber to standard output.
163+
*
164+
* @private
165+
*/
166+
function logThrobber() {
167+
logInline('Please wait' + repeat('.', (++waitCount % 3) + 1));
168+
}
169+
170+
/**
171+
* Creates a string with `text` repeated `n` number of times.
172+
*
173+
* @private
174+
* @param {string} text The text to repeat.
175+
* @param {number} n The number of times to repeat `text`.
176+
* @returns {string} The created string.
177+
*/
178+
function repeat(text, n) {
179+
return Array(n + 1).join(text);
180+
}
181+
182+
/*------------------------------------------------------------------------*/
183+
154184
/**
155185
* A logging callback triggered when all testing is completed.
156186
*
@@ -224,11 +254,17 @@
224254
* @param {Object} details An object with property `name`.
225255
*/
226256
QUnit.moduleStart(function(details) {
257+
// reset the `modulePrinted` flag
227258
var newModuleName = details.name;
228259
if (moduleName != newModuleName) {
229260
moduleName = newModuleName;
230261
modulePrinted = false;
231262
}
263+
// initialize the wait throbber
264+
if (!throbberId) {
265+
throbberId = context.setInterval(logThrobber, throbberDelay);
266+
logThrobber();
267+
}
232268
});
233269

234270
/**
@@ -275,8 +311,6 @@
275311
assertions.forEach(function(value) {
276312
console.log(' ' + value);
277313
});
278-
} else {
279-
logInline('Testing ' + moduleName + '...');
280314
}
281315
assertions.length = 0;
282316
});

0 commit comments

Comments
 (0)