/* =============================================================================== Chili is the jQuery code highlighter plugin ............................................................................... LICENSE: http://www.opensource.org/licenses/mit-license.php WEBSITE: http://noteslog.com/chili/ Copyright 2008 / Andrea Ercolino =============================================================================== */ { _name: 'html' , _case: false , _main: { doctype: { _match: // , _style: "color: #CC6600;" } , ie_style: { _match: /()/ , _replace: function( all, open, content, close ) { return "" + this.x( open ) + "" + this.x( content, '//style' ) + "" + this.x( close ) + ""; } , _style: "color: DarkSlateGray; font-weight: bold;" } , comment: { _match: // , _style: "color: #4040c2;" } , script: { _match: /(]*>)([\w\W]*?)(<\/script\s*>)/ , _replace: function( all, open, content, close ) { return this.x( open, '//tag_start' ) + this.x( content, 'js' ) + this.x( close, '//tag_end' ); } } , style: { _match: /(]*>)([\w\W]*?)(<\/style\s*>)/ , _replace: function( all, open, content, close ) { return this.x( open, '//tag_start' ) + this.x( content, 'css' ) + this.x( close, '//tag_end' ); } } // matches a starting tag of an element (with attrs) // like "
" or "" , tag_start: { _match: /(<\w+)((?:[?%]>|[\w\W])*?)(\/>|>)/ , _replace: function( all, open, content, close ) { return "" + this.x( open ) + "" + this.x( content, '/tag_attrs' ) + "" + this.x( close ) + ""; } , _style: "color: navy; font-weight: bold;" } // matches an ending tag // like "
" , tag_end: { _match: /<\/\w+\s*>|\/>/ , _style: "color: navy;" } , entity: { _match: /&\w+?;/ , _style: "color: blue;" } } , tag_attrs: { // matches a name/value pair attr: { // before in $1, name in $2, between in $3, value in $4 _match: /(\W*?)([\w-]+)(\s*=\s*)((?:\'[^\']*(?:\\.[^\']*)*\')|(?:\"[^\"]*(?:\\.[^\"]*)*\"))/ , _replace: "$1$2$3$4" , _style: { attr_name: "color: green;", attr_value: "color: maroon;" } } } }