Swiftpack.co - Package - SDGGiesbrecht/SDGWeb

macOS • Linux • iOS • watchOS • tvOS

Documentation

SDGWeb

SDGWeb provides tools for generating websites.

כְּשִׁמְךָ אֱלֹהִים כְּן תְּהלָּתְךָ עַל־קַצְוֵי־אֶרֶץ׃

Like your name, O God, your praise reaches to the ends of the earth.

―sons of קורח/Koraẖ

Features:

  • Sites are constructed from simple templates.
  • Customizable template processing in Swift.
  • Supports localized websites.

Example Usage

let mock = RepositoryStructure(
    root: URL(fileURLWithPath: #file)
        .deletingLastPathComponent()
        .deletingLastPathComponent()
        .appendingPathComponent("Mock Projects/\(mockName)"))

let site = Site<L>(
    repositoryStructure: mock,
    domain: UserFacing<StrictString, L>({ _ in return "http://example.com" }),
    localizationDirectories: UserFacing<StrictString, L>({ localization in return localization.icon ?? StrictString(localization.code) }),
    pageProcessor: Processor(),
    reportProgress: { _ in })

try site.generate().get()
let warnings = site.validate()

Importing

SDGWeb provides libraries for use with the Swift Package Manager.

Simply add SDGWeb as a dependency in Package.swift and specify which of the libraries to use:

let package = Package(
    name: "MyPackage",
    dependencies: [
        .package(url: "https://github.com/SDGGiesbrecht/SDGWeb", from: Version(2, 0, 0)),
    ],
    targets: [
        .target(name: "MyTarget", dependencies: [
            .productItem(name: "SDGWeb", package: "SDGWeb"),
            .productItem(name: "SDGHTML", package: "SDGWeb"),
            .productItem(name: "SDGCSS", package: "SDGWeb"),
        ])
    ]
)

The libraries’ modules can then be imported in source files:

import SDGWeb
import SDGHTML
import SDGCSS

About

The SDGWeb project is maintained by Jeremy David Giesbrecht.

If SDGWeb saves you money, consider giving some of it as a donation.

If SDGWeb saves you time, consider devoting some of it to contributing back to the project.

Ἄξιος γὰρ ὁ ἐργάτης τοῦ μισθοῦ αὐτοῦ ἐστι.

For the worker is worthy of his wages.

―‎ישוע/Yeshuʼa

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Releases

2.0.0 - Aug 16, 2019

Breaking Changes

  • Comments are now handled by the syntax tree, resulting in several new enumeration cases.

New Features

  • Validation is available directly without setting up site generation: Site.validate(site:).

Bug Fixes

  • Miscellaneous improvements to validation results.
  • Redirects have improved HTML style.
  • “>” is now escaped. While not technically necessary, this style makes many source operations more reliable.

1.0.2 - Jul 27, 2019

Bug Fixes

  • Interface‐related components are now localized into German.

1.0.1 - Jul 10, 2019

Bug Fixes

  • Dependency updates.

1.0.0 - Jun 12, 2019

Breaking Changes

  • Modules do not export their dependencies. Each must be imported separately.
    • The @_exported attribute was never officially supported by Swift anyway. As the last remaining thing blocking the 1.0.0 release, it was deemed not important enough to delay until official support. Since it is not strictly necessary for any functionality, it has been removed instead of waiting.

0.1.1 - May 21, 2019

Bug Fixes

  • HTML parsing correctly handles multi‐scalar clusters.
  • Unicode characters are properly accepted in URLs.