Moving es.Html back to es/ directory

This commit is contained in:
Trevor Parscal 2011-11-02 23:11:36 +00:00
parent 063868d376
commit bec50ddd94

40
modules/es/es.Html.js Normal file
View file

@ -0,0 +1,40 @@
/**
* Static object with HTML generation helpers.
*/
es.Html = {
'escapeText': function( text ) {
return text
.replace( /&/g, '&' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' )
.replace( /'/g, '&#039;' );
},
'makeAttributeList': function( attributes, prespace ) {
var attr = [];
var name;
if ( attributes ) {
for ( name in attributes ) {
attr.push( name + '="' + attributes[name] + '"' );
}
}
return ( prespace && attr.length ? ' ' : '' ) + attr.join( ' ' );
},
'makeOpeningTag': function( name, attributes ) {
return '<' + name + es.Html.makeAttributeList( attributes, true ) + '>';
},
'makeClosingTag': function( name ) {
return '</' + name + '>';
},
'makeTag': function( name, attributes, value, escape ) {
if ( value === false ) {
return '<' + name + es.Html.makeAttributeList( attributes, true ) + ' />';
} else {
if ( escape ) {
value = wiki.util.xml.esc( value );
}
return '<' + name + es.Html.makeAttributeList( attributes, true ) + '>' +
value + '</' + name + '>';
}
}
};