+++ /dev/null
-/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
-For licensing, see LICENSE.html or http://ckeditor.com/license\r
-*/\r
-\r
-CKEDITOR.htmlParser.basicWriter = CKEDITOR.tools.createClass(\r
-{\r
- $ : function()\r
- {\r
- this._ =\r
- {\r
- output : []\r
- };\r
- },\r
-\r
- proto :\r
- {\r
- /**\r
- * Writes the tag opening part for a opener tag.\r
- * @param {String} tagName The element name for this tag.\r
- * @param {Object} attributes The attributes defined for this tag. The\r
- * attributes could be used to inspect the tag.\r
- * @example\r
- * // Writes "<p".\r
- * writer.openTag( 'p', { class : 'MyClass', id : 'MyId' } );\r
- */\r
- openTag : function( tagName, attributes )\r
- {\r
- this._.output.push( '<', tagName );\r
- },\r
-\r
- /**\r
- * Writes the tag closing part for a opener tag.\r
- * @param {String} tagName The element name for this tag.\r
- * @param {Boolean} isSelfClose Indicates that this is a self-closing tag,\r
- * like "br" or "img".\r
- * @example\r
- * // Writes ">".\r
- * writer.openTagClose( 'p', false );\r
- * @example\r
- * // Writes " />".\r
- * writer.openTagClose( 'br', true );\r
- */\r
- openTagClose : function( tagName, isSelfClose )\r
- {\r
- if ( isSelfClose )\r
- this._.output.push( ' />' );\r
- else\r
- this._.output.push( '>' );\r
- },\r
-\r
- /**\r
- * Writes an attribute. This function should be called after opening the\r
- * tag with {@link #openTagClose}.\r
- * @param {String} attName The attribute name.\r
- * @param {String} attValue The attribute value.\r
- * @example\r
- * // Writes ' class="MyClass"'.\r
- * writer.attribute( 'class', 'MyClass' );\r
- */\r
- attribute : function( attName, attValue )\r
- {\r
- // Browsers don't always escape special character in attribute values. (#4683, #4719).\r
- if ( typeof attValue == 'string' )\r
- attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );\r
-\r
- this._.output.push( ' ', attName, '="', attValue, '"' );\r
- },\r
-\r
- /**\r
- * Writes a closer tag.\r
- * @param {String} tagName The element name for this tag.\r
- * @example\r
- * // Writes "</p>".\r
- * writer.closeTag( 'p' );\r
- */\r
- closeTag : function( tagName )\r
- {\r
- this._.output.push( '</', tagName, '>' );\r
- },\r
-\r
- /**\r
- * Writes text.\r
- * @param {String} text The text value\r
- * @example\r
- * // Writes "Hello Word".\r
- * writer.text( 'Hello Word' );\r
- */\r
- text : function( text )\r
- {\r
- this._.output.push( text );\r
- },\r
-\r
- /**\r
- * Writes a comment.\r
- * @param {String} comment The comment text.\r
- * @example\r
- * // Writes "<!-- My comment -->".\r
- * writer.comment( ' My comment ' );\r
- */\r
- comment : function( comment )\r
- {\r
- this._.output.push( '<!--', comment, '-->' );\r
- },\r
-\r
- /**\r
- * Writes any kind of data to the ouput.\r
- * @example\r
- * writer.write( 'This is an <b>example</b>.' );\r
- */\r
- write : function( data )\r
- {\r
- this._.output.push( data );\r
- },\r
-\r
- /**\r
- * Empties the current output buffer.\r
- * @example\r
- * writer.reset();\r
- */\r
- reset : function()\r
- {\r
- this._.output = [];\r
- this._.indent = false;\r
- },\r
-\r
- /**\r
- * Empties the current output buffer.\r
- * @param {Boolean} reset Indicates that the {@link reset} function is to\r
- * be automatically called after retrieving the HTML.\r
- * @returns {String} The HTML written to the writer so far.\r
- * @example\r
- * var html = writer.getHtml();\r
- */\r
- getHtml : function( reset )\r
- {\r
- var html = this._.output.join( '' );\r
-\r
- if ( reset )\r
- this.reset();\r
-\r
- return html;\r
- }\r
- }\r
-});\r