Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9d92ef

Browse filesBrowse files
committed
冒泡解析
1 parent 813859f commit d9d92ef
Copy full SHA for d9d92ef

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Open diff view settings
Collapse file

‎Coding_iOS/Models/HtmlMedia.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Models/HtmlMedia.m
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ - (instancetype)initWithString:(NSString *)htmlString showType:(MediaShowType)sh
3232
- (void)analyseHtmlElement:(TFHppleElement* )element withShowType:(MediaShowType)showType{
3333
HtmlMediaItem *item = nil;
3434
if (element.isTextNode) {
35-
if ([element.content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length > 0
36-
|| (![_contentDisplay hasSuffix:@"\n"] && _contentDisplay.length > 0)) {
35+
if ([element.content stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length > 0) {
3736
[_contentDisplay appendString:element.content];
37+
}else if (![_contentDisplay hasSuffix:@"\n"] && _contentDisplay.length > 0){
38+
NSCharacterSet *lineSet = [NSCharacterSet newlineCharacterSet];
39+
if ([element.content rangeOfCharacterFromSet:lineSet].location != NSNotFound) {
40+
[_contentDisplay appendString:@"\n"];
41+
}else{
42+
[_contentDisplay appendString:element.content];
43+
}
3844
}
3945
}else if ([element.tagName isEqualToString:@"br"]){
4046
if (![_contentDisplay hasSuffix:@"\n"] && _contentDisplay.length > 0) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.