|ReleasedLast Release||Jun 2015|
Maintained by Stephen Darlington.
|Apps WeekApps This Week||5|
|LOCLines of Code||335|
Convert HTML Entities like › to their unicode equivalent.
There are three ways of adding
WSLHTMLEntities to your project:
If you're using iOS 5 or above and are happy with ARC, it's as simple as:
You can see an example in the same project. Another target, called "WSLHTMLEntities Sample," just shows you how to use the code.
There is a second target for the library called "WSLHTMLEntities (Fast)." This is, as the name suggests, a faster version. Unless performance is absolutely critical it's not worth the significantly larger binary that this option produces.
If you're using iOS 8 or above, it's as simple as:
You can see an example in the same project. Another target, called "WSLHTMLEntities Sample Framework," just shows you how to use the code.
If you want to do it the hard, old way you just need to copy the following four files -- or at least references to them -- into your project:
The project works both with manual memory management and ARC.
There's only one method:
I'm sure you can figure out how to use it.
You can also use the instance method if you like:
WSLHTMLEntities* parser = [[WSLHTMLEntities alloc] init]; NSString* out = [parser convertHTMLtoString:in];
This may be slightly quicker if you're processing lots of strings.
WSLHTMLEntities is now thread-safe.
The lexer is based on
HTML::Entities from CPAN (Perl). You can (mostly) generate the lexer and
genEntitiesLexer.pl, but you would only need to do that it you want to add a new entity. Or there's a bug.
It's used in the following apps:
Please let me know if you use it in yours.
I'm not sure there's enough code from the Perl version to "taint" it but I don't have expensive lawyers like Google so I'm playing it safe and using the same licence -- the Artistic License. Basically you can do what you like with it but credits and push requests would be welcome.
Copyright 2012-2014 Stephen Darlington. Wandle Software Limited. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.