Skip to content

Commit

Permalink
make lists counting based on 1
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Jun 23, 2011
1 parent 22c226f commit 3477775
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Classes/NSAttributedString+HTML.m
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttrib
{
if (tagOpen)
{
// have inherit the correct list counter from parent

DTHTMLElement *counterElement = currentTag.parent;

NSNumber *valueNum = [tagAttributesDict objectForKey:@"value"];
Expand All @@ -514,11 +516,8 @@ - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttrib
counterElement.listCounter = value;
currentTag.listCounter = value;
}
else
{
counterElement.listCounter++;
currentTag.listCounter = counterElement.listCounter;
}

counterElement.listCounter++;

needsListItemStart = YES;
currentTag.paragraphStyle.paragraphSpacing = 0;
Expand Down Expand Up @@ -586,11 +585,11 @@ - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttrib
if (valueNum)
{
NSInteger value = [valueNum integerValue];
currentTag.listCounter = value-1;
currentTag.listCounter = value;
}
else
{
currentTag.listCounter = 0;
currentTag.listCounter = 1;
}

needsNewLineBefore = YES;
Expand Down

0 comments on commit 3477775

Please sign in to comment.