Closed Spuds closed 11 years ago
You're right that should definitely be configurable! I completely missed that.
I'll add some options into the parser tomorrow or the day after. They will probably be: alwaysQuote, neverQuote, autoQuote (which would quote the attribute when it has a space in it) and a callback option which could deal with other types.
Do you accept attributes with spaces in them, e.g.:
[quote author=This is all the author date=12345679]hi[/quote]
I just want to know if it's worth making it able to handle attributes with spaces but without quotes.
[quote author=This is all the author date=12345679]hi[/quote]
Yes that is one of the styles that is supported ... not saying I'm happy about it, but it is supported.
Thanks for taking care of this!
Also (but that is probably mostly irrelevant), in our case (same as Spuds) the value of the attributes can have = (equals) inside:
[quote author=emanuele date=1353794172 link=topic=2.msg4#msg4]
I noticed changing:
atribsRegex = /(\S+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|([^'"\s]+))/g,
to
atribsRegex = /(\S+?)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|([^'"\s]+))/g,
"fixes" that too, but I'm not sure if it breaks other things or if it is needed at all.
It should now support attributes without quotes that have spaces and equal signs as their values.
It also now defaults to only quoting attributes that have spaces or equals in them. The default quote type can be changed via the parserOptions
option, e.g.:
parserOptions: {
// set to $.sceditor.BBCodeParser.QuoteType.(auto, never, always) or a
// function which takes a string and returns the quoted string
quoteType: $.sceditor.BBCodeParser.QuoteType.auto
}
It can be overridden on a BBCode by the quoteType
property on the BBCode object.
Not sure its a bug or just unexpected.
In v1.4.0 when you define a custom bbcode and use the attrs: declaration in its object, after you pass in an out of source -> wysiwyg -> source the code gets wrapped in "'s
This can be problematic for the receiving program if it does not expect the attributes to be " wrapped
V1.3.7 did not do this
[quote author=me date=12345679]hi[/quote]
becomes
[quote author="me" date="12345679"]hi[/quote] in the source editor
ETA: the attrs declaration does not seem to matter at all, it wraps them in quotes w or w/o that being defined in the object.