...`)
-* Reliably creating the document structure (`html` containing a `head` and `body`, and only appropriate elements within the head)
-
-
-### The object model of a document
-* Documents consist of Elements and TextNodes
-* The inheritance chain is: `Document` extends `Element` extends `Node.TextNode` extends `Node`.
-* An Element contains a list of children Nodes, and has one parent Element. They also have provide a filtered list of child Elements only.
-
-
-
-
-# Extract attributes, text, and HTML from elements
-### Problem
-After parsing a document, and finding some elements, you'll want to get at the data inside those elements.
-### Solution
-- To get the value of an attribute, use the `Node.attr(_ String key)` method
-- For the text on an element (and its combined children), use `Element.text()`
-- For HTML, use `Element.html()`, or `Node.outerHtml()` as appropriate
-
-```swift
-do {
- let html: String = " An example link. ";
- let doc: Document = try SwiftSoup.parse(html)
- let link: Element = try doc.select("a").first()!
-
- let text: String = try doc.body()!.text(); // "An example link"
- let linkHref: String = try link.attr("href"); // "http://example.com/"
- let linkText: String = try link.text(); // "example""
-
- let linkOuterH: String = try link.outerHtml(); // "example"
- let linkInnerH: String = try link.html(); // "example"
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-### Description
-The methods above are the core of the element data access methods. There are additional others:
-- `Element.id()`
-- `Element.tagName()`
-- `Element.className()` and `Element.hasClass(_ String className)`
-
-All of these accessor methods have corresponding setter methods to change the data.
-
-
-
-
-
-# Parse a document from a String
-### Problem
-You have HTML in a Swift String, and you want to parse that HTML to get at its contents, or to make sure it's well formed, or to modify it. The String may have come from user input, a file, or from the web.
-### Solution
-Use the static `SwiftSoup.parse(_ html: String)` method, or `SwiftSoup.parse(_ html: String, _ baseUri: String)`.
-
-```swift
-do {
- let html = "First parse"
- + "Parsed HTML into a doc. "
- let doc: Document = try SwiftSoup.parse(html)
- return try doc.text()
-} catch Exception.Error(let type, let message) {
- print("")
-} catch {
- print("")
-}
-```
-### Description
-The `parse(_ html: String, _ baseUri: String)` method parses the input HTML into a new `Document`. The base URI argument is used to resolve relative URLs into absolute URLs, and should be set to the URL where the document was fetched from. If that's not applicable, or if you know the HTML has a base element, you can use the `parse(_ html: String)` method.
-
-As long as you pass in a non-null string, you're guaranteed to have a successful, sensible parse, with a Document containing (at least) a `head` and a `body` element.
-
-Once you have a `Document`, you can get at the data using the appropriate methods in `Document` and its supers `Element` and `Node`.
-
-
-
-# Parsing a body fragment
-### Problem
-You have a fragment of body HTML (e.g. `div` containing a couple of p tags; as opposed to a full HTML document) that you want to parse. Perhaps it was provided by a user submitting a comment, or editing the body of a page in a CMS.
-### Solution
-Use the `SwiftSoup.parseBodyFragment(_ html: String)` method.
-
-```swift
-do {
- let html: String = "Lorem ipsum. "
- let doc: Document = try SwiftSoup.parseBodyFragment(html)
- let body: Element? = doc.body()
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-### Description
-The `parseBodyFragment` method creates an empty shell document, and inserts the parsed HTML into the `body` element. If you used the normal `SwiftSoup(_ html: String)` method, you would generally get the same result, but explicitly treating the input as a body fragment ensures that any bozo HTML provided by the user is parsed into the `body` element.
-
-The `Document.body()` method retrieves the element children of the document's `body` element; it is equivalent to `doc.getElementsByTag("body")`.
-
-### Stay safe
-If you are going to accept HTML input from a user, you need to be careful to avoid cross-site scripting attacks. See the documentation for the `Whitelist` based cleaner, and clean the input with `clean(String bodyHtml, Whitelist whitelist)`.
-
-
-
-
-
-# Sanitize untrusted HTML (to prevent XSS)
-### Problem
-You want to allow untrusted users to supply HTML for output on your website (e.g. as comment submission). You need to clean this HTML to avoid [cross-site scripting](https://en.wikipedia.org/wiki/Cross-site_scripting) (XSS) attacks.
-### Solution
-Use the SwiftSoup HTML `Cleaner` with a configuration specified by a `Whitelist`.
-
-```swift
-do {
- let unsafe: String = " Link "
- let safe: String = try SwiftSoup.clean(unsafe, Whitelist.basic())!
- // now: Link
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-### Discussion
-A cross-site scripting attack against your site can really ruin your day, not to mention your users'. Many sites avoid XSS attacks by not allowing HTML in user submitted content: they enforce plain text only, or use an alternative markup syntax like wiki-text or Markdown. These are seldom optimal solutions for the user, as they lower expressiveness, and force the user to learn a new syntax.
-
-A better solution may be to use a rich text WYSIWYG editor (like [CKEditor](http://ckeditor.com) or [TinyMCE](https://www.tinymce.com)). These output HTML, and allow the user to work visually. However, their validation is done on the client side: you need to apply a server-side validation to clean up the input and ensure the HTML is safe to place on your site. Otherwise, an attacker can avoid the client-side Javascript validation and inject unsafe HMTL directly into your site
-
-The SwiftSoup whitelist sanitizer works by parsing the input HTML (in a safe, sand-boxed environment), and then iterating through the parse tree and only allowing known-safe tags and attributes (and values) through into the cleaned output.
-
-It does not use regular expressions, which are inappropriate for this task.
-
-SwiftSoup provides a range of `Whitelist` configurations to suit most requirements; they can be modified if necessary, but take care.
-
-The cleaner is useful not only for avoiding XSS, but also in limiting the range of elements the user can provide: you may be OK with textual `a`, `strong` elements, but not structural `div` or `table` elements.
-
-### See also
-- See the [XSS cheat sheet](http://ha.ckers.org/xss.html) and filter evasion guide, as an example of how regular-expression filters don't work, and why a safe whitelist parser-based sanitizer is the correct approach.
-- See the `Cleaner` reference if you want to get a `Document` instead of a String return
-- See the `Whitelist` reference for the different canned options, and to create a custom whitelist
-- The [nofollow](https://en.wikipedia.org/wiki/Nofollow) link attribute
-
-
-
-
-# Set attribute values
-### Problem
-You have a parsed document that you would like to update attribute values on, before saving it out to disk, or sending it on as a HTTP response.
-
-### Solution
-Use the attribute setter methods `Element.attr(_ key: String, _ value: String)`, and `Elements.attr(_ key: String, _ value: String)`.
-
-If you need to modify the class attribute of an element, use the `Element.addClass(_ className: String)` and `Element.removeClass(_ className: String)` methods.
-
-The `Elements` collection has bulk attribute and class methods. For example, to add a `rel="nofollow"` attribute to every `a` element inside a div:
-
-```swift
-do {
- try doc.select("div.comments a").attr("rel", "nofollow")
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-### Description
-Like the other methods in `Element`, the attr methods return the current `Element` (or `Elements` when working on a collection from a select). This allows convenient method chaining:
-
-```swift
-do {
- try doc.select("div.masthead").attr("title", "swiftsoup").addClass("round-box");
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-
-# Set the HTML of an element
-### Problem
-You need to modify the HTML of an element.
-### Solution
-Use the HTML setter methods in `Element`:
-```swift
-do {
- let doc: Document = try SwiftSoup.parse(" One One")
- let div: Element = try doc.select("div").first()! //
- try div.html(" lorem ipsum ") //
- try div.prepend(" First ")
- try div.append(" Last ")
- print(div)
- // now div is:
-
- let span: Element = try doc.select("span").first()! // One
- try span.wrap(" ")
- print(doc)
- // now: One
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-### Discussion
-- `Element.html(_ html: String)` clears any existing inner HTML in an element, and replaces it with parsed HTML.
-- `Element.prepend(_ first: String)` and `Element.append(_ last: String)` add HTML to the start or end of an element's inner HTML, respectively
-- `Element.wrap(_ around: String)` wraps HTML around the outer HTML of an element.
-
-### See also
-You can also use the `Element.prependElement(_ tag: String)` and `Element.appendElement(_ tag: String)` methods to create new elements and insert them into the document flow as a child element.
-
-
-
-
-
-# Setting the text content of elements
-### Problem
-You need to modify the text content of an HTML document.
-# Solution
-Use the text setter methods of `Element`:
-
-```swift
-do {
- let doc: Document = try SwiftSoup.parse("")
- let div: Element = try doc.select("div").first()! //
- try div.text("five > four") // five > four
- try div.prepend("First ")
- try div.append(" Last")
- // now: First five > four Last
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-### Discussion
-The text setter methods mirror the [[HTML setter|Set the HTML of an element]] methods:
-- `Element.text(_ text: String)` clears any existing inner HTML in an element, and replaces it with the supplied text.
-- `Element.prepend(_ first: String)` and `Element.append(_ last: String)` add text nodes to the start or end of an element's inner HTML, respectively
-The text should be supplied unencoded: characters like `<`, `>` etc will be treated as literals, not HTML.
-
-
-
-
-
-# Use DOM methods to navigate a document
-### Problem
-You have a HTML document that you want to extract data from. You know generally the structure of the HTML document.
-
-### Solution
-Use the DOM-like methods available after parsing HTML into a `Document`.
-
-```swift
-do {
- let html: String = " One Two"
- let els: Elements = try SwiftSoup.parse(html).select("a")
- for link: Element in els.array() {
- let linkHref: String = try link.attr("href")
- let linkText: String = try link.text()
- }
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-### Description
-Elements provide a range of DOM-like methods to find elements, and extract and manipulate their data. The DOM getters are contextual: called on a parent Document they find matching elements under the document; called on a child element they find elements under that child. In this way you can window in on the data you want.
-### Finding elements
-* `getElementById(_ id: String)`
-* `getElementsByTag(_ tag:String)`
-* `getElementsByClass(_ className: String)`
-* `getElementsByAttribute(_ key: String)` (and related methods)
-* Element siblings: `siblingElements()`, `firstElementSibling()`, `lastElementSibling()`, `nextElementSibling()`, `previousElementSibling()`
-* Graph: `parent()`, `children()`, `child(_ index: Int)`
-
-# Element data
-* `attr(_ key: Strin)` to get and `attr(_ key: String, _ value: String)` to set attributes
-* `attributes()` to get all attributes
-* `id()`, `className()` and `classNames()`
-* `text()` to get and `text(_ value: String)` to set the text content
-* `html()` to get and `html(_ value: String)` to set the inner HTML content
-* `outerHtml()` to get the outer HTML value
-* `data()` to get data content (e.g. of script and style tags)
-* `tag()` and `tagName()`
-
-### Manipulating HTML and text
-* `append(_ html: String)`, `prepend(html: String)`
-* `appendText(text: String)`, `prependText(text: String)`
-* `appendElement(tagName: String)`, `prependElement(tagName: String)`
-* `html(_ value: String)`
-
-
-
-
-
-
-
-
-
-
-
-
-# Use selector syntax to find elements
-### Problem
-You want to find or manipulate elements using a CSS or jQuery-like selector syntax.
-### Solution
-Use the `Element.select(_ selector: String)` and `Elements.select(_ selector: String)` methods:
-
-```swift
-do {
- let doc: Document = try SwiftSoup.parse("...")
- let links: Elements = try doc.select("a[href]") // a with href
- let pngs: Elements = try doc.select("img[src$=.png]")
- // img with src ending .png
- let masthead: Element? = try doc.select("div.masthead").first()
- // div with class=masthead
- let resultLinks: Elements? = try doc.select("h3.r > a") // direct a after h3
-} catch Exception.Error(let type, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-### Description
-SwiftSoup elements support a [CSS](https://www.w3.org/TR/2009/PR-css3-selectors-20091215/) (or [jQuery](http://jquery.com)) like selector syntax to find matching elements, that allows very powerful and robust queries.
-
-The `select` method is available in a `Document`, `Element`, or in `Elements`. It is contextual, so you can filter by selecting from a specific element, or by chaining select calls.
-
-Select returns a list of `Elements` (as `Elements`), which provides a range of methods to extract and manipulate the results.
-### Selector overview
-* `tagname`: find elements by tag, e.g. `a`
-* `ns|tag`: find elements by tag in a namespace, e.g. `fb|name` finds ` ` elements
-* `#id`: find elements by ID, e.g. `#logo`
-* `.class`: find elements by class name, e.g. `.masthead`
-* `[attribute]`: elements with attribute, e.g. `[href]`
-* `[^attr]`: elements with an attribute name prefix, e.g. `[^data-]` finds elements with HTML5 dataset attributes
-* `[attr=value]`: elements with attribute value, e.g. `[width=500]` (also quotable, like `[data-name='launch sequence']`)
-* `[attr^=value]`, `[attr$=value]`, `[attr*=value]`: elements with attributes that start with, end with, or contain the value, e.g. `[href*=/path/]`
-* `[attr~=regex]`: elements with attribute values that match the regular expression; e.g. `img[src~=(?i)\.(png|jpe?g)]`
-* `*`: all elements, e.g. `*`
-### Selector combinations
-* `el#id`: elements with ID, e.g. `div#logo`
-* `el.class`: elements with class, e.g. `div.masthead`
-* `el[attr]`: elements with attribute, e.g. `a[href]`
-* Any combination, e.g. `a[href].highlight`
-* Ancestor `child`: child elements that descend from ancestor, e.g. `.body p` finds `p` elements anywhere under a block with class "body"
-* `parent > child`: child elements that descend directly from parent, e.g. `div.content > p` finds p elements; and `body > *` finds the direct children of the body tag
-* `siblingA + siblingB`: finds sibling B element immediately preceded by sibling A, e.g. `div.head + div`
-* `siblingA ~ siblingX`: finds sibling X element preceded by sibling A, e.g. `h1 ~ p`
-* `el`, `el`, `el`: group multiple selectors, find unique elements that match any of the selectors; e.g. `div.masthead`, `div.logo`
-
-### Pseudo selectors
-* `:lt(n)`: find elements whose sibling index (i.e. its position in the DOM tree relative to its parent) is less than n; e.g. `td:lt(3)`
-* `:gt(n)`: find elements whose sibling index is greater than n; e.g. `div p:gt(2)`
-* `:eq(n)`: find elements whose sibling index is equal to n; e.g. `form input:eq(1)`
-* `:has(seletor)`: find elements that contain elements matching the selector; e.g. `div:has(p)`
-* `:not(selector)`: find elements that do not match the selector; e.g. `div:not(.logo)`
-* `:contains(text)`: find elements that contain the given text. The search is case-insensitive; e.g. `p:contains(swiftsoup)`
-* `:containsOwn(text)`: find elements that directly contain the given text
-* `:matches(regex)`: find elements whose text matches the specified regular expression; e.g. `div:matches((?i)login)`
-* `:matchesOwn(regex)`: find elements whose own text matches the specified regular expression
-* Note that the above indexed pseudo-selectors are 0-based, that is, the first element is at index 0, the second at 1, etc
-
-# Examples
-## To parse an HTML document from String:
-
-```swift
-let html = "First parseParsed HTML into a doc. "
-guard let doc: Document = try? SwiftSoup.parse(html) else { return }
-```
-
-## Get all text nodes:
-
-```swift
-guard let elements = try? doc.getAllElements() else { return html }
-for element in elements {
- for textNode in element.textNodes() {
- [...]
- }
-}
-```
-
-## Set CSS using SwiftSoup:
-
-```swift
-try doc.head()?.append("")
-```
-
-## Get HTML value
-```swift
-let html = ""
- + " "
-guard let doc: Document = try? SwiftSoup.parse(html) else { return } // parse html
-let elements = try doc.select("[name=transaction_id]") // query
-let transaction_id = try elements.get(0) // select first element
-let value = try transaction_id.val() // get value
-print(value) // 4245
-```
-## How to remove all the html from a string
-
-```swift
-guard let doc: Document = try? SwiftSoup.parse(html) else { return } // parse html
-guard let txt = try? doc.text() else { return }
-print(txt)
-```
-
-## How to get and update XML values
-
-```swift
-let xml = " One"
-guard let doc = try? SwiftSoup.parse(xml, "", Parser.xmlParser()) else { return }
-guard let element = try? doc.getElementsByTag("val").first() // Find first element
-element.text("NewValue") // Edit Value
-let valueString = element.text() // "NewValue"
-```
-
-## How to get all ` `
-
-```swift
-do {
- let doc: Document = try SwiftSoup.parse(html)
- let srcs: Elements = try doc.select("img[src]")
- let srcsStringArray: [String?] = srcs.array().map { try? $0.attr("src").description }
- // do something with srcsStringArray
-} catch Exception.Error(_, let message) {
- print(message)
-} catch {
- print("error")
-}
-```
-
-## Get all `href` of ` `
-
-```swift
-let html = "One Two"
-guard let els: Elements = try? SwiftSoup.parse(html).select("a") else { return }
-for element: Element in els.array() {
- print(try? element.attr("href"))
-}
-```
-Output:
-```
-"?foo=bar&mid<=true"
-"?foo=bar Å å π 新 there ¾ © »"
-
-
-"Hello &<> Å å π 新 there ¾ © »"
-"Hello &<> Å å π 新 there ¾ © »"
-"Hello &<> Å å π 新 there ¾ © »"
-"Hello &<> Å å π 新 there ¾ © »"
-"Hello &<> Å å π 新 there ¾ © »"
-
-```
-
-
-
-## Author
-
-Nabil Chatbi, scinfu@gmail.com
-
-## Note
-SwiftSoup was ported to Swift from Java [Jsoup](https://jsoup.org/) library.
-
-## License
-
-SwiftSoup is available under the MIT license. See the LICENSE file for more info.
diff --git a/Pods/SwiftSoup/Sources/ArrayExt.swift b/Pods/SwiftSoup/Sources/ArrayExt.swift
deleted file mode 100644
index a3b329f..0000000
--- a/Pods/SwiftSoup/Sources/ArrayExt.swift
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// ArrayExt.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 05/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-extension Array where Element : Equatable {
- func lastIndexOf(_ e: Element) -> Int {
- for pos in (0.. String {
- return key
- }
-
- /**
- Set the attribute key; case is preserved.
- @param key the new key; must not be null
- */
- open func setKey(key: String) throws {
- try Validate.notEmpty(string: key)
- self.key = key.trim()
- }
-
- /**
- Get the attribute value.
- @return the attribute value
- */
- open func getValue() -> String {
- return value
- }
-
- /**
- Set the attribute value.
- @param value the new attribute value; must not be null
- */
- @discardableResult
- open func setValue(value: String) -> String {
- let old = self.value
- self.value = value
- return old
- }
-
- /**
- Get the HTML representation of this attribute; e.g. {@code href="index.html"}.
- @return HTML
- */
- public func html() -> String {
- let accum = StringBuilder()
- html(accum: accum, out: (Document("")).outputSettings())
- return accum.toString()
- }
-
- public func html(accum: StringBuilder, out: OutputSettings ) {
- accum.append(key)
- if (!shouldCollapseAttribute(out: out)) {
- accum.append("=\"")
- Entities.escape(accum, value, out, true, false, false)
- accum.append("\"")
- }
- }
-
- /**
- Get the string representation of this attribute, implemented as {@link #html()}.
- @return string
- */
- open func toString() -> String {
- return html()
- }
-
- /**
- * Create a new Attribute from an unencoded key and a HTML attribute encoded value.
- * @param unencodedKey assumes the key is not encoded, as can be only run of simple \w chars.
- * @param encodedValue HTML attribute encoded value
- * @return attribute
- */
- public static func createFromEncoded(unencodedKey: String, encodedValue: String) throws ->Attribute {
- let value = try Entities.unescape(string: encodedValue, strict: true)
- return try Attribute(key: unencodedKey, value: value)
- }
-
- public func isDataAttribute() -> Bool {
- return key.startsWith(Attributes.dataPrefix) && key.count > Attributes.dataPrefix.count
- }
-
- /**
- * Collapsible if it's a boolean attribute and value is empty or same as name
- *
- * @param out Outputsettings
- * @return Returns whether collapsible or not
- */
- public final func shouldCollapseAttribute(out: OutputSettings) -> Bool {
- return ("" == value || value.equalsIgnoreCase(string: key))
- && out.syntax() == OutputSettings.Syntax.html
- && isBooleanAttribute()
- }
-
- public func isBooleanAttribute() -> Bool {
- return Attribute.booleanAttributes.contains(key)
- }
-
- public func hashCode() -> Int {
- var result = key.hashValue
- result = 31 * result + value.hashValue
- return result
- }
-
- public func clone() -> Attribute {
- do {
- return try Attribute(key: key, value: value)
- } catch Exception.Error( _, let msg) {
- print(msg)
- } catch {
-
- }
- return try! Attribute(key: "", value: "")
- }
-}
-
-extension Attribute: Equatable {
- static public func == (lhs: Attribute, rhs: Attribute) -> Bool {
- return lhs.value == rhs.value && lhs.key == rhs.key
- }
-
-}
diff --git a/Pods/SwiftSoup/Sources/Attributes.swift b/Pods/SwiftSoup/Sources/Attributes.swift
deleted file mode 100644
index 46c6098..0000000
--- a/Pods/SwiftSoup/Sources/Attributes.swift
+++ /dev/null
@@ -1,264 +0,0 @@
-//
-// Attributes.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * The attributes of an Element.
- *
- * Attributes are treated as a map: there can be only one value associated with an attribute key/name.
- *
- *
- * Attribute name and value comparisons are case sensitive. By default for HTML, attribute names are
- * normalized to lower-case on parsing. That means you should use lower-case strings when referring to attributes by
- * name.
- *
- *
- *
- */
-open class Attributes: NSCopying {
-
- public static var dataPrefix: String = "data-"
-
- var attributes: OrderedDictionary = OrderedDictionary()
- // linked hash map to preserve insertion order.
- // null be default as so many elements have no attributes -- saves a good chunk of memory
-
- public init() {}
-
- /**
- Get an attribute value by key.
- @param key the (case-sensitive) attribute key
- @return the attribute value if set; or empty string if not set.
- @see #hasKey(String)
- */
- open func get(key: String) -> String {
- let attr: Attribute? = attributes.get(key: key)
- return attr != nil ? attr!.getValue() : ""
- }
-
- /**
- * Get an attribute's value by case-insensitive key
- * @param key the attribute name
- * @return the first matching attribute value if set; or empty string if not set.
- */
- open func getIgnoreCase(key: String )throws -> String {
- try Validate.notEmpty(string: key)
-
- for attrKey in (attributes.keySet()) {
- if attrKey.equalsIgnoreCase(string: key) {
- return attributes.get(key: attrKey)!.getValue()
- }
- }
- return ""
- }
-
- /**
- Set a new attribute, or replace an existing one by key.
- @param key attribute key
- @param value attribute value
- */
- open func put(_ key: String, _ value: String) throws {
- let attr = try Attribute(key: key, value: value)
- put(attribute: attr)
- }
-
- /**
- Set a new boolean attribute, remove attribute if value is false.
- @param key attribute key
- @param value attribute value
- */
- open func put(_ key: String, _ value: Bool) throws {
- if (value) {
- try put(attribute: BooleanAttribute(key: key))
- } else {
- try remove(key: key)
- }
- }
-
- /**
- Set a new attribute, or replace an existing one by key.
- @param attribute attribute
- */
- open func put(attribute: Attribute) {
- attributes.put(value: attribute, forKey: attribute.getKey())
- }
-
- /**
- Remove an attribute by key. Case sensitive.
- @param key attribute key to remove
- */
- open func remove(key: String)throws {
- try Validate.notEmpty(string: key)
- attributes.remove(key: key)
- }
-
- /**
- Remove an attribute by key. Case insensitive.
- @param key attribute key to remove
- */
- open func removeIgnoreCase(key: String ) throws {
- try Validate.notEmpty(string: key)
- for attrKey in attributes.keySet() {
- if (attrKey.equalsIgnoreCase(string: key)) {
- attributes.remove(key: attrKey)
- }
- }
- }
-
- /**
- Tests if these attributes contain an attribute with this key.
- @param key case-sensitive key to check for
- @return true if key exists, false otherwise
- */
- open func hasKey(key: String) -> Bool {
- return attributes.containsKey(key: key)
- }
-
- /**
- Tests if these attributes contain an attribute with this key.
- @param key key to check for
- @return true if key exists, false otherwise
- */
- open func hasKeyIgnoreCase(key: String) -> Bool {
- for attrKey in attributes.keySet() {
- if (attrKey.equalsIgnoreCase(string: key)) {
- return true
- }
- }
- return false
- }
-
- /**
- Get the number of attributes in this set.
- @return size
- */
- open func size() -> Int {
- return attributes.count//TODO: check retyrn right size
- }
-
- /**
- Add all the attributes from the incoming set to this set.
- @param incoming attributes to add to these attributes.
- */
- open func addAll(incoming: Attributes?) {
- guard let incoming = incoming else {
- return
- }
-
- if (incoming.size() == 0) {
- return
- }
- attributes.putAll(all: incoming.attributes)
- }
-
-// open func iterator() -> IndexingIterator> {
-// if (attributes.isEmpty) {
-// let args: [Attribute] = []
-// return args.makeIterator()
-// }
-// return attributes.orderedValues.makeIterator()
-// }
-
- /**
- Get the attributes as a List, for iteration. Do not modify the keys of the attributes via this view, as changes
- to keys will not be recognised in the containing set.
- @return an view of the attributes as a List.
- */
- open func asList() -> Array {
- var list: Array = Array(/*attributes.size()*/)
- for entry in attributes.orderedValues {
- list.append(entry)
- }
- return list
- }
-
- /**
- * Retrieves a filtered view of attributes that are HTML5 custom data attributes; that is, attributes with keys
- * starting with {@code data-}.
- * @return map of custom data attributes.
- */
- //Map
- open func dataset() -> Dictionary {
- var dataset = Dictionary()
- for attribute in attributes {
- let attr = attribute.1
- if(attr.isDataAttribute()) {
- let key = attr.getKey().substring(Attributes.dataPrefix.count)
- dataset[key] = attribute.1.getValue()
- }
- }
- return dataset
- }
-
- /**
- Get the HTML representation of these attributes.
- @return HTML
- @throws SerializationException if the HTML representation of the attributes cannot be constructed.
- */
- open func html()throws -> String {
- let accum = StringBuilder()
- try html(accum: accum, out: Document("").outputSettings()) // output settings a bit funky, but this html() seldom used
- return accum.toString()
- }
-
- public func html(accum: StringBuilder, out: OutputSettings ) throws {
- for attribute in attributes.orderedValues {
- accum.append(" ")
- attribute.html(accum: accum, out: out)
- }
- }
-
- open func toString()throws -> String {
- return try html()
- }
-
- /**
- * Checks if these attributes are equal to another set of attributes, by comparing the two sets
- * @param o attributes to compare with
- * @return if both sets of attributes have the same content
- */
- open func equals(o: AnyObject?) -> Bool {
- if(o == nil) {return false}
- if (self === o.self) {return true}
- guard let that: Attributes = o as? Attributes else {return false}
- return (attributes == that.attributes)
- }
-
- /**
- * Calculates the hashcode of these attributes, by iterating all attributes and summing their hashcodes.
- * @return calculated hashcode
- */
- open func hashCode() -> Int {
- return attributes.hashCode()
- }
-
- public func copy(with zone: NSZone? = nil) -> Any {
- let clone = Attributes()
- clone.attributes = attributes.clone()
- return clone
- }
-
- open func clone() -> Attributes {
- return self.copy() as! Attributes
- }
-
- fileprivate static func dataKey(key: String) -> String {
- return dataPrefix + key
- }
-
-}
-
-extension Attributes: Sequence {
- public func makeIterator() -> AnyIterator {
- var list = attributes.orderedValues
- return AnyIterator {
- return list.count > 0 ? list.removeFirst() : nil
- }
- }
-}
diff --git a/Pods/SwiftSoup/Sources/BooleanAttribute.swift b/Pods/SwiftSoup/Sources/BooleanAttribute.swift
deleted file mode 100644
index 793490d..0000000
--- a/Pods/SwiftSoup/Sources/BooleanAttribute.swift
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// BooleanAttribute.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * A boolean attribute that is written out without any value.
- */
-open class BooleanAttribute: Attribute {
- /**
- * Create a new boolean attribute from unencoded (raw) key.
- * @param key attribute key
- */
- init(key: String) throws {
- try super.init(key: key, value: "")
- }
-
- override public func isBooleanAttribute() -> Bool {
- return true
- }
-}
diff --git a/Pods/SwiftSoup/Sources/CharacterExt.swift b/Pods/SwiftSoup/Sources/CharacterExt.swift
deleted file mode 100644
index 2cab2b5..0000000
--- a/Pods/SwiftSoup/Sources/CharacterExt.swift
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// CharacterExt.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 08/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-extension Character {
-
- public static let space: Character = " "
- public static let BackslashT: Character = "\t"
- public static let BackslashN: Character = "\n"
- public static let BackslashF: Character = Character(UnicodeScalar(12))
- public static let BackslashR: Character = "\r"
- public static let BackshashRBackslashN: Character = "\r\n"
-
- //http://www.unicode.org/glossary/#supplementary_code_point
- public static let MIN_SUPPLEMENTARY_CODE_POINT: UInt32 = 0x010000
-
- /// True for any space character, and the control characters \t, \n, \r, \f, \v.
-
- var isWhitespace: Bool {
- switch self {
- case Character.space, Character.BackslashT, Character.BackslashN, Character.BackslashF, Character.BackslashR: return true
- case Character.BackshashRBackslashN: return true
- default: return false
-
- }
- }
-
- /// `true` if `self` normalized contains a single code unit that is in the category of Decimal Numbers.
- var isDigit: Bool {
-
- return isMemberOfCharacterSet(CharacterSet.decimalDigits)
-
- }
-
- /// Lowercase `self`.
- var lowercase: Character {
-
- let str = String(self).lowercased()
- return str[str.startIndex]
-
- }
-
- /// Return `true` if `self` normalized contains a single code unit that is a member of the supplied character set.
- ///
- /// - parameter set: The `NSCharacterSet` used to test for membership.
- /// - returns: `true` if `self` normalized contains a single code unit that is a member of the supplied character set.
- func isMemberOfCharacterSet(_ set: CharacterSet) -> Bool {
-
- let normalized = String(self).precomposedStringWithCanonicalMapping
- let unicodes = normalized.unicodeScalars
-
- guard unicodes.count == 1 else { return false }
- return set.contains(UnicodeScalar(unicodes.first!.value)!)
-
- }
-
- static func convertFromIntegerLiteral(value: IntegerLiteralType) -> Character {
- return Character(UnicodeScalar(value)!)
- }
-
- static func isLetter(_ char: Character) -> Bool {
- return char.isLetter()
- }
- func isLetter() -> Bool {
- return self.isMemberOfCharacterSet(CharacterSet.letters)
- }
-
- static func isLetterOrDigit(_ char: Character) -> Bool {
- return char.isLetterOrDigit()
- }
- func isLetterOrDigit() -> Bool {
- if(self.isLetter()) {return true}
- return self.isDigit
- }
-}
diff --git a/Pods/SwiftSoup/Sources/CharacterReader.swift b/Pods/SwiftSoup/Sources/CharacterReader.swift
deleted file mode 100644
index ff81a80..0000000
--- a/Pods/SwiftSoup/Sources/CharacterReader.swift
+++ /dev/null
@@ -1,463 +0,0 @@
-//
-// CharacterReader.swift
-// SwiftSoup
-//
-// Created by Nabil Chatbi on 10/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- CharacterReader consumes tokens off a string. To replace the old TokenQueue.
- */
-public final class CharacterReader {
- private static let empty = ""
- public static let EOF: UnicodeScalar = "\u{FFFF}"//65535
- private let input: [UnicodeScalar]
- private let length: Int
- private var pos: Int = 0
- private var mark: Int = 0
- //private let stringCache: Array // holds reused strings in this doc, to lessen garbage
-
- public init(_ input: String) {
- self.input = Array(input.unicodeScalars)
- self.length = self.input.count
- //stringCache = Array(repeating:nil, count:512)
- }
-
- public func getPos() -> Int {
- return self.pos
- }
-
- public func isEmpty() -> Bool {
- return pos >= length
- }
-
- public func current() -> UnicodeScalar {
- return (pos >= length) ? CharacterReader.EOF : input[pos]
- }
-
- @discardableResult
- public func consume() -> UnicodeScalar {
- let val = (pos >= length) ? CharacterReader.EOF : input[pos]
- pos += 1
- return val
- }
-
- public func unconsume() {
- pos -= 1
- }
-
- public func advance() {
- pos += 1
- }
-
- public func markPos() {
- mark = pos
- }
-
- public func rewindToMark() {
- pos = mark
- }
-
- public func consumeAsString() -> String {
- let p = pos
- pos+=1
- return String(input[p])
- //return String(input, pos+=1, 1)
- }
-
- /**
- * Returns the number of characters between the current position and the next instance of the input char
- * @param c scan target
- * @return offset between current position and next instance of target. -1 if not found.
- */
- public func nextIndexOf(_ c: UnicodeScalar) -> Int {
- // doesn't handle scanning for surrogates
- for i in pos.. Int {
- // doesn't handle scanning for surrogates
- if(seq.isEmpty) {return -1}
- let startChar: UnicodeScalar = seq.unicodeScalar(0)
- for var offset in pos.. String {
- let offset = nextIndexOf(c)
- if (offset != -1) {
- let consumed = cacheString(pos, offset)
- pos += offset
- return consumed
- } else {
- return consumeToEnd()
- }
- }
-
- public func consumeTo(_ seq: String) -> String {
- let offset = nextIndexOf(seq)
- if (offset != -1) {
- let consumed = cacheString(pos, offset)
- pos += offset
- return consumed
- } else {
- return consumeToEnd()
- }
- }
-
- public func consumeToAny(_ chars: UnicodeScalar...) -> String {
- return consumeToAny(chars)
- }
- public func consumeToAny(_ chars: [UnicodeScalar]) -> String {
- let start: Int = pos
- let remaining: Int = length
- let val = input
- OUTER: while (pos < remaining) {
- if chars.contains(val[pos]) {
- break OUTER
- }
-// for c in chars {
-// if (val[pos] == c){
-// break OUTER
-// }
-// }
- pos += 1
- }
-
- return pos > start ? cacheString(start, pos-start) : CharacterReader.empty
- }
-
- public func consumeToAnySorted(_ chars: UnicodeScalar...) -> String {
- return consumeToAnySorted(chars)
- }
- public func consumeToAnySorted(_ chars: [UnicodeScalar]) -> String {
- let start = pos
- let remaining = length
- let val = input
-
- while (pos < remaining) {
-
- if chars.contains(val[pos]) {
- break
- }
- pos += 1
- }
-
- return pos > start ? cacheString(start, pos-start) : CharacterReader.empty
- }
-
- public func consumeData() -> String {
- // &, <, null
- let start = pos
- let remaining = length
- let val = input
-
- while (pos < remaining) {
- let c: UnicodeScalar = val[pos]
- if (c == UnicodeScalar.Ampersand || c == UnicodeScalar.LessThan || c == TokeniserStateVars.nullScalr) {
- break
- }
- pos += 1
- }
-
- return pos > start ? cacheString(start, pos-start) : CharacterReader.empty
- }
-
- public func consumeTagName() -> String {
- // '\t', '\n', '\r', '\f', ' ', '/', '>', nullChar
- let start = pos
- let remaining = length
- let val = input
-
- while (pos < remaining) {
- let c: UnicodeScalar = val[pos]
- if (c == UnicodeScalar.BackslashT || c == UnicodeScalar.BackslashN || c == UnicodeScalar.BackslashR || c == UnicodeScalar.BackslashF || c == UnicodeScalar.Space || c == UnicodeScalar.Slash || c == UnicodeScalar.GreaterThan || c == TokeniserStateVars.nullScalr) {
- break
- }
- pos += 1
- }
- return pos > start ? cacheString(start, pos-start) : CharacterReader.empty
- }
-
- public func consumeToEnd() -> String {
- let data = cacheString(pos, length-pos)
- pos = length
- return data
- }
-
- public func consumeLetterSequence() -> String {
- let start = pos
- while (pos < length) {
- let c: UnicodeScalar = input[pos]
- if ((c >= "A" && c <= "Z") || (c >= "a" && c <= "z") || c.isMemberOfCharacterSet(CharacterSet.letters)) {
- pos += 1
- } else {
- break
- }
- }
- return cacheString(start, pos - start)
- }
-
- public func consumeLetterThenDigitSequence() -> String {
- let start = pos
- while (pos < length) {
- let c = input[pos]
- if ((c >= "A" && c <= "Z") || (c >= "a" && c <= "z") || c.isMemberOfCharacterSet(CharacterSet.letters)) {
- pos += 1
- } else {
- break
- }
- }
- while (!isEmpty()) {
- let c = input[pos]
- if (c >= "0" && c <= "9") {
- pos += 1
- } else {
- break
- }
- }
-
- return cacheString(start, pos - start)
- }
-
- public func consumeHexSequence() -> String {
- let start = pos
- while (pos < length) {
- let c = input[pos]
- if ((c >= "0" && c <= "9") || (c >= "A" && c <= "F") || (c >= "a" && c <= "f")) {
- pos+=1
- } else {
- break
- }
- }
- return cacheString(start, pos - start)
- }
-
- public func consumeDigitSequence() -> String {
- let start = pos
- while (pos < length) {
- let c = input[pos]
- if (c >= "0" && c <= "9") {
- pos+=1
- } else {
- break
- }
- }
- return cacheString(start, pos - start)
- }
-
- public func matches(_ c: UnicodeScalar) -> Bool {
- return !isEmpty() && input[pos] == c
-
- }
-
- public func matches(_ seq: String) -> Bool {
- let scanLength = seq.unicodeScalars.count
- if (scanLength > length - pos) {
- return false
- }
-
- for offset in 0.. Bool {
-
- let scanLength = seq.unicodeScalars.count
- if(scanLength == 0) {
- return false
- }
- if (scanLength > length - pos) {
- return false
- }
-
- for offset in 0.. Bool {
- if (isEmpty()) {
- return false
- }
-
- let c: UnicodeScalar = input[pos]
- for seek in seq {
- if (seek == c) {
- return true
- }
- }
- return false
- }
-
- public func matchesAnySorted(_ seq: [UnicodeScalar]) -> Bool {
- return !isEmpty() && seq.contains(input[pos])
- }
-
- public func matchesLetter() -> Bool {
- if (isEmpty()) {
- return false
- }
- let c = input[pos]
- return (c >= "A" && c <= "Z") || (c >= "a" && c <= "z") || c.isMemberOfCharacterSet(CharacterSet.letters)
- }
-
- public func matchesDigit() -> Bool {
- if (isEmpty()) {
- return false
- }
- let c = input[pos]
- return (c >= "0" && c <= "9")
- }
-
- @discardableResult
- public func matchConsume(_ seq: String) -> Bool {
- if (matches(seq)) {
- pos += seq.unicodeScalars.count
- return true
- } else {
- return false
- }
- }
-
- @discardableResult
- public func matchConsumeIgnoreCase(_ seq: String) -> Bool {
- if (matchesIgnoreCase(seq)) {
- pos += seq.unicodeScalars.count
- return true
- } else {
- return false
- }
- }
-
- public func containsIgnoreCase(_ seq: String ) -> Bool {
- // used to check presence of , . only finds consistent case.
- let loScan = seq.lowercased(with: Locale(identifier: "en"))
- let hiScan = seq.uppercased(with: Locale(identifier: "eng"))
- return (nextIndexOf(loScan) > -1) || (nextIndexOf(hiScan) > -1)
- }
-
- public func toString() -> String {
- return String(input[pos..
- * Simplistic, and on hash collisions just falls back to creating a new string, vs a full HashMap with Entry list.
- * That saves both having to create objects as hash keys, and running through the entry list, at the expense of
- * some more duplicates.
- */
- private func cacheString(_ start: Int, _ count: Int) -> String {
- return String(input[start.. CharacterReader.maxCacheLen) {
-// return String(val[start.. Bool {
-// if (count == cached.unicodeScalars.count) {
-// var count = count
-// let one = input
-// var i = start
-// var j = 0
-// while (count != 0) {
-// count -= 1
-// if (one[i] != cached.unicodeScalar(j) ) {
-// return false
-// }
-// j += 1
-// i += 1
-// }
-// return true
-// }
-// return false
-// }
-}
-
-extension CharacterReader: CustomDebugStringConvertible {
- public var debugDescription: String {
- return self.toString()
- }
-}
diff --git a/Pods/SwiftSoup/Sources/Cleaner.swift b/Pods/SwiftSoup/Sources/Cleaner.swift
deleted file mode 100644
index 6c16c76..0000000
--- a/Pods/SwiftSoup/Sources/Cleaner.swift
+++ /dev/null
@@ -1,150 +0,0 @@
-//
-// Cleaner.swift
-// SwiftSoup
-//
-// Created by Nabil Chatbi on 15/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-open class Cleaner {
- fileprivate let whitelist: Whitelist
-
- /**
- Create a new cleaner, that sanitizes documents using the supplied whitelist.
- @param whitelist white-list to clean with
- */
- public init(_ whitelist: Whitelist) {
- self.whitelist = whitelist
- }
-
- /**
- Creates a new, clean document, from the original dirty document, containing only elements allowed by the whitelist.
- The original document is not modified. Only elements from the dirt document's body are used.
- @param dirtyDocument Untrusted base document to clean.
- @return cleaned document.
- */
- public func clean(_ dirtyDocument: Document)throws->Document {
- //Validate.notNull(dirtyDocument)
- let clean: Document = Document.createShell(dirtyDocument.getBaseUri())
- if (dirtyDocument.body() != nil && clean.body() != nil) // frameset documents won't have a body. the clean doc will have empty body.
- {
- try copySafeNodes(dirtyDocument.body()!, clean.body()!)
- }
- return clean
- }
-
- /**
- Determines if the input document is valid, against the whitelist. It is considered valid if all the tags and attributes
- in the input HTML are allowed by the whitelist.
-
- This method can be used as a validator for user input forms. An invalid document will still be cleaned successfully
- using the {@link #clean(Document)} document. If using as a validator, it is recommended to still clean the document
- to ensure enforced attributes are set correctly, and that the output is tidied.
-
- @param dirtyDocument document to test
- @return true if no tags or attributes need to be removed; false if they do
- */
- public func isValid(_ dirtyDocument: Document)throws->Bool {
- //Validate.notNull(dirtyDocument)
- let clean: Document = Document.createShell(dirtyDocument.getBaseUri())
- let numDiscarded: Int = try copySafeNodes(dirtyDocument.body()!, clean.body()!)
- return numDiscarded == 0
- }
-
- @discardableResult
- fileprivate func copySafeNodes(_ source: Element, _ dest: Element)throws->Int {
- let cleaningVisitor: Cleaner.CleaningVisitor = Cleaner.CleaningVisitor(source, dest, self)
- let traversor: NodeTraversor = NodeTraversor(cleaningVisitor)
- try traversor.traverse(source)
- return cleaningVisitor.numDiscarded
- }
-
- fileprivate func createSafeElement(_ sourceEl: Element)throws->ElementMeta {
- let sourceTag: String = sourceEl.tagName()
- let destAttrs: Attributes = Attributes()
- let dest: Element = try Element(Tag.valueOf(sourceTag), sourceEl.getBaseUri(), destAttrs)
- var numDiscarded: Int = 0
-
- if let sourceAttrs = sourceEl.getAttributes() {
- for sourceAttr: Attribute in sourceAttrs {
- if (try whitelist.isSafeAttribute(sourceTag, sourceEl, sourceAttr)) {
- destAttrs.put(attribute: sourceAttr)
- } else {
- numDiscarded+=1
- }
- }
- }
- let enforcedAttrs: Attributes = try whitelist.getEnforcedAttributes(sourceTag)
- destAttrs.addAll(incoming: enforcedAttrs)
-
- return ElementMeta(dest, numDiscarded)
- }
-
-}
-
-extension Cleaner {
- fileprivate final class CleaningVisitor: NodeVisitor {
- var numDiscarded: Int = 0
- let root: Element
- var destination: Element? // current element to append nodes to
-
- private var cleaner: Cleaner
-
- public init(_ root: Element, _ destination: Element, _ cleaner: Cleaner) {
- self.root = root
- self.destination = destination
- self.cleaner = cleaner
- }
-
- public func head(_ source: Node, _ depth: Int)throws {
- if let sourceEl = (source as? Element) {
- if (cleaner.whitelist.isSafeTag(sourceEl.tagName())) { // safe, clone and copy safe attrs
- let meta: Cleaner.ElementMeta = try cleaner.createSafeElement(sourceEl)
- let destChild: Element = meta.el
- try destination?.appendChild(destChild)
-
- numDiscarded += meta.numAttribsDiscarded
- destination = destChild
- } else if (source != root) { // not a safe tag, so don't add. don't count root against discarded.
- numDiscarded+=1
- }
- } else if let sourceText = (source as? TextNode) {
- let destText: TextNode = TextNode(sourceText.getWholeText(), source.getBaseUri())
- try destination?.appendChild(destText)
- } else if let sourceData = (source as? DataNode) {
- if sourceData.parent() != nil && cleaner.whitelist.isSafeTag(sourceData.parent()!.nodeName()) {
- //let sourceData: DataNode = (DataNode) source
- let destData: DataNode = DataNode(sourceData.getWholeData(), source.getBaseUri())
- try destination?.appendChild(destData)
- } else {
- numDiscarded+=1
- }
- } else { // else, we don't care about comments, xml proc instructions, etc
- numDiscarded+=1
- }
- }
-
- public func tail(_ source: Node, _ depth: Int)throws {
- if let x = (source as? Element) {
- if cleaner.whitelist.isSafeTag(x.nodeName()) {
- // would have descended, so pop destination stack
- destination = destination?.parent()
- }
- }
- }
- }
-}
-
-extension Cleaner {
- fileprivate struct ElementMeta {
- let el: Element
- let numAttribsDiscarded: Int
-
- init(_ el: Element, _ numAttribsDiscarded: Int) {
- self.el = el
- self.numAttribsDiscarded = numAttribsDiscarded
- }
- }
-}
diff --git a/Pods/SwiftSoup/Sources/Collector.swift b/Pods/SwiftSoup/Sources/Collector.swift
deleted file mode 100644
index 7bb6feb..0000000
--- a/Pods/SwiftSoup/Sources/Collector.swift
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// Collector.swift
-// SwiftSoup
-//
-// Created by Nabil Chatbi on 22/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * Collects a list of elements that match the supplied criteria.
- *
- */
-open class Collector {
-
- private init() {
- }
-
- /**
- Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator.
- @param eval Evaluator to test elements against
- @param root root of tree to descend
- @return list of matches; empty if none
- */
- public static func collect (_ eval: Evaluator, _ root: Element)throws->Elements {
- let elements: Elements = Elements()
- try NodeTraversor(Accumulator(root, elements, eval)).traverse(root)
- return elements
- }
-
-}
-
-private final class Accumulator: NodeVisitor {
- private let root: Element
- private let elements: Elements
- private let eval: Evaluator
-
- init(_ root: Element, _ elements: Elements, _ eval: Evaluator) {
- self.root = root
- self.elements = elements
- self.eval = eval
- }
-
- public func head(_ node: Node, _ depth: Int) {
- guard let el = node as? Element else {
- return
- }
- do {
- if try eval.matches(root, el) {
- elements.add(el)
- }
- } catch {}
- }
-
- public func tail(_ node: Node, _ depth: Int) {
- // void
- }
-}
diff --git a/Pods/SwiftSoup/Sources/CombiningEvaluator.swift b/Pods/SwiftSoup/Sources/CombiningEvaluator.swift
deleted file mode 100644
index fdeb0ae..0000000
--- a/Pods/SwiftSoup/Sources/CombiningEvaluator.swift
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// CombiningEvaluator.swift
-// SwiftSoup
-//
-// Created by Nabil Chatbi on 23/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * Base combining (and, or) evaluator.
- */
-public class CombiningEvaluator: Evaluator {
-
- public private(set) var evaluators: Array
- var num: Int = 0
-
- public override init() {
- evaluators = Array()
- super.init()
- }
-
- public init(_ evaluators: Array) {
- self.evaluators = evaluators
- super.init()
- updateNumEvaluators()
- }
-
- public init(_ evaluators: Evaluator...) {
- self.evaluators = evaluators
- super.init()
- updateNumEvaluators()
- }
-
- func rightMostEvaluator() -> Evaluator? {
- return num > 0 && evaluators.count > 0 ? evaluators[num - 1] : nil
- }
-
- func replaceRightMostEvaluator(_ replacement: Evaluator) {
- evaluators[num - 1] = replacement
- }
-
- func updateNumEvaluators() {
- // used so we don't need to bash on size() for every match test
- num = evaluators.count
- }
-
- public final class And: CombiningEvaluator {
- public override init(_ evaluators: [Evaluator]) {
- super.init(evaluators)
- }
-
- public override init(_ evaluators: Evaluator...) {
- super.init(evaluators)
- }
-
- public override func matches(_ root: Element, _ node: Element) -> Bool {
- for index in 0.. String {
- let array: [String] = evaluators.map { String($0.toString()) }
- return StringUtil.join(array, sep: " ")
- }
- }
-
- public final class Or: CombiningEvaluator {
- /**
- * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR.
- * @param evaluators initial OR clause (these are wrapped into an AND evaluator).
- */
- public override init(_ evaluators: [Evaluator]) {
- super.init()
- if num > 1 {
- self.evaluators.append(And(evaluators))
- } else { // 0 or 1
- self.evaluators.append(contentsOf: evaluators)
- }
- updateNumEvaluators()
- }
-
- override init(_ evaluators: Evaluator...) {
- super.init()
- if num > 1 {
- self.evaluators.append(And(evaluators))
- } else { // 0 or 1
- self.evaluators.append(contentsOf: evaluators)
- }
- updateNumEvaluators()
- }
-
- override init() {
- super.init()
- }
-
- public func add(_ evaluator: Evaluator) {
- evaluators.append(evaluator)
- updateNumEvaluators()
- }
-
- public override func matches(_ root: Element, _ node: Element) -> Bool {
- for index in 0.. String {
- return ":or\(evaluators.map {String($0.toString())})"
- }
- }
-}
diff --git a/Pods/SwiftSoup/Sources/Comment.swift b/Pods/SwiftSoup/Sources/Comment.swift
deleted file mode 100644
index 0892cad..0000000
--- a/Pods/SwiftSoup/Sources/Comment.swift
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Comment.swift
-// SwiftSoup
-//
-// Created by Nabil Chatbi on 22/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- A comment node.
- */
-public class Comment: Node {
- private static let COMMENT_KEY: String = "comment"
-
- /**
- Create a new comment node.
- @param data The contents of the comment
- @param baseUri base URI
- */
- public init(_ data: String, _ baseUri: String) {
- super.init(baseUri)
- do {
- try attributes?.put(Comment.COMMENT_KEY, data)
- } catch {}
- }
-
- public override func nodeName() -> String {
- return "#comment"
- }
-
- /**
- Get the contents of the comment.
- @return comment content
- */
- public func getData() -> String {
- return attributes!.get(key: Comment.COMMENT_KEY)
- }
-
- override func outerHtmlHead(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings) {
- if (out.prettyPrint()) {
- indent(accum, depth, out)
- }
- accum
- .append("")
- }
-
- override func outerHtmlTail(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings) {}
-
- public override func copy(with zone: NSZone? = nil) -> Any {
- let clone = Comment(attributes!.get(key: Comment.COMMENT_KEY), baseUri!)
- return copy(clone: clone)
- }
-
- public override func copy(parent: Node?) -> Node {
- let clone = Comment(attributes!.get(key: Comment.COMMENT_KEY), baseUri!)
- return copy(clone: clone, parent: parent)
- }
-
- public override func copy(clone: Node, parent: Node?) -> Node {
- return super.copy(clone: clone, parent: parent)
- }
-}
diff --git a/Pods/SwiftSoup/Sources/Connection.swift b/Pods/SwiftSoup/Sources/Connection.swift
deleted file mode 100644
index 7b309a5..0000000
--- a/Pods/SwiftSoup/Sources/Connection.swift
+++ /dev/null
@@ -1,10 +0,0 @@
-//
-// Connection.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-//TODO:
diff --git a/Pods/SwiftSoup/Sources/DataNode.swift b/Pods/SwiftSoup/Sources/DataNode.swift
deleted file mode 100644
index 37f7199..0000000
--- a/Pods/SwiftSoup/Sources/DataNode.swift
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// DataNode.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- A data node, for contents of style, script tags etc, where contents should not show in text().
- */
-open class DataNode: Node {
- private static let DATA_KEY: String = "data"
-
- /**
- Create a new DataNode.
- @param data data contents
- @param baseUri base URI
- */
- public init(_ data: String, _ baseUri: String) {
- super.init(baseUri)
- do {
- try attributes?.put(DataNode.DATA_KEY, data)
- } catch {}
-
- }
-
- open override func nodeName() -> String {
- return "#data"
- }
-
- /**
- Get the data contents of this node. Will be unescaped and with original new lines, space etc.
- @return data
- */
- open func getWholeData() -> String {
- return attributes!.get(key: DataNode.DATA_KEY)
- }
-
- /**
- * Set the data contents of this node.
- * @param data unencoded data
- * @return this node, for chaining
- */
- @discardableResult
- open func setWholeData(_ data: String) -> DataNode {
- do {
- try attributes?.put(DataNode.DATA_KEY, data)
- } catch {}
- return self
- }
-
- override func outerHtmlHead(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings)throws {
- accum.append(getWholeData()) // data is not escaped in return from data nodes, so " in script, style is plain
- }
-
- override func outerHtmlTail(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings) {}
-
- /**
- Create a new DataNode from HTML encoded data.
- @param encodedData encoded data
- @param baseUri bass URI
- @return new DataNode
- */
- public static func createFromEncoded(_ encodedData: String, _ baseUri: String)throws->DataNode {
- let data = try Entities.unescape(encodedData)
- return DataNode(data, baseUri)
- }
-
- public override func copy(with zone: NSZone? = nil) -> Any {
- let clone = DataNode(attributes!.get(key: DataNode.DATA_KEY), baseUri!)
- return copy(clone: clone)
- }
-
- public override func copy(parent: Node?) -> Node {
- let clone = DataNode(attributes!.get(key: DataNode.DATA_KEY), baseUri!)
- return copy(clone: clone, parent: parent)
- }
-
- public override func copy(clone: Node, parent: Node?) -> Node {
- return super.copy(clone: clone, parent: parent)
- }
-}
diff --git a/Pods/SwiftSoup/Sources/DataUtil.swift b/Pods/SwiftSoup/Sources/DataUtil.swift
deleted file mode 100644
index f2d0dee..0000000
--- a/Pods/SwiftSoup/Sources/DataUtil.swift
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// DataUtil.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 02/10/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * Internal static utilities for handling data.
- *
- */
-class DataUtil {
-
- static let charsetPattern = "(?i)\\bcharset=\\s*(?:\"|')?([^\\s,;\"']*)"
- static let defaultCharset = "UTF-8" // used if not found in header or meta charset
- static let bufferSize = 0x20000 // ~130K.
- static let UNICODE_BOM = 0xFEFF
- static let mimeBoundaryChars = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- static let boundaryLength = 32
-
-}
diff --git a/Pods/SwiftSoup/Sources/Document.swift b/Pods/SwiftSoup/Sources/Document.swift
deleted file mode 100644
index a47a867..0000000
--- a/Pods/SwiftSoup/Sources/Document.swift
+++ /dev/null
@@ -1,562 +0,0 @@
-//
-// Document.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-open class Document: Element {
- public enum QuirksMode {
- case noQuirks, quirks, limitedQuirks
- }
-
- private var _outputSettings: OutputSettings = OutputSettings()
- private var _quirksMode: Document.QuirksMode = QuirksMode.noQuirks
- private let _location: String
- private var updateMetaCharset: Bool = false
-
- /**
- Create a new, empty Document.
- @param baseUri base URI of document
- @see org.jsoup.Jsoup#parse
- @see #createShell
- */
- public init(_ baseUri: String) {
- self._location = baseUri
- super.init(try! Tag.valueOf("#root", ParseSettings.htmlDefault), baseUri)
- }
-
- /**
- Create a valid, empty shell of a document, suitable for adding more elements to.
- @param baseUri baseUri of document
- @return document with html, head, and body elements.
- */
- static public func createShell(_ baseUri: String) -> Document {
- let doc: Document = Document(baseUri)
- let html: Element = try! doc.appendElement("html")
- try! html.appendElement("head")
- try! html.appendElement("body")
-
- return doc
- }
-
- /**
- * Get the URL this Document was parsed from. If the starting URL is a redirect,
- * this will return the final URL from which the document was served from.
- * @return location
- */
- public func location() -> String {
- return _location
- }
-
- /**
- Accessor to the document's {@code head} element.
- @return {@code head}
- */
- public func head() -> Element? {
- return findFirstElementByTagName("head", self)
- }
-
- /**
- Accessor to the document's {@code body} element.
- @return {@code body}
- */
- public func body() -> Element? {
- return findFirstElementByTagName("body", self)
- }
-
- /**
- Get the string contents of the document's {@code title} element.
- @return Trimmed title, or empty string if none set.
- */
- public func title()throws->String {
- // title is a preserve whitespace tag (for document output), but normalised here
- let titleEl: Element? = try getElementsByTag("title").first()
- return titleEl != nil ? try StringUtil.normaliseWhitespace(titleEl!.text()).trim() : ""
- }
-
- /**
- Set the document's {@code title} element. Updates the existing element, or adds {@code title} to {@code head} if
- not present
- @param title string to set as title
- */
- public func title(_ title: String)throws {
- let titleEl: Element? = try getElementsByTag("title").first()
- if (titleEl == nil) { // add to head
- try head()?.appendElement("title").text(title)
- } else {
- try titleEl?.text(title)
- }
- }
-
- /**
- Create a new Element, with this document's base uri. Does not make the new element a child of this document.
- @param tagName element tag name (e.g. {@code a})
- @return new element
- */
- public func createElement(_ tagName: String)throws->Element {
- return try Element(Tag.valueOf(tagName, ParseSettings.preserveCase), self.getBaseUri())
- }
-
- /**
- Normalise the document. This happens after the parse phase so generally does not need to be called.
- Moves any text content that is not in the body element into the body.
- @return this document after normalisation
- */
- @discardableResult
- public func normalise()throws->Document {
- var htmlE: Element? = findFirstElementByTagName("html", self)
- if (htmlE == nil) {
- htmlE = try appendElement("html")
- }
- let htmlEl: Element = htmlE!
-
- if (head() == nil) {
- try htmlEl.prependElement("head")
- }
- if (body() == nil) {
- try htmlEl.appendElement("body")
- }
-
- // pull text nodes out of root, html, and head els, and push into body. non-text nodes are already taken care
- // of. do in inverse order to maintain text order.
- try normaliseTextNodes(head()!)
- try normaliseTextNodes(htmlEl)
- try normaliseTextNodes(self)
-
- try normaliseStructure("head", htmlEl)
- try normaliseStructure("body", htmlEl)
-
- try ensureMetaCharsetElement()
-
- return self
- }
-
- // does not recurse.
- private func normaliseTextNodes(_ element: Element)throws {
- var toMove: Array = Array()
- for node: Node in element.childNodes {
- if let tn = (node as? TextNode) {
- if (!tn.isBlank()) {
- toMove.append(tn)
- }
- }
- }
-
- for i in (0.. or contents into one, delete the remainder, and ensure they are owned by
- private func normaliseStructure(_ tag: String, _ htmlEl: Element)throws {
- let elements: Elements = try self.getElementsByTag(tag)
- let master: Element? = elements.first() // will always be available as created above if not existent
- if (elements.size() > 1) { // dupes, move contents to master
- var toMove: Array = Array()
- for i in 1..
- if (!(master != nil && master!.parent() != nil && master!.parent()!.equals(htmlEl))) {
- try htmlEl.appendChild(master!) // includes remove()
- }
- }
-
- // fast method to get first by tag name, used for html, head, body finders
- private func findFirstElementByTagName(_ tag: String, _ node: Node) -> Element? {
- if (node.nodeName()==tag) {
- return node as? Element
- } else {
- for child: Node in node.childNodes {
- let found: Element? = findFirstElementByTagName(tag, child)
- if (found != nil) {
- return found
- }
- }
- }
- return nil
- }
-
- open override func outerHtml()throws->String {
- return try super.html() // no outer wrapper tag
- }
-
- /**
- Set the text of the {@code body} of this document. Any existing nodes within the body will be cleared.
- @param text unencoded text
- @return this document
- */
- @discardableResult
- public override func text(_ text: String)throws->Element {
- try body()?.text(text) // overridden to not nuke doc structure
- return self
- }
-
- open override func nodeName() -> String {
- return "#document"
- }
-
- /**
- * Sets the charset used in this document. This method is equivalent
- * to {@link OutputSettings#charset(java.nio.charset.Charset)
- * OutputSettings.charset(Charset)} but in addition it updates the
- * charset / encoding element within the document.
- *
- * This enables
- * {@link #updateMetaCharsetElement(boolean) meta charset update}.
- *
- * If there's no element with charset / encoding information yet it will
- * be created. Obsolete charset / encoding definitions are removed!
- *
- * Elements used:
- *
- *
- * - Html: <meta charset="CHARSET">
- * - Xml: <?xml version="1.0" encoding="CHARSET">
- *
- *
- * @param charset Charset
- *
- * @see #updateMetaCharsetElement(boolean)
- * @see OutputSettings#charset(java.nio.charset.Charset)
- */
- public func charset(_ charset: String.Encoding)throws {
- updateMetaCharsetElement(true)
- _outputSettings.charset(charset)
- try ensureMetaCharsetElement()
- }
-
- /**
- * Returns the charset used in this document. This method is equivalent
- * to {@link OutputSettings#charset()}.
- *
- * @return Current Charset
- *
- * @see OutputSettings#charset()
- */
- public func charset()->String.Encoding {
- return _outputSettings.charset()
- }
-
- /**
- * Sets whether the element with charset information in this document is
- * updated on changes through {@link #charset(java.nio.charset.Charset)
- * Document.charset(Charset)} or not.
- *
- * If set to false (default) there are no elements
- * modified.
- *
- * @param update If true the element updated on charset
- * changes, false if not
- *
- * @see #charset(java.nio.charset.Charset)
- */
- public func updateMetaCharsetElement(_ update: Bool) {
- self.updateMetaCharset = update
- }
-
- /**
- * Returns whether the element with charset information in this document is
- * updated on changes through {@link #charset(java.nio.charset.Charset)
- * Document.charset(Charset)} or not.
- *
- * @return Returns true if the element is updated on charset
- * changes, false if not
- */
- public func updateMetaCharsetElement() -> Bool {
- return updateMetaCharset
- }
-
- /**
- * Ensures a meta charset (html) or xml declaration (xml) with the current
- * encoding used. This only applies with
- * {@link #updateMetaCharsetElement(boolean) updateMetaCharset} set to
- * true, otherwise this method does nothing.
- *
- *
- * - An exsiting element gets updated with the current charset
- * - If there's no element yet it will be inserted
- * - Obsolete elements are removed
- *
- *
- * Elements used:
- *
- *
- * - Html: <meta charset="CHARSET">
- * - Xml: <?xml version="1.0" encoding="CHARSET">
- *
- */
- private func ensureMetaCharsetElement()throws {
- if (updateMetaCharset) {
- let syntax: OutputSettings.Syntax = outputSettings().syntax()
-
- if (syntax == OutputSettings.Syntax.html) {
- let metaCharset: Element? = try select("meta[charset]").first()
-
- if (metaCharset != nil) {
- try metaCharset?.attr("charset", charset().displayName())
- } else {
- let head: Element? = self.head()
-
- if (head != nil) {
- try head?.appendElement("meta").attr("charset", charset().displayName())
- }
- }
-
- // Remove obsolete elements
- let s = try select("meta[name=charset]")
- try s.remove()
-
- } else if (syntax == OutputSettings.Syntax.xml) {
- let node: Node = getChildNodes()[0]
-
- if let decl = (node as? XmlDeclaration) {
-
- if (decl.name()=="xml") {
- try decl.attr("encoding", charset().displayName())
-
- _ = try decl.attr("version")
- try decl.attr("version", "1.0")
- } else {
- try Validate.notNull(obj: baseUri)
- let decl = XmlDeclaration("xml", baseUri!, false)
- try decl.attr("version", "1.0")
- try decl.attr("encoding", charset().displayName())
-
- try prependChild(decl)
- }
- } else {
- try Validate.notNull(obj: baseUri)
- let decl = XmlDeclaration("xml", baseUri!, false)
- try decl.attr("version", "1.0")
- try decl.attr("encoding", charset().displayName())
-
- try prependChild(decl)
- }
- }
- }
- }
-
- /**
- * Get the document's current output settings.
- * @return the document's current output settings.
- */
- public func outputSettings() -> OutputSettings {
- return _outputSettings
- }
-
- /**
- * Set the document's output settings.
- * @param outputSettings new output settings.
- * @return this document, for chaining.
- */
- @discardableResult
- public func outputSettings(_ outputSettings: OutputSettings) -> Document {
- self._outputSettings = outputSettings
- return self
- }
-
- public func quirksMode()->Document.QuirksMode {
- return _quirksMode
- }
-
- @discardableResult
- public func quirksMode(_ quirksMode: Document.QuirksMode) -> Document {
- self._quirksMode = quirksMode
- return self
- }
-
- public override func copy(with zone: NSZone? = nil) -> Any {
- let clone = Document(_location)
- return copy(clone: clone)
- }
-
- public override func copy(parent: Node?) -> Node {
- let clone = Document(_location)
- return copy(clone: clone, parent: parent)
- }
-
- public override func copy(clone: Node, parent: Node?) -> Node {
- let clone = clone as! Document
- clone._outputSettings = _outputSettings.copy() as! OutputSettings
- clone._quirksMode = _quirksMode
- clone.updateMetaCharset = updateMetaCharset
- return super.copy(clone: clone, parent: parent)
- }
-
-}
-
-public class OutputSettings: NSCopying {
- /**
- * The output serialization syntax.
- */
- public enum Syntax {case html, xml}
-
- private var _escapeMode: Entities.EscapeMode = Entities.EscapeMode.base
- private var _encoder: String.Encoding = String.Encoding.utf8 // Charset.forName("UTF-8")
- private var _prettyPrint: Bool = true
- private var _outline: Bool = false
- private var _indentAmount: UInt = 1
- private var _syntax = Syntax.html
-
- public init() {}
-
- /**
- * Get the document's current HTML escape mode: base , which provides a limited set of named HTML
- * entities and escapes other characters as numbered entities for maximum compatibility; or extended ,
- * which uses the complete set of HTML named entities.
- *
- * The default escape mode is base .
- * @return the document's current escape mode
- */
- public func escapeMode() -> Entities.EscapeMode {
- return _escapeMode
- }
-
- /**
- * Set the document's escape mode, which determines how characters are escaped when the output character set
- * does not support a given character:- using either a named or a numbered escape.
- * @param escapeMode the new escape mode to use
- * @return the document's output settings, for chaining
- */
- @discardableResult
- public func escapeMode(_ escapeMode: Entities.EscapeMode) -> OutputSettings {
- self._escapeMode = escapeMode
- return self
- }
-
- /**
- * Get the document's current output charset, which is used to control which characters are escaped when
- * generating HTML (via the html() methods), and which are kept intact.
- *
- * Where possible (when parsing from a URL or File), the document's output charset is automatically set to the
- * input charset. Otherwise, it defaults to UTF-8.
- * @return the document's current charset.
- */
- public func encoder() -> String.Encoding {
- return _encoder
- }
- public func charset() -> String.Encoding {
- return _encoder
- }
-
- /**
- * Update the document's output charset.
- * @param charset the new charset to use.
- * @return the document's output settings, for chaining
- */
- @discardableResult
- public func encoder(_ encoder: String.Encoding) -> OutputSettings {
- self._encoder = encoder
- return self
- }
-
- @discardableResult
- public func charset(_ e: String.Encoding) -> OutputSettings {
- return encoder(e)
- }
-
- /**
- * Get the document's current output syntax.
- * @return current syntax
- */
- public func syntax() -> Syntax {
- return _syntax
- }
-
- /**
- * Set the document's output syntax. Either {@code html}, with empty tags and boolean attributes (etc), or
- * {@code xml}, with self-closing tags.
- * @param syntax serialization syntax
- * @return the document's output settings, for chaining
- */
- @discardableResult
- public func syntax(syntax: Syntax) -> OutputSettings {
- _syntax = syntax
- return self
- }
-
- /**
- * Get if pretty printing is enabled. Default is true. If disabled, the HTML output methods will not re-format
- * the output, and the output will generally look like the input.
- * @return if pretty printing is enabled.
- */
- public func prettyPrint() -> Bool {
- return _prettyPrint
- }
-
- /**
- * Enable or disable pretty printing.
- * @param pretty new pretty print setting
- * @return this, for chaining
- */
- @discardableResult
- public func prettyPrint(pretty: Bool) -> OutputSettings {
- _prettyPrint = pretty
- return self
- }
-
- /**
- * Get if outline mode is enabled. Default is false. If enabled, the HTML output methods will consider
- * all tags as block.
- * @return if outline mode is enabled.
- */
- public func outline() -> Bool {
- return _outline
- }
-
- /**
- * Enable or disable HTML outline mode.
- * @param outlineMode new outline setting
- * @return this, for chaining
- */
- @discardableResult
- public func outline(outlineMode: Bool) -> OutputSettings {
- _outline = outlineMode
- return self
- }
-
- /**
- * Get the current tag indent amount, used when pretty printing.
- * @return the current indent amount
- */
- public func indentAmount() -> UInt {
- return _indentAmount
- }
-
- /**
- * Set the indent amount for pretty printing
- * @param indentAmount number of spaces to use for indenting each level. Must be {@literal >=} 0.
- * @return this, for chaining
- */
- @discardableResult
- public func indentAmount(indentAmount: UInt) -> OutputSettings {
- _indentAmount = indentAmount
- return self
- }
-
- public func copy(with zone: NSZone? = nil) -> Any {
- let clone: OutputSettings = OutputSettings()
- clone.charset(_encoder) // new charset and charset encoder
- clone._escapeMode = _escapeMode//Entities.EscapeMode.valueOf(escapeMode.name())
- // indentAmount, prettyPrint are primitives so object.clone() will handle
- return clone
- }
-
-}
diff --git a/Pods/SwiftSoup/Sources/DocumentType.swift b/Pods/SwiftSoup/Sources/DocumentType.swift
deleted file mode 100644
index 95f9b10..0000000
--- a/Pods/SwiftSoup/Sources/DocumentType.swift
+++ /dev/null
@@ -1,129 +0,0 @@
-//
-// DocumentType.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-/**
- * A {@code } node.
- */
-public class DocumentType: Node {
- static let PUBLIC_KEY: String = "PUBLIC"
- static let SYSTEM_KEY: String = "SYSTEM"
- private static let NAME: String = "name"
- private static let PUB_SYS_KEY: String = "pubSysKey"; // PUBLIC or SYSTEM
- private static let PUBLIC_ID: String = "publicId"
- private static let SYSTEM_ID: String = "systemId"
- // todo: quirk mode from publicId and systemId
-
- /**
- * Create a new doctype element.
- * @param name the doctype's name
- * @param publicId the doctype's public ID
- * @param systemId the doctype's system ID
- * @param baseUri the doctype's base URI
- */
- public init(_ name: String, _ publicId: String, _ systemId: String, _ baseUri: String) {
- super.init(baseUri)
- do {
- try attr(DocumentType.NAME, name)
- try attr(DocumentType.PUBLIC_ID, publicId)
- if (has(DocumentType.PUBLIC_ID)) {
- try attr(DocumentType.PUB_SYS_KEY, DocumentType.PUBLIC_KEY)
- }
- try attr(DocumentType.SYSTEM_ID, systemId)
- } catch {}
- }
-
- /**
- * Create a new doctype element.
- * @param name the doctype's name
- * @param publicId the doctype's public ID
- * @param systemId the doctype's system ID
- * @param baseUri the doctype's base URI
- */
- public init(_ name: String, _ pubSysKey: String?, _ publicId: String, _ systemId: String, _ baseUri: String) {
- super.init(baseUri)
- do {
- try attr(DocumentType.NAME, name)
- if(pubSysKey != nil) {
- try attr(DocumentType.PUB_SYS_KEY, pubSysKey!)
- }
- try attr(DocumentType.PUBLIC_ID, publicId)
- try attr(DocumentType.SYSTEM_ID, systemId)
- } catch {}
- }
-
- public override func nodeName() -> String {
- return "#doctype"
- }
-
- override func outerHtmlHead(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings) {
- if (out.syntax() == OutputSettings.Syntax.html && !has(DocumentType.PUBLIC_ID) && !has(DocumentType.SYSTEM_ID)) {
- // looks like a html5 doctype, go lowercase for aesthetics
- accum.append("")
- }
-
- override func outerHtmlTail(_ accum: StringBuilder, _ depth: Int, _ out: OutputSettings) {
- }
-
- private func has(_ attribute: String) -> Bool {
- do {
- return !StringUtil.isBlank(try attr(attribute))
- } catch {return false}
- }
-
- public override func copy(with zone: NSZone? = nil) -> Any {
- let clone = DocumentType(attributes!.get(key: DocumentType.NAME),
- attributes!.get(key: DocumentType.PUBLIC_ID),
- attributes!.get(key: DocumentType.SYSTEM_ID),
- baseUri!)
- return copy(clone: clone)
- }
-
- public override func copy(parent: Node?) -> Node {
- let clone = DocumentType(attributes!.get(key: DocumentType.NAME),
- attributes!.get(key: DocumentType.PUBLIC_ID),
- attributes!.get(key: DocumentType.SYSTEM_ID),
- baseUri!)
- return copy(clone: clone, parent: parent)
- }
-
- public override func copy(clone: Node, parent: Node?) -> Node {
- return super.copy(clone: clone, parent: parent)
- }
-
-}
diff --git a/Pods/SwiftSoup/Sources/Element.swift b/Pods/SwiftSoup/Sources/Element.swift
deleted file mode 100644
index 4ec5b23..0000000
--- a/Pods/SwiftSoup/Sources/Element.swift
+++ /dev/null
@@ -1,1295 +0,0 @@
-//
-// Element.swift
-// SwifSoup
-//
-// Created by Nabil Chatbi on 29/09/16.
-// Copyright © 2016 Nabil Chatbi.. All rights reserved.
-//
-
-import Foundation
-
-open class Element: Node {
- var _tag: Tag
-
- private static let classString = "class"
- private static let emptyString = ""
- private static let idString = "id"
- private static let rootString = "#root"
-
- //private static let classSplit : Pattern = Pattern("\\s+")
- private static let classSplit = "\\s+"
-
- /**
- * Create a new, standalone Element. (Standalone in that is has no parent.)
- *
- * @param tag tag of this element
- * @param baseUri the base URI
- * @param attributes initial attributes
- * @see #appendChild(Node)
- * @see #appendElement(String)
- */
- public init(_ tag: Tag, _ baseUri: String, _ attributes: Attributes) {
- self._tag = tag
- super.init(baseUri, attributes)
- }
- /**
- * Create a new Element from a tag and a base URI.
- *
- * @param tag element tag
- * @param baseUri the base URI of this element. It is acceptable for the base URI to be an empty
- * string, but not null.
- * @see Tag#valueOf(String, ParseSettings)
- */
- public init(_ tag: Tag, _ baseUri: String) {
- self._tag = tag
- super.init(baseUri, Attributes())
- }
-
- open override func nodeName() -> String {
- return _tag.getName()
- }
- /**
- * Get the name of the tag for this element. E.g. {@code div}
- *
- * @return the tag name
- */
- open func tagName() -> String {
- return _tag.getName()
- }
- open func tagNameNormal() -> String {
- return _tag.getNameNormal()
- }
-
- /**
- * Change the tag of this element. For example, convert a {@code } to a {@code } with
- * {@code el.tagName("div")}.
- *
- * @param tagName new tag name for this element
- * @return this element, for chaining
- */
- @discardableResult
- public func tagName(_ tagName: String)throws->Element {
- try Validate.notEmpty(string: tagName, msg: "Tag name must not be empty.")
- _tag = try Tag.valueOf(tagName, ParseSettings.preserveCase) // preserve the requested tag case
- return self
- }
-
- /**
- * Get the Tag for this element.
- *
- * @return the tag object
- */
- open func tag() -> Tag {
- return _tag
- }
-
- /**
- * Test if this element is a block-level element. (E.g. {@code == true} or an inline element
- * {@code == false}).
- *
- * @return true if block, false if not (and thus inline)
- */
- open func isBlock() -> Bool {
- return _tag.isBlock()
- }
-
- /**
- * Get the {@code id} attribute of this element.
- *
- * @return The id attribute, if present, or an empty string if not.
- */
- open func id() -> String {
- guard let attributes = attributes else {return Element.emptyString}
- do {
- return try attributes.getIgnoreCase(key: Element.idString)
- } catch {}
- return Element.emptyString
- }
-
- /**
- * Set an attribute value on this element. If this element already has an attribute with the
- * key, its value is updated; otherwise, a new attribute is added.
- *
- * @return this element
- */
- @discardableResult
- open override func attr(_ attributeKey: String, _ attributeValue: String)throws->Element {
- try super.attr(attributeKey, attributeValue)
- return self
- }
-
- /**
- * Set a boolean attribute value on this element. Setting to true sets the attribute value to "" and
- * marks the attribute as boolean so no value is written out. Setting to false removes the attribute
- * with the same key if it exists.
- *
- * @param attributeKey the attribute key
- * @param attributeValue the attribute value
- *
- * @return this element
- */
- @discardableResult
- open func attr(_ attributeKey: String, _ attributeValue: Bool)throws->Element {
- try attributes?.put(attributeKey, attributeValue)
- return self
- }
-
- /**
- * Get this element's HTML5 custom data attributes. Each attribute in the element that has a key
- * starting with "data-" is included the dataset.
- *
- * E.g., the element {@code ...} has the dataset
- * {@code package=jsoup, language=java}.
- *
- * This map is a filtered view of the element's attribute map. Changes to one map (add, remove, update) are reflected
- * in the other map.
- *
- * You can find elements that have data attributes using the {@code [^data-]} attribute key prefix selector.
- * @return a map of {@code key=value} custom data attributes.
- */
- open func dataset()->Dictionary {
- return attributes!.dataset()
- }
-
- open override func parent() -> Element? {
- return parentNode as? Element
- }
-
- /**
- * Get this element's parent and ancestors, up to the document root.
- * @return this element's stack of parents, closest first.
- */
- open func parents() -> Elements {
- let parents: Elements = Elements()
- Element.accumulateParents(self, parents)
- return parents
- }
-
- private static func accumulateParents(_ el: Element, _ parents: Elements) {
- let parent: Element? = el.parent()
- if (parent != nil && !(parent!.tagName() == Element.rootString)) {
- parents.add(parent!)
- accumulateParents(parent!, parents)
- }
- }
-
- /**
- * Get a child element of this element, by its 0-based index number.
- *
- * Note that an element can have both mixed Nodes and Elements as children. This method inspects
- * a filtered list of children that are elements, and the index is based on that filtered list.
- *
- *
- * @param index the index number of the element to retrieve
- * @return the child element, if it exists, otherwise throws an {@code IndexOutOfBoundsException}
- * @see #childNode(int)
- */
- open func child(_ index: Int) -> Element {
- return children().get(index)
- }
-
- /**
- * Get this element's child elements.
- *
- * This is effectively a filter on {@link #childNodes()} to get Element nodes.
- *
- * @return child elements. If this element has no children, returns an
- * empty list.
- * @see #childNodes()
- */
- open func children() -> Elements {
- // create on the fly rather than maintaining two lists. if gets slow, memoize, and mark dirty on change
- var elements = Array()
- for node in childNodes {
- if let n = node as? Element {
- elements.append(n)
- }
- }
- return Elements(elements)
- }
-
- /**
- * Get this element's child text nodes. The list is unmodifiable but the text nodes may be manipulated.
- *
- * This is effectively a filter on {@link #childNodes()} to get Text nodes.
- * @return child text nodes. If this element has no text nodes, returns an
- * empty list.
- *
- * For example, with the input HTML: {@code One Two Three Four } with the {@code p} element selected:
- *
- * - {@code p.text()} = {@code "One Two Three Four"}
- * - {@code p.ownText()} = {@code "One Three Four"}
- * - {@code p.children()} = {@code Elements[,
]}
- * - {@code p.childNodes()} = {@code List["One ", , " Three ",
, " Four"]}
- * - {@code p.textNodes()} = {@code List["One ", " Three ", " Four"]}
- *
- */
- open func textNodes()->Array {
- var textNodes = Array()
- for node in childNodes {
- if let n = node as? TextNode {
- textNodes.append(n)
- }
- }
- return textNodes
- }
-
- /**
- * Get this element's child data nodes. The list is unmodifiable but the data nodes may be manipulated.
- *
- * This is effectively a filter on {@link #childNodes()} to get Data nodes.
- *
- * @return child data nodes. If this element has no data nodes, returns an
- * empty list.
- * @see #data()
- */
- open func dataNodes()->Array {
- var dataNodes = Array()
- for node in childNodes {
- if let n = node as? DataNode {
- dataNodes.append(n)
- }
- }
- return dataNodes
- }
-
- /**
- * Find elements that match the {@link Selector} CSS query, with this element as the starting context. Matched elements
- * may include this element, or any of its children.
- *
- * This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because
- * multiple filters can be combined, e.g.:
- *
- *
- * - {@code el.select("a[href]")} - finds links ({@code a} tags with {@code href} attributes)
- *
- {@code el.select("a[href*=example.com]")} - finds links pointing to example.com (loosely)
- *
- *
- * See the query syntax documentation in {@link org.jsoup.select.Selector}.
- *
- *
- * @param cssQuery a {@link Selector} CSS-like query
- * @return elements that match the query (empty if none match)
- * @see org.jsoup.select.Selector
- * @throws Selector.SelectorParseException (unchecked) on an invalid CSS query.
- */
- public func select(_ cssQuery: String)throws->Elements {
- return try Selector.select(cssQuery, self)
- }
-
- /**
- * Check if this element matches the given {@link Selector} CSS query.
- * @param cssQuery a {@link Selector} CSS query
- * @return if this element matches the query
- */
- public func iS(_ cssQuery: String)throws->Bool {
- return try iS(QueryParser.parse(cssQuery))
- }
-
- /**
- * Check if this element matches the given {@link Selector} CSS query.
- * @param cssQuery a {@link Selector} CSS query
- * @return if this element matches the query
- */
- public func iS(_ evaluator: Evaluator)throws->Bool {
- guard let od = self.ownerDocument() else {
- return false
- }
- return try evaluator.matches(od, self)
- }
-
- /**
- * Add a node child node to this element.
- *
- * @param child node to add.
- * @return this element, so that you can add more child nodes or elements.
- */
- @discardableResult
- public func appendChild(_ child: Node)throws->Element {
- // was - Node#addChildren(child). short-circuits an array create and a loop.
- try reparentChild(child)
- ensureChildNodes()
- childNodes.append(child)
- child.setSiblingIndex(childNodes.count - 1)
- return self
- }
-
- /**
- * Add a node to the start of this element's children.
- *
- * @param child node to add.
- * @return this element, so that you can add more child nodes or elements.
- */
- @discardableResult
- public func prependChild(_ child: Node)throws->Element {
- try addChildren(0, child)
- return self
- }
-
- /**
- * Inserts the given child nodes into this element at the specified index. Current nodes will be shifted to the
- * right. The inserted nodes will be moved from their current parent. To prevent moving, copy the nodes first.
- *
- * @param index 0-based index to insert children at. Specify {@code 0} to insert at the start, {@code -1} at the
- * end
- * @param children child nodes to insert
- * @return this element, for chaining.
- */
- @discardableResult
- public func insertChildren(_ index: Int, _ children: Array)throws->Element {
- //Validate.notNull(children, "Children collection to be inserted must not be null.")
- var index = index
- let currentSize: Int = childNodeSize()
- if (index < 0) { index += currentSize + 1} // roll around
- try Validate.isTrue(val: index >= 0 && index <= currentSize, msg: "Insert position out of bounds.")
-
- try addChildren(index, children)
- return self
- }
-
- /**
- * Create a new element by tag name, and add it as the last child.
- *
- * @param tagName the name of the tag (e.g. {@code div}).
- * @return the new element, to allow you to add content to it, e.g.:
- * {@code parent.appendElement("h1").attr("id", "header").text("Welcome")}
- */
- @discardableResult
- public func appendElement(_ tagName: String)throws->Element {
- let child: Element = Element(try Tag.valueOf(tagName), getBaseUri())
- try appendChild(child)
- return child
- }
-
- /**
- * Create a new element by tag name, and add it as the first child.
- *
- * @param tagName the name of the tag (e.g. {@code div}).
- * @return the new element, to allow you to add content to it, e.g.:
- * {@code parent.prependElement("h1").attr("id", "header").text("Welcome")}
- */
- @discardableResult
- public func prependElement(_ tagName: String)throws->Element {
- let child: Element = Element(try Tag.valueOf(tagName), getBaseUri())
- try prependChild(child)
- return child
- }
-
- /**
- * Create and append a new TextNode to this element.
- *
- * @param text the unencoded text to add
- * @return this element
- */
- @discardableResult
- public func appendText(_ text: String)throws->Element {
- let node: TextNode = TextNode(text, getBaseUri())
- try appendChild(node)
- return self
- }
-
- /**
- * Create and prepend a new TextNode to this element.
- *
- * @param text the unencoded text to add
- * @return this element
- */
- @discardableResult
- public func prependText(_ text: String)throws->Element {
- let node: TextNode = TextNode(text, getBaseUri())
- try prependChild(node)
- return self
- }
-
- /**
- * Add inner HTML to this element. The supplied HTML will be parsed, and each node appended to the end of the children.
- * @param html HTML to add inside this element, after the existing HTML
- * @return this element
- * @see #html(String)
- */
- @discardableResult
- public func append(_ html: String)throws->Element {
- let nodes: Array = try Parser.parseFragment(html, self, getBaseUri())
- try addChildren(nodes)
- return self
- }
-
- /**
- * Add inner HTML into this element. The supplied HTML will be parsed, and each node prepended to the start of the element's children.
- * @param html HTML to add inside this element, before the existing HTML
- * @return this element
- * @see #html(String)
- */
- @discardableResult
- public func prepend(_ html: String)throws->Element {
- let nodes: Array = try Parser.parseFragment(html, self, getBaseUri())
- try addChildren(0, nodes)
- return self
- }
-
- /**
- * Insert the specified HTML into the DOM before this element (as a preceding sibling).
- *
- * @param html HTML to add before this element
- * @return this element, for chaining
- * @see #after(String)
- */
- @discardableResult
- open override func before(_ html: String)throws->Element {
- return try super.before(html) as! Element
- }
-
- /**
- * Insert the specified node into the DOM before this node (as a preceding sibling).
- * @param node to add before this element
- * @return this Element, for chaining
- * @see #after(Node)
- */
- @discardableResult
- open override func before(_ node: Node)throws->Element {
- return try super.before(node) as! Element
- }
-
- /**
- * Insert the specified HTML into the DOM after this element (as a following sibling).
- *
- * @param html HTML to add after this element
- * @return this element, for chaining
- * @see #before(String)
- */
- @discardableResult
- open override func after(_ html: String)throws->Element {
- return try super.after(html) as! Element
- }
-
- /**
- * Insert the specified node into the DOM after this node (as a following sibling).
- * @param node to add after this element
- * @return this element, for chaining
- * @see #before(Node)
- */
- open override func after(_ node: Node)throws->Element {
- return try super.after(node) as! Element
- }
-
- /**
- * Remove all of the element's child nodes. Any attributes are left as-is.
- * @return this element
- */
- @discardableResult
- public func empty() -> Element {
- childNodes.removeAll()
- return self
- }
-
- /**
- * Wrap the supplied HTML around this element.
- *
- * @param html HTML to wrap around this element, e.g. {@code }. Can be arbitrarily deep.
- * @return this element, for chaining.
- */
- @discardableResult
- open override func wrap(_ html: String)throws->Element {
- return try super.wrap(html) as! Element
- }
-
- /**
- * Get a CSS selector that will uniquely select this element.
- *
- * If the element has an ID, returns #id;
- * otherwise returns the parent (if any) CSS selector, followed by {@literal '>'},
- * followed by a unique selector for the element (tag.class.class:nth-child(n)).
- *
- *
- * @return the CSS Path that can be used to retrieve the element in a selector.
- */
- public func cssSelector()throws->String {
- let elementId = id()
- if (elementId.count > 0) {
- return "#" + elementId
- }
-
- // Translate HTML namespace ns:tag to CSS namespace syntax ns|tag
- let tagName: String = self.tagName().replacingOccurrences(of: ":", with: "|")
- var selector: String = tagName
- let cl = try classNames()
- let classes: String = cl.joined(separator: ".")
- if (classes.count > 0) {
- selector.append(".")
- selector.append(classes)
- }
-
- if (parent() == nil || ((parent() as? Document) != nil)) // don't add Document to selector, as will always have a html node
- {
- return selector
- }
-
- selector.insert(contentsOf: " > ", at: selector.startIndex)
- if (try parent()!.select(selector).array().count > 1) {
- selector.append(":nth-child(\(try elementSiblingIndex() + 1))")
- }
-
- return try parent()!.cssSelector() + (selector)
- }
-
- /**
- * Get sibling elements. If the element has no sibling elements, returns an empty list. An element is not a sibling
- * of itself, so will not be included in the returned list.
- * @return sibling elements
- */
- public func siblingElements() -> Elements {
- if (parentNode == nil) {return Elements()}
-
- let elements: Array? = parent()?.children().array()
- let siblings: Elements = Elements()
- if let elements = elements {
- for el: Element in elements {
- if (el != self) {
- siblings.add(el)
- }
- }
- }
- return siblings
- }
-
- /**
- * Gets the next sibling element of this element. E.g., if a {@code div} contains two {@code p}s,
- * the {@code nextElementSibling} of the first {@code p} is the second {@code p}.
- *
- * This is similar to {@link #nextSibling()}, but specifically finds only Elements
- *
- * @return the next element, or null if there is no next element
- * @see #previousElementSibling()
- */
- public func nextElementSibling()throws->Element? {
- if (parentNode == nil) {return nil}
- let siblings: Array? = parent()?.children().array()
- let index: Int? = try Element.indexInList(self, siblings)
- try Validate.notNull(obj: index)
- if let siblings = siblings {
- if (siblings.count > index!+1) {
- return siblings[index!+1]
- } else {
- return nil}
- }
- return nil
- }
-
- /**
- * Gets the previous element sibling of this element.
- * @return the previous element, or null if there is no previous element
- * @see #nextElementSibling()
- */
- public func previousElementSibling()throws->Element? {
- if (parentNode == nil) {return nil}
- let siblings: Array? = parent()?.children().array()
- let index: Int? = try Element.indexInList(self, siblings)
- try Validate.notNull(obj: index)
- if (index! > 0) {
- return siblings?[index!-1]
- } else {
- return nil
- }
- }
-
- /**
- * Gets the first element sibling of this element.
- * @return the first sibling that is an element (aka the parent's first element child)
- */
- public func firstElementSibling() -> Element? {
- // todo: should firstSibling() exclude this?
- let siblings: Array? = parent()?.children().array()
- return (siblings != nil && siblings!.count > 1) ? siblings![0] : nil
- }
-
- /*
- * Get the list index of this element in its element sibling list. I.e. if this is the first element
- * sibling, returns 0.
- * @return position in element sibling list
- */
- public func elementSiblingIndex()throws->Int {
- if (parent() == nil) {return 0}
- let x = try Element.indexInList(self, parent()?.children().array())
- return x == nil ? 0 : x!
- }
-
- /**
- * Gets the last element sibling of this element
- * @return the last sibling that is an element (aka the parent's last element child)
- */
- public func lastElementSibling() -> Element? {
- let siblings: Array? = parent()?.children().array()
- return (siblings != nil && siblings!.count > 1) ? siblings![siblings!.count - 1] : nil
- }
-
- private static func indexInList(_ search: Element, _ elements: Array?)throws->Int? {
- try Validate.notNull(obj: elements)
- if let elements = elements {
- for i in 0..Elements {
- try Validate.notEmpty(string: tagName)
- let tagName = tagName.lowercased().trim()
-
- return try Collector.collect(Evaluator.Tag(tagName), self)
- }
-
- /**
- * Find an element by ID, including or under this element.
- *
- * Note that this finds the first matching ID, starting with this element. If you search down from a different
- * starting point, it is possible to find a different element by ID. For unique element by ID within a Document,
- * use {@link Document#getElementById(String)}
- * @param id The ID to search for.
- * @return The first matching element by ID, starting with this element, or null if none found.
- */
- public func getElementById(_ id: String)throws->Element? {
- try Validate.notEmpty(string: id)
-
- let elements: Elements = try Collector.collect(Evaluator.Id(id), self)
- if (elements.array().count > 0) {
- return elements.get(0)
- } else {
- return nil
- }
- }
-
- /**
- * Find elements that have this class, including or under this element. Case insensitive.
- *
- * Elements can have multiple classes (e.g. {@code |