File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Sources/ZMarkupParser/HTML Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -82,19 +82,20 @@ struct HTMLElementMarkupComponentMarkupStyleVisitor: MarkupVisitor {
8282 let indent = ( style. font. size ?? 16 ) * markup. styleList. indentMultiply
8383 let dotIndent : CGFloat = ( markup. styleList. type. isOrder ( ) ) ? ( indent) : ( 0 ) // for 1. -> "."
8484
85+ // Find Parent Indent if exists.
8586 var parentIndent : CGFloat = 0
8687 var parentMarkup : Markup ? = markup. parentMarkup
8788 while ( parentMarkup != nil ) {
8889 if let thisParentMarkup = parentMarkup as? ListMarkup {
89- parentIndent += visit ( markup: thisParentMarkup) ? . paragraphStyle. headIndent ?? 0
90+ parentIndent = visit ( markup: thisParentMarkup) ? . paragraphStyle. headIndent ?? 0
91+ break
9092 }
9193 parentMarkup = parentMarkup? . parentMarkup
9294 }
9395
9496 var tabStops : [ NSTextTab ] = [ . init( textAlignment: . left, location: headIndent + parentIndent) ]
9597 tabStops. append ( . init( textAlignment: . left, location: headIndent + parentIndent + dotIndent + indent) )
9698
97-
9899 style. paragraphStyle. tabStops = style. paragraphStyle. tabStops ?? tabStops
99100 style. paragraphStyle. headIndent = style. paragraphStyle. headIndent ?? style. paragraphStyle. tabStops? . last? . location
100101 return style
Original file line number Diff line number Diff line change @@ -96,11 +96,12 @@ public final class ZHTMLParser {
9696 }
9797
9898 public func stripper( _ attributedString: NSAttributedString ) -> NSAttributedString {
99- let items = process ( attributedString)
99+ let stripedAttributedString = decodeHTMLEntities ( attributedString)
100+ let items = process ( stripedAttributedString)
100101 let reuslt = htmlParsedResultToHTMLElementWithRootMarkupProcessor. process ( from: items)
101- let attributedString = markupStripperProcessor. process ( from: reuslt. markup)
102+ let resultAttributedString = markupStripperProcessor. process ( from: reuslt. markup)
102103
103- return attributedString
104+ return resultAttributedString
104105 }
105106
106107 //
You can’t perform that action at this time.
0 commit comments