Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

strategy:
matrix:
swift: ["5.1"]
swift: ["5.2"]

container:
image: swift:${{ matrix.swift }}
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.1
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -18,7 +18,7 @@ let package = Package(
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/SwiftDocOrg/swift-cmark.git", from: Version(0, 28, 3, prereleaseIdentifiers: [], buildMetadataIdentifiers: ["20200207", "1168665"])),
.package(name: "cmark", url: "https://github.com/SwiftDocOrg/swift-cmark.git", from: Version(0, 28, 3, prereleaseIdentifiers: [], buildMetadataIdentifiers: ["20200207", "1168665"])),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ $ swift test

## Requirements

- Swift 5.1+
- Swift 5.2+

## Installation

Expand Down
8 changes: 0 additions & 8 deletions Sources/CommonMark/Nodes/Block/BlockQuote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,4 @@ import cmark
*/
public final class BlockQuote: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_BLOCK_QUOTE }

public convenience init(children: [Block & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
5 changes: 0 additions & 5 deletions Sources/CommonMark/Nodes/Block/CodeBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ import cmark
public final class CodeBlock: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_CODE_BLOCK }

public convenience init(literal: String? = nil) {
self.init()
self.literal = literal
}

public convenience init(literal: String, fenceInfo: String? = nil) {
self.init()
self.literal = literal
Expand Down
13 changes: 0 additions & 13 deletions Sources/CommonMark/Nodes/Block/HTMLBlock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,4 @@ import cmark
*/
public final class HTMLBlock: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_HTML_BLOCK }

public convenience init(literal: String? = nil) {
self.init()
self.literal = literal
}

public convenience init(literal: String, children: [Inline & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
17 changes: 8 additions & 9 deletions Sources/CommonMark/Nodes/Block/Heading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ public final class Heading: Node {
self.init(level: level, children: [Text(literal: string)])
}

public convenience init(level: Int, children: [Inline & Node] = []) {
self.init()
self.level = level
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}

public var level: Int {
get {
return numericCast(cmark_node_get_heading_level(cmark_node))
Expand All @@ -62,3 +53,11 @@ public final class Heading: Node {
}
}
}

extension Container where Self: Heading {
public init(level: Int, children: [Self.ChildNode] = []) {
self.init(children: children)
self.level = level
}

}
12 changes: 0 additions & 12 deletions Sources/CommonMark/Nodes/Block/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ public final class List: Node {

public final class Item: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_ITEM }

public convenience init(children: [Inline & Node] = []) {
self.init(children: [Paragraph(children: children)])
}

public convenience init(children: [Block & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}

override class var cmark_node_type: cmark_node_type { return CMARK_NODE_LIST }
Expand Down
8 changes: 0 additions & 8 deletions Sources/CommonMark/Nodes/Block/Paragraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,4 @@ public final class Paragraph: Node {

self.init(children: children)
}

public convenience init(children: [Inline & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
8 changes: 0 additions & 8 deletions Sources/CommonMark/Nodes/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ public final class Document: Node {

self.init(cmark_node)
}

public convenience init(children: [Block & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}

// MARK: - Comparable
Expand Down
5 changes: 0 additions & 5 deletions Sources/CommonMark/Nodes/Inline/Code.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ import cmark
*/
public final class Code: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_CODE }

public convenience init(literal: String? = nil) {
self.init()
self.literal = literal
}
}
8 changes: 0 additions & 8 deletions Sources/CommonMark/Nodes/Inline/Emphasis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,4 @@ public final class Emphasis: Node {
public convenience init(text string: String) {
self.init(children: [Text(literal: string)])
}

public convenience init(children: [Inline & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
11 changes: 5 additions & 6 deletions Sources/CommonMark/Nodes/Inline/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ public final class Link: Node {
public convenience init(urlString: String, title: String? = nil, text string: String) {
self.init(urlString: urlString, title: title, children: [Text(literal: string)])
}
}


public convenience init(urlString: String?, title: String?, children: [Inline & Node] = []) {
self.init()
extension Container where Self: Link {
public init(urlString: String?, title: String?, children: [Self.ChildNode] = []) {
self.init(children: children)
self.urlString = urlString
self.title = title
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
5 changes: 0 additions & 5 deletions Sources/CommonMark/Nodes/Inline/RawHTML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ import cmark
*/
public final class RawHTML: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_HTML_INLINE }

public convenience init(literal: String?) {
self.init()
self.literal = literal
}
}
8 changes: 0 additions & 8 deletions Sources/CommonMark/Nodes/Inline/Strong.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,4 @@ public final class Strong: Node {
public convenience init(text string: String) {
self.init(children: [Text(literal: string)])
}

public convenience init(children: [Inline & Node] = []) {
self.init()
guard !children.isEmpty else { return }
for child in children {
append(child: child)
}
}
}
5 changes: 0 additions & 5 deletions Sources/CommonMark/Nodes/Inline/Text.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ import cmark
*/
public final class Text: Node {
override class var cmark_node_type: cmark_node_type { return CMARK_NODE_TEXT }

public convenience init(literal: String? = nil) {
self.init()
self.literal = literal
}
}
Loading