jbowens / jBBCode

A lightweight but extensible BBCode parser
http://jbbcode.com
MIT License
164 stars 32 forks source link

Parser doesn't handle spaces in font-family options #71

Closed xorinzor closed 7 years ago

xorinzor commented 7 years ago

The SCEditor creates a tag such as [font=Comic Sans MS], the jBBCode parser however only returns Comic as the attribute.

Also when adding quotes it only returns Comic.

shmax commented 7 years ago

It would be helpful for us to see some code. This seems to work just fine for me:

$parser = new \JBBCode\Parser();
$parser->addCodeDefinition(\JBBCode\CodeDefinition::construct("font",
    '<span style="font-family:{option}">{param}</span>',
    true
));
$parser->parse('This contains a [font=Comic Sans MS]font[/font].');
echo $parser->getAsHTML();
xorinzor commented 7 years ago

@shmax I copied that code and it still doesn't work for me, same issue.

I'm running 1.3.0, that's the latest version, right?

xorinzor commented 7 years ago

hmm, with quotes it did work though, I guess it's messing up somewhere, glad to know it works fine.

shmax commented 7 years ago

Well, it looks like you still have a point about the no-quotes syntax; turns out I had an older version.

shmax commented 7 years ago

It looks like it broke on this line in this PR: https://github.com/jbowens/jBBCode/pull/25/files#diff-05290515a876ace0d971144e330e2894R445

@Schlaefer any thoughts?