Skip to content

Commit a6cd4d6

Browse files
committed
add tests & bump version
1 parent fb2264b commit a6cd4d6

16 files changed

+28
-22
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ The chart above shows the elapsed time (in seconds) to render different HTML str
4848

4949
- File > Swift Packages > Add Package Dependency
5050
- Add `https://github.com/ZhgChgLi/ZMarkupParser.git`
51-
- Select "Up to Next Major" with "1.5.2"
51+
- Select "Up to Next Major" with "1.6.0"
5252

5353
or
5454

5555
```swift
5656
...
5757
dependencies: [
58-
.package(url: "https://github.com/ZhgChgLi/ZMarkupParser.git", from: "1.5.2"),
58+
.package(url: "https://github.com/ZhgChgLi/ZMarkupParser.git", from: "1.6.0"),
5959
]
6060
...
6161
.target(
@@ -74,7 +74,7 @@ platform :ios, '12.0'
7474
use_frameworks!
7575

7676
target 'MyApp' do
77-
pod 'ZMarkupParser', '~> 1.5.2'
77+
pod 'ZMarkupParser', '~> 1.6.0'
7878
end
7979
```
8080

Sources/ZMarkupParser/HTML/Processor/HTMLTagAttributeToMarkupStyleVisitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ struct HTMLTagStyleAttributeToMarkupStyleVisitor: HTMLTagStyleAttributeVisitor {
127127
return .justified
128128
case "natural":
129129
return .natural
130-
case "right":
130+
case "right", "start":
131131
return .right
132-
case "left":
132+
case "left", "end":
133133
return .left
134134
default:
135135
return nil

Tests/ZMarkupParserSnapshotTests/ZMarkupParserSnapshotTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ final class ZHTMLToNSAttributedStringSnapshotTests: XCTestCase {
6363
precode
6464
precode2
6565
</code></pre>
66+
<div style="text-align: right;">
67+
ZMarkupParser is a pure-Swift library that helps you convert HTML strings into NSAttributedString with customized styles and tags.ZMarkupParser is a pure-Swift library that helps you convert HTML strings into NSAttributedString with customized styles and tags.ZMarkupParser is a pure-Swift library that helps you convert HTML strings into NSAttributedString with customized styles and tags.ZMarkupParser is a pure-Swift library that helps you convert HTML strings into NSAttributedString with customized styles and tags.ZMarkupParser is a pure-Swift library that helps you convert HTML strings into NSAttributedString with customized styles and tags.
68+
</div>
6669
&lt;font color="#008000;"&gt;Test&nbsp;XXX&lt;/font&gt;
6770
"""
6871

ZMarkupParser-Demo/ZMarkupParser-Demo/Base.lproj/Main.storyboard

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@
3838
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="h0m-Ya-0jH">
3939
<rect key="frame" x="25" y="171" width="340" height="165.66666666666663"/>
4040
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
41-
<mutableString key="text">
Powered by &lt;span style="font-family: 'Times New Roman', Times, serif;"&gt;ZhgChgLi&lt;/span&gt;. &lt;br/&gt;

&lt;img src="https://user-images.githubusercontent.com/33706588/219608966-20e0c017-d05c-433a-9a52-091bc0cfd403.jpg"/&gt;

🎄🎄🎄 &lt;Hottest&gt; &lt;b&gt;Christmas gi&lt;u&gt;fts&lt;/b&gt; are here&lt;/u&gt;! Give you more gift-giving inspiration~&lt;br /&gt;
42-
The &lt;u&gt;final &lt;del&gt;countdown&lt;/del&gt;&lt;/u&gt; on 12/9, NT$100 discount for all purchases over NT$1,000, plus a 12/12 one-day limited free shipping coupon&lt;br /&gt;
43-
&lt;zhgchgli&gt;Top 10 Popular &lt;b&gt;&lt;span style="color:green"&gt;Christmas&lt;/span&gt; Gift&lt;/b&gt; Recommendations 👉&lt;/zhgchgli&gt;&lt;br&gt;
44-
&lt;ol&gt;
45-
&lt;li&gt;&lt;a href="https://zhgchg.li"&gt;Christmas Mini Diffuser Gift Box&lt;/a&gt;|The first choice for exchanging gifts&lt;/li&gt;
46-
&lt;li&gt;&lt;a href="https://zhgchg.li"&gt;German design hair remover&lt;/a&gt;&lt;strong&gt;500&lt;/strong&gt; yuan practical gift like this&lt;/li&gt;
47-
&lt;li&gt;&lt;a href="https://zhgchg.li"&gt;Drink cup&lt;/a&gt;|Fund-raising and praise exceeded 10 million&lt;/li&gt;
48-
&lt;/ol&gt;
49-
&lt;hr/&gt;
50-
&lt;p&gt;Before 12/26, place an order and draw a round-trip ticket for two to Japan!&lt;/p&gt;
51-
你好你好&lt;span style="background-color:red"&gt;你好你好&lt;/span&gt;你好你好 &lt;br /&gt;
52-
안녕하세요안녕하세&lt;span style="color:red"&gt;요안녕하세&lt;/span&gt;요안녕하세요안녕하세요안녕하세요 &lt;br /&gt;
53-
&lt;span style="color:red"&gt;こんにちは&lt;/span&gt;こんにちはこんにちは &lt;br /&gt;
</mutableString>
5441
<color key="textColor" systemColor="labelColor"/>
5542
<fontDescription key="fontDescription" type="system" pointSize="14"/>
5643
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>

ZMarkupParser-Demo/ZMarkupParser-Demo/ViewController.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ class ViewController: UIViewController {
3232
override func viewDidLoad() {
3333
super.viewDidLoad()
3434

35+
inputTextView.text = """
36+

Powered by <span style="font-family: 'Times New Roman', Times, serif;">ZhgChgLi</span>. <br/>

<img src="https://user-images.githubusercontent.com/33706588/219608966-20e0c017-d05c-433a-9a52-091bc0cfd403.jpg"/>

🎄🎄🎄 <Hottest> <b>Christmas gi<u>fts</b> are here</u>! Give you more gift-giving inspiration~<br />
37+
The <u>final <del>countdown</del></u> on 12/9, NT$100 discount for all purchases over NT$1,000, plus a 12/12 one-day limited free shipping coupon<br />
38+
<zhgchgli>Top 10 Popular <b><span style="color:green">Christmas</span> Gift</b> Recommendations 👉</zhgchgli><br>
39+
<ol>
40+
<li><a href="https://zhgchg.li">Christmas Mini Diffuser Gift Box</a>|The first choice for exchanging gifts</li>
41+
<li><a href="https://zhgchg.li">German design hair remover</a>|<strong>500</strong> yuan practical gift like this</li>
42+
<li><a href="https://zhgchg.li">Drink cup</a>|Fund-raising and praise exceeded 10 million</li>
43+
</ol>
44+
<hr/>
45+
<p>Before 12/26, place an order and draw a round-trip ticket for two to Japan!</p>
46+
你好你好<span style="background-color:red">你好你好</span>你好你好 <br />
47+
안녕하세요안녕하세<span style="color:red">요안녕하세</span>요안녕하세요안녕하세요안녕하세요 <br />
48+
<span style="color:red">こんにちは</span>こんにちはこんにちは <br />

49+
"""
50+
3551
// Do any additional setup after loading the view.
3652
}
3753
}

ZMarkupParser.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/ZMarkupParser.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ZMarkupParser"
3-
s.version = "1.5.2"
3+
s.version = "1.6.0"
44
s.summary = "ZMarkupParser helps you to convert HTML String to NSAttributedString with customized style and tag through pure-Swift."
55
s.homepage = "https://github.com/ZhgChgLi/ZMarkupParser"
66
s.license = { :type => "MIT", :file => "LICENSE" }

0 commit comments

Comments
 (0)