Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix html space   #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions MDHTMLLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
00B0F8E11C0831C00078809B /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 00B0F8E01C0831C00078809B /* [email protected] */; };
8BBAE367182C449600236328 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BBAE366182C449600236328 /* Foundation.framework */; };
8BBAE369182C449600236328 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BBAE368182C449600236328 /* CoreGraphics.framework */; };
8BBAE36B182C449600236328 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BBAE36A182C449600236328 /* UIKit.framework */; };
Expand Down Expand Up @@ -35,6 +36,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
00B0F8E01C0831C00078809B /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; path = "../../YYKit/Demo/YYKitDemo/[email protected]"; sourceTree = "<group>"; };
8BBAE363182C449600236328 /* MDHTMLLabel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MDHTMLLabel.app; sourceTree = BUILT_PRODUCTS_DIR; };
8BBAE366182C449600236328 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
8BBAE368182C449600236328 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -130,6 +132,7 @@
8BBAE36D182C449600236328 /* Supporting Files */ = {
isa = PBXGroup;
children = (
00B0F8E01C0831C00078809B /* [email protected] */,
8BBAE36E182C449600236328 /* MDHTMLLabelDemo-Info.plist */,
8BBAE36F182C449600236328 /* InfoPlist.strings */,
8BBAE372182C449600236328 /* main.m */,
Expand Down Expand Up @@ -243,6 +246,7 @@
buildActionMask = 2147483647;
files = (
8BBAE37F182C449600236328 /* Images.xcassets in Resources */,
00B0F8E11C0831C00078809B /* [email protected] in Resources */,
8BBAE371182C449600236328 /* InfoPlist.strings in Resources */,
8BBAE3A8182C70AE00236328 /* Main.storyboard in Resources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "BE405A853698161228C571F9C82381198587725A",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"BE405A853698161228C571F9C82381198587725A" : 0,
"1348A3F3A9255948743B6F3B2B6D2B1CE3E2D839" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "61FFCD1A-0F97-4850-B64D-A93787F15EBD",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"BE405A853698161228C571F9C82381198587725A" : "MDHTMLLabel\/",
"1348A3F3A9255948743B6F3B2B6D2B1CE3E2D839" : "YYKit\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "MDHTMLLabel",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "MDHTMLLabel.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/ibireme\/YYKit.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "1348A3F3A9255948743B6F3B2B6D2B1CE3E2D839"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/RobinChao\/MDHTMLLabel.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "BE405A853698161228C571F9C82381198587725A"
}
]
}
7 changes: 4 additions & 3 deletions MDHTMLLabel/MDHTMLLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ - (void)setHtmlText:(NSString *)htmlText

if (_htmlText)
{
htmlText = [_htmlText stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n"];
_htmlText = [_htmlText stringByReplacingOccurrencesOfString:@"<br>" withString:@"\n"];

if (self.autoDetectUrls)
{
htmlText = [self detectURLsInText:_htmlText];
_htmlText = [self detectURLsInText:_htmlText];
}

[self extractStyleFromText:_htmlText];
Expand Down Expand Up @@ -620,7 +620,7 @@ - (void)drawTextInRect:(CGRect)rect
else if (self.highlightedShadowColor)
{
CGContextSetShadowWithColor(c, self.highlightedShadowOffset, self.highlightedShadowRadius, self.highlightedShadowColor.CGColor);
}
}

// Finally, draw the text or highlighted text itself (on top of the shadow, if there is one)
if (self.highlighted && self.highlightedTextColor)
Expand Down Expand Up @@ -1357,6 +1357,7 @@ - (void)extractStyleFromText:(NSString *)data
data = [data stringByReplacingOccurrencesOfString:@"&amp;" withString:@"&"];
data = [data stringByReplacingOccurrencesOfString:@"&apos;" withString:@"'"];
data = [data stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
data = [data stringByReplacingOccurrencesOfString:@"&nbsp;" withString:@""];
}

NSMutableArray *components = [NSMutableArray array];
Expand Down