forked from Cocoanetics/DTCoreText
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDTHTMLParserTextNode.m
More file actions
56 lines (42 loc) · 1000 Bytes
/
Copy pathDTHTMLParserTextNode.m
File metadata and controls
56 lines (42 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// DTHTMLParserTextNode.m
// DTCoreText
//
// Created by Oliver Drobnik on 26.12.12.
// Copyright (c) 2012 Drobnik.com. All rights reserved.
//
#import "DTHTMLParserTextNode.h"
#import "NSString+HTML.h"
@implementation DTHTMLParserTextNode
{
NSString *_characters;
}
- (id)initWithCharacters:(NSString *)characters
{
self = [super init];
if (self)
{
self.name = @"#TEXT#";
_characters = characters;
}
return self;
}
#ifndef COVERAGE
// exclude methods from coverage testing
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@ content='%@'>", NSStringFromClass([self class]), _characters];
}
- (void)_appendHTMLToString:(NSMutableString *)string indentLevel:(NSUInteger)indentLevel
{
// indent to the level
for (NSUInteger i=0; i<indentLevel; i++)
{
[string appendString:@" "];
}
[string appendFormat:@"\"%@\"\n", [_characters stringByNormalizingWhitespace]];
}
#endif
#pragma mark - Properties
@synthesize characters = _characters;
@end