Permalink
Browse files

Redone fixing #156

because it not properly deal with non-empty paragraph.
  • Loading branch information...
1 parent 7e7d5ec commit fe89a60db96cc47b3d6f4fbd84db9eb04bc17529 @odrobnik odrobnik committed Mar 29, 2012
Showing with 13 additions and 4 deletions.
  1. +10 −2 Core/Source/NSAttributedString+DTCoreText.m
  2. +3 −2 Demo/Resources/CurrentTest.html
@@ -340,12 +340,20 @@ - (NSString *)htmlString
NSArray *previousListStyles = nil;
- // one empty paragraph at end we don't care about
- for (int i=0; i<[paragraphs count]-1; i++)
+ for (int i=0; i<[paragraphs count]; i++)
{
NSString *oneParagraph = [paragraphs objectAtIndex:i];
NSRange paragraphRange = NSMakeRange(location, [oneParagraph length]);
+ // skip empty paragraph at the end
+ if (i==[paragraphs count]-1)
+ {
+ if (!paragraphRange.length)
+ {
+ continue;
+ }
+ }
+
BOOL needsToRemovePrefix = NO;
BOOL fontIsBlockLevel = NO;
@@ -1,2 +1,3 @@
-<p style="font-size:30px">some text 中文</p>
-<p style="font-size:30px"><b>some text 中文</b></p>
+<p style="font-family:'Times New Roman';font-size:20px;">Hello</p>
+<p style="font-family:'Times New Roman';font-size:20px;"></p>
+<p style="font-family:'Times New Roman';font-size:20px;">World</p>

0 comments on commit fe89a60

Please sign in to comment.