mozilla

Revision 361897 of Template:cssanimatableshorthand

  • Revision slug: Template:cssanimatableshorthand
  • Revision title: Template:cssanimatableshorthand
  • Revision id: 361897
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

<% // $0 is the name of the definition (property or data type), without < > or '' // $1 is a string containing the list of the associated longhand properties // Read the word of the parameters one by one and store them in an array var regexp = /([\w-]+)/g; var values = new Array(); while ( (elt=regexp.exec($1)) != null ) { values.push(elt[1]); } // Load the whole page (wiki.page does cache the original page var page = wiki.page(mdn.localString({ "en-US": "en-US/docs/CSS/CSS_animated_properties", "ja": "ja/docs/CSS/CSS_animated_properties" })); var s_result = 'As each of the properties of the shorthand:
    '; for (var i = 0, len = values.length; i < len; i++) { var re = new RegExp("<\\s*(span|div)\\s+id\\s*=\\s*"+'"animatable-'+values[i]+'"'+"[^>]*>(.*)<\\s*/\\s*(span|div)\\s*\\>","igm"); var value = re.exec(page); // If not found, it is a shorthand itself if (!value) { value = "is itself a shorthand, animates as each of its longhand properties."; // Please make it easier to translate. } else { // Found. We keep only the value value = value[2]; } s_result += '
  • ' + values[i] + ': ' + value +'
  • '; } s_result += '
'; var result = '' + s_result + ''; %><%- result %>

Revision Source

<%
// $0 is the name of the definition (property or data type), without < > or ''
// $1 is a string containing the list of the associated longhand properties

// Read the word of the parameters one by one and store them in an array
var regexp = /([\w-]+)/g;
var values = new Array();

while ( (elt=regexp.exec($1)) != null ) {
    values.push(elt[1]);
}

// Load the whole page (wiki.page does cache the original page
var page = wiki.page(mdn.localString({
    "en-US": "en-US/docs/CSS/CSS_animated_properties",
    "ja": "ja/docs/CSS/CSS_animated_properties"
}));

var s_result = 'As each of the properties of the shorthand:<ul>';

for (var i = 0, len = values.length; i < len; i++) {
    var re = new RegExp("<\\s*(span|div)\\s+id\\s*=\\s*"+'"animatable-'+values[i]+'"'+"[^>]*>(.*)<\\s*/\\s*(span|div)\\s*\\>","igm");
    var value = re.exec(page);

    // If not found, it is a shorthand itself
    if (!value) {
        value = "is itself a shorthand, animates as each of its longhand properties."; // Please make it easier to translate.
    } else { // Found. We keep only the value
        value = value[2];
    }

    s_result += '<li><code>' + values[i] + '</code>: ' + value +'</li>';
}

s_result += '</ul>';

var result = '<span id="animatable-' + $0 + '">' + s_result + '</span>';


%><%- result %>