File tree Expand file tree Collapse file tree 3 files changed +5
-38
lines changed Expand file tree Collapse file tree 3 files changed +5
-38
lines changed Original file line number Diff line number Diff line change 7
7
8
8
import Foundation
9
9
10
- public enum ParagraphSpacingPolicy {
11
- ///
12
- /// In this mode, line break will be used to create spacing between paragraphs
13
- ///
14
- /// For example
15
- /// Line 1
16
- ///
17
- /// Line 2
18
- case lineBreaks
19
- ///
20
- /// In this mode new additional line breaks are added.
21
- ///
22
- /// Instead the MarkupStyleParagraphStyle.paragraphSpacing will create spacing between paragraphs.
23
- ///
24
- /// For example
25
- /// Line 1
26
- /// Line 2
27
- ///
28
- case paragraphSpacing
29
- }
30
-
31
-
32
10
final class MarkupRenderProcessor : ParserProcessor {
33
11
typealias From = ( Markup , [ MarkupStyleComponent ] )
34
12
typealias To = NSAttributedString
35
13
36
14
let rootStyle : MarkupStyle ?
37
- let paragraphSpacingPolicy : ParagraphSpacingPolicy
38
15
39
- init ( rootStyle: MarkupStyle ? , paragraphSpacingPolicy : ParagraphSpacingPolicy = . lineBreaks ) {
16
+ init ( rootStyle: MarkupStyle ? ) {
40
17
self . rootStyle = rootStyle
41
- self . paragraphSpacingPolicy = paragraphSpacingPolicy
42
18
}
43
19
44
20
func process( from: From ) -> To {
45
21
let visitor = MarkupNSAttributedStringVisitor (
46
22
components: from. 1 ,
47
- rootStyle: rootStyle,
48
- paragraphSpacingPolicy: paragraphSpacingPolicy
23
+ rootStyle: rootStyle
49
24
)
50
25
return visitor. visit ( markup: from. 0 )
51
26
}
Original file line number Diff line number Diff line change @@ -24,14 +24,13 @@ public final class ZHTMLParser {
24
24
htmlTags: [ HTMLTag ] ,
25
25
styleAttributes: [ HTMLTagStyleAttribute ] ,
26
26
policy: MarkupStylePolicy ,
27
- rootStyle: MarkupStyle ? ,
28
- paragraphSpacingPolicy: ParagraphSpacingPolicy = . lineBreaks
27
+ rootStyle: MarkupStyle ?
29
28
) {
30
29
self . htmlTags = htmlTags
31
30
self . styleAttributes = styleAttributes
32
31
self . rootStyle = rootStyle
33
32
34
- self . markupRenderProcessor = MarkupRenderProcessor ( rootStyle: rootStyle, paragraphSpacingPolicy : paragraphSpacingPolicy )
33
+ self . markupRenderProcessor = MarkupRenderProcessor ( rootStyle: rootStyle)
35
34
36
35
self . htmlParsedResultToHTMLElementWithRootMarkupProcessor = HTMLParsedResultToHTMLElementWithRootMarkupProcessor ( htmlTags: htmlTags)
37
36
self . htmlElementWithMarkupToMarkupStyleProcessor = HTMLElementWithMarkupToMarkupStyleProcessor ( styleAttributes: styleAttributes, policy: policy)
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ public final class ZHTMLParserBuilder {
13
13
private( set) var styleAttributes : [ HTMLTagStyleAttribute ] = [ ]
14
14
private( set) var rootStyle : MarkupStyle ? = . default
15
15
private( set) var policy : MarkupStylePolicy = . respectMarkupStyleFromHTMLStyleAttribute
16
- private( set) var paragraphSpacingPolicy : ParagraphSpacingPolicy = . lineBreaks
17
16
18
17
public init ( ) {
19
18
@@ -64,18 +63,12 @@ public final class ZHTMLParserBuilder {
64
63
return self
65
64
}
66
65
67
- public func set( spacingPolicy: ParagraphSpacingPolicy ) -> Self {
68
- self . paragraphSpacingPolicy = spacingPolicy
69
- return self
70
- }
71
-
72
66
public func build( ) -> ZHTMLParser {
73
67
return ZHTMLParser (
74
68
htmlTags: htmlTags,
75
69
styleAttributes: styleAttributes,
76
70
policy: policy,
77
- rootStyle: rootStyle,
78
- paragraphSpacingPolicy: paragraphSpacingPolicy
71
+ rootStyle: rootStyle
79
72
)
80
73
}
81
74
}
You can’t perform that action at this time.
0 commit comments