-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SGML, HTML, Sitemap, RSS, SVG targets (#2)
- New libraries (SwiftSgml, SwiftSitemap, SwiftRss, SwiftSvg) - Unspecified document type is the default - New SVG tags (ellipse, path, polygon, polyline, rect) - New RSS tags - New Sitemap tags
- Loading branch information
Showing
171 changed files
with
775 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Exported.swift | ||
// SwiftHtml | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
@_exported import SwiftSgml |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Channel.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public class Channel: Tag { | ||
public init(@TagBuilder _ builder: () -> [Tag]) { | ||
super.init(Node(type: .standard, name: "channel"), children: builder()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Description.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Description: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "description", contents: "<![CDATA[" + contents + "]]>")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Exported.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
@_exported import SwiftSgml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Guid.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Guid: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "guid", contents: contents)) | ||
} | ||
} | ||
|
||
public extension Guid { | ||
|
||
func isPermalink(_ value: Bool = true) -> Self { | ||
node.upsert(Attribute(key: "isPermalink", value: String(value))) | ||
return self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Item.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
|
||
public class Item: Tag { | ||
public init(@TagBuilder _ builder: () -> [Tag]) { | ||
super.init(Node(type: .standard, name: "item"), children: builder()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Language.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Language: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "language", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// LastBuildDate.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
|
||
public final class LastBuildDate: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "lastBuildDate", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Link.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Link: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "link", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// PubDate.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class PubDate: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "pubDate", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Rss.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
// https://validator.w3.org/feed/docs/rss2.html#ltttlgtSubelementOfLtchannelgt | ||
public final class Rss: Tag { | ||
|
||
public init(@TagBuilder _ builder: () -> [Tag]) { | ||
super.init(Node(type: .standard, name: "rss", attributes: [ | ||
.init(key: "version", value: "2.0"), | ||
// .init(key: "xmlns:atom", value: "http://www.w3.org/2005/Atom"), | ||
]), children: builder()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Title.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Title: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "title", contents: "<![CDATA[" + contents + "]]>")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Ttl.swift | ||
// SwiftRss | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Ttl: Tag { | ||
|
||
public init(_ value: Int) { | ||
super.init(Node(type: .standard, name: "ttl", contents: String(value))) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
Sources/SwiftHtml/Components/Attribute.swift → Sources/SwiftSgml/Attribute.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Attribute.swift | ||
// SwiftHtml | ||
// SwiftSgml | ||
// | ||
// Created by Tibor Bodecs on 2021. 07. 19.. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/SwiftHtml/Components/Node.swift → Sources/SwiftSgml/Node.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Node.swift | ||
// SwiftHtml | ||
// SwiftSgml | ||
// | ||
// Created by Tibor Bodecs on 2021. 07. 19.. | ||
// | ||
|
2 changes: 1 addition & 1 deletion
2
Sources/SwiftHtml/Components/Tag.swift → Sources/SwiftSgml/Tag.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Tag.swift | ||
// SwiftHtml | ||
// SwiftSgml | ||
// | ||
// Created by Tibor Bodecs on 2021. 11. 19.. | ||
// | ||
|
2 changes: 1 addition & 1 deletion
2
...ces/SwiftHtml/Components/TagBuilder.swift → Sources/SwiftSgml/TagBuilder.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// TagBuilder.swift | ||
// SwiftHtml | ||
// SwiftSgml | ||
// | ||
// Created by Tibor Bodecs on 2021. 07. 19.. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Changefreq.swift | ||
// SwiftSitemap | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class ChangeFreq: Tag { | ||
|
||
public enum Value: String { | ||
case always | ||
case hourly | ||
case daily | ||
case weekly | ||
case monthly | ||
case yearly | ||
case never | ||
} | ||
|
||
public init(_ value: Value) { | ||
super.init(Node(type: .standard, name: "changefreq", contents: value.rawValue)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Exported.swift | ||
// SwiftSitemap | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
@_exported import SwiftSgml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// LastMod.swift | ||
// SwiftSitemap | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class LastMod: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "lastmod", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Loc.swift | ||
// SwiftSitemap | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Loc: Tag { | ||
|
||
public init(_ contents: String) { | ||
super.init(Node(type: .standard, name: "loc", contents: contents)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Priority.swift | ||
// SwiftSitemap | ||
// | ||
// Created by Tibor Bodecs on 2021. 12. 19.. | ||
// | ||
|
||
public final class Priority: Tag { | ||
|
||
public init(_ value: Double) { | ||
super.init(Node(type: .standard, name: "priority", contents: String(value))) | ||
} | ||
} |
Oops, something went wrong.