Forum closed. New forum available at http://community.wymeditor.org/

parser - adding multi attributes

Support forum for WYMeditor.

parser - adding multi attributes

Postby liysd on Tue Apr 27, 2010 10:34 am

I was trying to add another attribute "draggable" to p tags:
Code: Select all
WYMeditor.XhtmlValidator._tags['p'] = {
     'attributes': {
      'class':/^(example|misspell|draggable)$/,
      '0':'name'
     }
   };

It doesn't work until there is only one class attribute. To have both class "example" and "draggable" I have to write:
Code: Select all
WYMeditor.XhtmlValidator._tags['p'] = {
     'attributes': {
      'class':/^(example|misspell|draggable|example draggable|draggable example)$/,
      '0':'name'
     }
   };

This isn't a big problem until there is the only combination but what if I want to add other possible classes. Is there any possibility to define list of tags that could occur (or not) in any order?
liysd
 
Posts: 7
Joined: Thu Apr 22, 2010 5:07 pm

Re: parser - adding multi attributes

Postby mr_lundis on Sun May 16, 2010 12:10 pm

What you have there is a regular expression, so I'd recommend making it a repeatable pattern.
Code: Select all
/^((example|misspell|draggable) ?)+$/


The above pattern requires at least one of the classes to be present, with an optional finishing space to allow separation between class names.

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests