Feb 04

HTML Recipe: Dashed Attributes

Tag: ChiliAndrea Ercolino @ 00:54:34

Another little improvement for the HTML recipe. This time is for properly highlighting attributes whose name contains a dash, like “http-equiv”. I also touched the tag rule, so that the DOCTYPE is recognized now:

/*
===============================================================================
Chili Recipe for the XHTML language
...............................................................................

Version: 1.5b - 2007/02 - http://noteslog.com/chili/

-------------------------------------------------------------------------------
Copyright (c) 2006 Andrea Ercolino
http://www.opensource.org/licenses/mit-license.php
===============================================================================
*/

{
	steps: {
		  mlcom : { exp: /\<!--(?:.|\n)*?--\>/ }
		, tag   : { exp: /(?:\<\!?\w+)|(?:\>)|(?:\<\/\w+\>)|(?:\/\>)/ }
		, aname : { exp: /\s+[\w-]+(?=\s*=)/ }
        , avalue: { exp: /([\"\'])(?:(?:[^\1\\]*?(?:\1\1|\\.))*[^\1\\]*?)\1/ }
		, entity: { exp: /&[\w#]+?;/ }
	}
}

2 Responses to “HTML Recipe: Dashed Attributes”

  1. Manfred Nysted berry says:

    Hi

    Great script. Tx for that.

    I extended the xhtml recipe you posted above a little to also support name-spaces in xhtml.

    So tag’s like … is now also recognized as a tab.


    - Manfred

  2. Andrea Ercolino says:

    Please post again your recipe after escaping it by means of http://www.elliotswan.com/postable/

Leave a Reply