-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original range of element #1
Comments
Hi. You already have support for something like this. There is also a property named "format" in root element which is returned by the parser after you parse your string. In your case it will look like this: All you have to do is to replace {BB_0_BB} with quote element's text, quotation marks and author name. You can do this using regex expression: NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:[BBCodeParser tagRegexPattern] options:0 error:nil]; NSArray *matches = [regex matchesInString:parser.element.format options:0 range:NSMakeRange(0, [parser.element.format length])]; In matches array, there is a NSRange object, which tells you the range of quote element. You can use that range to insert text of a quote element into parser.element.text. |
Ah yes thanks. Also, it would be good if it supported BBCode like this: [quote=harry]TEXT TEXT[/quote] |
I am not sure ... what if there would be more than just one attribute? I can't find any bb code specification ... I guess everyone just makes his own ... |
Hey I also love your library so far. Makes fun working with it. But i also vote for supporting an element being an attribute: "[quote=harry]TEXT TEXT[/quote]" mentioned by liamparker. I created a pull request in order to at least recognize these tags: #3 |
Hi. Thanks for sharing this library. I'm loving it right now.
I want to find the original range of an element. That is - where the element that was parsed was found in the original piece of text.
Say you have this:
NSString *string = @"AND I NEVER THOUGHT [quote author=iffets12345 game=iffets12345 ]Haha, EXACTLY![/quote]";
You parse it with the parser and it returns an element.
Now I want to replace the original location of the element with some new text based on what I have parsed out of the element.
Can this library do anything like that?
Basically - I want to turn that original string into something like this:
AND I NEVER THOUGHT "Haha, EXACTLY!" - iffets12345.
The text was updated successfully, but these errors were encountered: