plugins/previewers/prism-previewers.js
function(prefix, func, values) {
					if (values[0].indexOf('at') < 0) {
						// Looks like old syntax

						// Default values
						var position = 'center';
						var shape = 'ellipse';
						var size = 'farthest-corner';

						if (/\bcenter|top|right|bottom|left\b|^\d+/.test(values[0])) {
							// Found a position
							// Remove angle value, if any
							position = values.shift().replace(/\s*-?\d+(?:rad|deg)\s*/, '');
						}
						if (/\bcircle|ellipse|closest|farthest|contain|cover\b/.test(values[0])) {
							// Found a shape and/or size
							var shapeSizeParts = values.shift().split(/\s+/);
							if (shapeSizeParts[0] && (shapeSizeParts[0] === 'circle' || shapeSizeParts[0] === 'ellipse')) {
								shape = shapeSizeParts.shift();
							}
							if (shapeSizeParts[0]) {
								size = shapeSizeParts.shift();
							}

							// Old keywords are converted to their synonyms
							if (size === 'cover') {
								size = 'farthest-corner';
							} else if (size === 'contain') {
								size = 'clothest-side';
							}
						}

						return func + '(' + shape + ' ' + size + ' at ' + position + ',' + values.join(',') + ')';
					}
					return func + '(' + values.join(',') + ')';
				}
function(prefix, func, values) {
					if (values[0].indexOf('at') < 0) {
						// Looks like old syntax

						// Default values
						var position = 'center';
						var shape = 'ellipse';
						var size = 'farthest-corner';

						if (/\bcenter|top|right|bottom|left\b|^\d+/.test(values[0])) {
							// Found a position
							// Remove angle value, if any
							position = values.shift().replace(/\s*-?\d+(?:rad|deg)\s*/, '');
						}
						if (/\bcircle|ellipse|closest|farthest|contain|cover\b/.test(values[0])) {
							// Found a shape and/or size
							var shapeSizeParts = values.shift().split(/\s+/);
							if (shapeSizeParts[0] && (shapeSizeParts[0] === 'circle' || shapeSizeParts[0] === 'ellipse')) {
								shape = shapeSizeParts.shift();
							}
							if (shapeSizeParts[0]) {
								size = shapeSizeParts.shift();
							}

							// Old keywords are converted to their synonyms
							if (size === 'cover') {
								size = 'farthest-corner';
							} else if (size === 'contain') {
								size = 'clothest-side';
							}
						}

						return func + '(' + shape + ' ' + size + ' at ' + position + ',' + values.join(',') + ')';
					}
					return func + '(' + values.join(',') + ')';
				}
function ( prefix , func , values ) { if ( values [ 0 ] . indexOf ( 'at' ) < 0 ) { // Looks like old syntax // Default values var position = 'center' ; var shape = 'ellipse' ; var size = 'farthest-corner' ; if ( / \bcenter|top|right|bottom|left\b|^\d+ / . test ( values [ 0 ] ) ) { // Found a position // Remove angle value, if any position = values . shift ( ) . replace ( / \s*-?\d+(?:rad|deg)\s* / , '' ) ; } if ( / \bcircle|ellipse|closest|farthest|contain|cover\b / . test ( values [ 0 ] ) ) { // Found a shape and/or size var shapeSizeParts = values . shift ( ) . split ( / \s+ / ) ; if ( shapeSizeParts [ 0 ] && ( shapeSizeParts [ 0 ] === 'circle' || shapeSizeParts [ 0 ] === 'ellipse' ) ) { shape = shapeSizeParts . shift ( ) ; } if ( shapeSizeParts [ 0 ] ) { size = shapeSizeParts . shift ( ) ; } // Old keywords are converted to their synonyms if ( size === 'cover' ) { size = 'farthest-corner' ; } else if ( size === 'contain' ) { size = 'clothest-side' ; } } return func + '(' + shape + ' ' + size + ' at ' + position + ',' + values . join ( ',' ) + ')' ; } return func + '(' + values . join ( ',' ) + ')' ; }
Returns a W3C-valid radial gradient
@param {string} prefix Vendor prefix if any ("-moz-", "-webkit-", etc.)
@param {string} func Gradient function name ("linear-gradient")
@param {string[]} values Array of the gradient function parameters (["0deg", "red 0%", "blue 100%"])
Returns a W3C - valid radial gradient