an experiment in making a cocoa webkit browser manageable under X11
1//
2// GTMNSString+HTML.h
3// Dealing with NSStrings that contain HTML
4//
5// Copyright 2006-2008 Google Inc.
6//
7// Licensed under the Apache License, Version 2.0 (the "License"); you may not
8// use this file except in compliance with the License. You may obtain a copy
9// of the License at
10//
11// http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16// License for the specific language governing permissions and limitations under
17// the License.
18//
19
20#import <Foundation/Foundation.h>
21
22/// Utilities for NSStrings containing HTML
23@interface NSString (GTMNSStringHTMLAdditions)
24
25/// Get a string where internal characters that need escaping for HTML are escaped
26//
27/// For example, '&' become '&'. This will only cover characters from table
28/// A.2.2 of http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters
29/// which is what you want for a unicode encoded webpage. If you have a ascii
30/// or non-encoded webpage, please use stringByEscapingAsciiHTML which will
31/// encode all characters.
32///
33/// For obvious reasons this call is only safe once.
34//
35// Returns:
36// Autoreleased NSString
37//
38- (NSString *)gtm_stringByEscapingForHTML;
39
40/// Get a string where internal characters that need escaping for HTML are escaped
41//
42/// For example, '&' become '&'
43/// All non-mapped characters (unicode that don't have a &keyword; mapping)
44/// will be converted to the appropriate &#xxx; value. If your webpage is
45/// unicode encoded (UTF16 or UTF8) use stringByEscapingHTML instead as it is
46/// faster, and produces less bloated and more readable HTML (as long as you
47/// are using a unicode compliant HTML reader).
48///
49/// For obvious reasons this call is only safe once.
50//
51// Returns:
52// Autoreleased NSString
53//
54- (NSString *)gtm_stringByEscapingForAsciiHTML;
55
56/// Get a string where internal characters that are escaped for HTML are unescaped
57//
58/// For example, '&' becomes '&'
59/// Handles   and 2 cases as well
60///
61// Returns:
62// Autoreleased NSString
63//
64- (NSString *)gtm_stringByUnescapingFromHTML;
65
66@end