Skip to content

Commit ca1ff16

Browse files
author
Alexis Aubry Radanovic
committed
Merge branch 'linux-scanner'
2 parents 056b348 + 2f74385 commit ca1ff16

File tree

5 files changed

+46
-14
lines changed

5 files changed

+46
-14
lines changed

.travis.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
language: objective-c
1+
os:
2+
- linux
3+
- osx
4+
5+
language: generic
6+
sudo: required
7+
dist: trusty
28
osx_image: xcode8
9+
10+
install:
11+
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"; fi
12+
313
script:
4-
- xcodebuild build -project HTMLString.xcodeproj -scheme HTMLString -destination "platform=macOS,arch=x86_64"
5-
- xcodebuild build -project HTMLString.xcodeproj -scheme HTMLString -destination "platform=iOS Simulator,name=iPhone 7 Plus"
6-
- xcodebuild build -project HTMLString.xcodeproj -scheme HTMLString -destination "platform=watchOS Simulator,name=Apple Watch Series 2 - 42mm"
7-
- xcodebuild build -project HTMLString.xcodeproj -scheme HTMLString -destination "platform=tvOS Simulator,name=Apple TV 1080p"
8-
- xcodebuild test -project HTMLString.xcodeproj -scheme HTMLString -destination "platform=macOS,arch=x86_64"
14+
- swift build
15+
- swift test

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 1.0.2
2+
3+
## Fixed
4+
5+
- `unescapingFromHTML` : An API difference between Darwin and Open-Source Foundation in `Scanner` caused compilation to fail on Linux.
6+
7+
## Improvements
8+
9+
- Tests on Linux and macOS
10+
- Minor changes in README and Podspec

HTMLString.podspec

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |s|
22

33
s.name = "HTMLString"
4-
s.version = "1.0.1"
5-
s.summary = "Deal with Strings that contains HTML in Swift"
4+
s.version = "1.0.2"
5+
s.summary = "Convert Strings that contains HTML in Swift"
66

77
s.description = <<-DESC
8-
`HTMLString` is a micro-library written in Swift that enables your app to deal with Strings that contain HTML. It supports ASCII and Unicode Escaping, Unescaping. You can use it with 2125 named escape sequences (`&amp;`) as well as with decimal (`&#128;`) and hexadecimal (`&#x1F643;`) sequences.
8+
HTMLString is a micro-library written in Swift that enables your app to convert Strings that contain HTML. It supports ASCII and Unicode escaping, as well as unescaping. You can use it with 2125 named escape sequences (`&amp;`) as well as with decimal (`&#128;`) and hexadecimal (`&#x1F643;`) sequences.
99
DESC
1010

1111
s.homepage = "https://github.com/alexaubry/HTMLString"
@@ -22,6 +22,5 @@ DESC
2222

2323
s.source = { :git => "https://github.com/alexaubry/HTMLString.git", :tag => "#{s.version}" }
2424
s.source_files = "Sources"
25-
s.framework = "Foundation"
2625

2726
end

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# `import HTMLString`
22

3-
![Build Status](https://travis-ci.org/alexaubry/HTMLString.svg?branch=master) ![Swift 3.0](https://img.shields.io/badge/Swift-3.0-Orange.svg) ![CocoaPods](https://img.shields.io/cocoapods/v/HTMLString.svg?maxAge=86400") ![The MIT License](https://img.shields.io/cocoapods/l/HTMLString.svg?maxAge=86400")
3+
![Swift 3.0](https://img.shields.io/badge/Swift-3.0-Orange.svg)
4+
![The MIT License](https://img.shields.io/cocoapods/l/HTMLString.svg)
5+
[![Build Status](https://travis-ci.org/alexaubry/HTMLString.svg?branch=master)](https://travis-ci.org/alexaubry/HTMLString)
6+
![CocoaPods](https://img.shields.io/cocoapods/v/HTMLString.svg?maxAge=86400")
47

5-
`HTMLString` is a micro-library written in Swift that enables your app to deal with Strings that contain HTML.
8+
`HTMLString` is a micro-library written in Swift that enables your app to convert Strings that contain HTML.
69

710
## Features
811

@@ -25,7 +28,7 @@
2528
Add this line to your `Podfile`:
2629

2730
~~~
28-
pod 'HTMLString' '~> 1.0.1'
31+
pod 'HTMLString' '~> 1.0.2'
2932
~~~
3033

3134
### Swift Package Manager
@@ -50,7 +53,7 @@ This library adds three properties to String instances :
5053
### Escaping
5154

5255
~~~swift
53-
import HTMLString
56+
import HTMLString
5457

5558
let emoji = "My favorite emoji is 🙃"
5659
let escapedEmoji = emoji.escapingForASCIIHTML // "My favorite emoji is &#128579;"

Sources/HTMLString.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,25 @@ public extension String {
130130
if isHexadecimal {
131131

132132
let scanner = Scanner(string: sequence)
133+
134+
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
133135

134136
guard scanner.scanHexInt32(&value) && value > 0 else {
135137
searchRange = escapeRange.upperBound ..< finalString.endIndex
136138
continue
137139
}
138140

141+
#else
142+
143+
guard let _value = scanner.scanHexInt() else {
144+
searchRange = escapeRange.upperBound ..< finalString.endIndex
145+
continue
146+
}
147+
148+
value = _value
149+
150+
#endif
151+
139152
} else {
140153

141154
guard let _value = UInt32(sequence) else {

0 commit comments

Comments
 (0)