TinyMCE BBCode: Convert UL -
i'm overpowered, maybe can't see correct way fix it.
below bbcode
function rep(re, str) { s = s.replace(re, str); }; //replace ul rep(/<ul>(.*?)<\/ul>/gi,"[list]$1[/list]"); // replace li rep(/<li>(.*?)<\/li>/gi,"[*]$1"); test text:
<ul> <li>one</li> <li>two</li> </ul> converted result bbcode:
<ul> [*]one [*]two </ul> expected result:
[list] [*]one [*]two [/list] what wrong?
i fixed it. posting others.
// lists
rep(/<ul>/gi,"[list]"); rep(/<\/ul>/gi,"[/list]"); rep(/<ol>/gi,"[list=ol]"); rep(/<\/ol>/gi,"[/list]"); rep(/<li>(.*?)<\/li>/gi,"[*]$1");
Comments
Post a Comment