https://github.com/werner77/webbcode
Lean and mean SAX style parser for BBCode written in Objective C/C with support for various conversions
https://github.com/werner77/webbcode
Last synced: 3 months ago
JSON representation
Lean and mean SAX style parser for BBCode written in Objective C/C with support for various conversions
- Host: GitHub
- URL: https://github.com/werner77/webbcode
- Owner: werner77
- License: mit
- Created: 2016-07-05T12:41:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-22T14:04:47.000Z (over 8 years ago)
- Last Synced: 2025-03-24T21:05:20.159Z (3 months ago)
- Language: Objective-C
- Homepage:
- Size: 48.8 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WEBBCode
[](https://travis-ci.org/werner77/WEBBCode)
[](http://cocoapods.org/pods/WEBBCode)
[](http://cocoapods.org/pods/WEBBCode)
[](http://cocoapods.org/pods/WEBBCode)This is a lean and mean SAX style parser for BBCode written in Objective C/C.
It has support for output to HTML and NSAttributedString (work in progress) for simple BBCode.
It is totally pluggable and extensible to allow for full customization.
The pod has two sub specs:
Core: which contains the BBCode parser and model classes.
HTML: which contains support for transformation to HTML.## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
Example usage to parse:
```objc
WEBBCodeParser *parser = [WEBBCodeParser new];
parser.encoding = NSUTF8StringEncoding;
parser.delegate = self;NSData *data = [NSData dataWithContentsOfFile:@"somefile"];
[parser parseData:data error:nil];```
Example to convert BBCode to HTML:
```objc
WEBBCodeHtmlConverter *converter = [WEBBCodeHtmlConverter new];
converter.transformer = [WEBBCodeHtmlDefaultTagTransformer new];
converter.useParagraphs = NO;NSString *input = @"some [b]bb code[/b]"";
NSError *error = nil;
NSString *output = [converter htmlFromBBCode:input error:&error];if (output == nil) {
NSLog(@"Error occurred: %@", error);
}```
Also see the test cases for more code examples.
## Requirements
## Installation
WEBBCode is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "WEBBCode"
```## Author
Werner Altewischer
## License
WEBBCode is available under the MIT license. See the LICENSE file for more info.