mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-23 18:28:51 +00:00
Moving es.Html back to es/ directory
This commit is contained in:
parent
063868d376
commit
bec50ddd94
40
modules/es/es.Html.js
Normal file
40
modules/es/es.Html.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Static object with HTML generation helpers.
|
||||
*/
|
||||
es.Html = {
|
||||
'escapeText': function( text ) {
|
||||
return text
|
||||
.replace( /&/g, '&' )
|
||||
.replace( /</g, '<' )
|
||||
.replace( />/g, '>' )
|
||||
.replace( /"/g, '"' )
|
||||
.replace( /'/g, ''' );
|
||||
},
|
||||
'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 + '>';
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue