Swiftpack.co - Package - SDGGiesbrecht/SDGWeb

macOS • Windows • Web • CentOS • Ubuntu • tvOS • iOS • Android • Amazon Linux • watchOS

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:
    sdgWebRepositoryRoot
    .appendingPathComponent("Tests")
    .appendingPathComponent("Mock Projects")
    .appendingPathComponent(mockName)
)

let site = Site<L, Unfolder>(
  repositoryStructure: mock,
  siteRoot: UserFacing<URL, L>({ _ in return URL(string: "http://example.com")! }),
  localizationDirectories: UserFacing<StrictString, L>({ localization in
    return localization.icon ?? StrictString(localization.code)
  }),
  author: UserFacing<ElementSyntax, L>({ _ in
    return .author("John Doe", language: InterfaceLocalization.englishCanada)
  }),
  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(
      name: "SDGWeb",
      url: "https://github.com/SDGGiesbrecht/SDGWeb",
      from: Version(5, 4, 0)
    ),
  ],
  targets: [
    .target(
      name: "MyTarget",
      dependencies: [
        .product(name: "SDGWeb", package: "SDGWeb"),
        .product(name: "SDGHTML", package: "SDGWeb"),
        .product(name: "SDGCSS", package: "SDGWeb"),
      ]
    )
  ]
)

The 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

Dependencies

Used By

Total: 0

Releases

Version 5.4.0 - 2020-08-15 04:59:36

New Features

  • CentOS and Amazon Linux are now supported.

Version 5.3.1 - 2020-04-29 04:11:59

Bug Fixes

  • Dependencies have been updated.

Version 5.3.0 - 2020-04-09 00:07:12

Breaking Changes

  • Swift 5.2 (Older Swift toolchains will not resolve this version.)

New Features

  • Site generation formats the template files as well as the resulting output (unless disabled).
  • DocumentSyntax conforms to FileConvertible and Equatable.
  • ElementSyntax has a new heading factory.

Version 5.2.0 - 2020-03-27 05:37:04

New Features

  • Web is now supported (as a platform). Actual runtime stability depends on the toolchain used to compile the package.

Version 5.1.2 - 2020-03-06 23:20:10

Bug Fixes

  • Minor internal optimizations.

Version 5.1.1 - 2020-03-06 04:26:55

Bug Fixes

  • Minor internal optimizations.

Version 5.1.0 - 2020-02-18 07:15:39

New Features

  • Windows and Android are supported. Actual runtime stability depends on the toolchain used to compile the package.

Version 5.0.1 - 2020-01-16 00:36:00

Bug Fixes

  • Redirects ignored by the browser display in readable form (without percent encoding).

Version 5.0.0 - 2020-01-14 07:39:36

Breaking Changes

  • Site generation and its API replace many uses of strings with direct use of syntax nodes.
    • Instead of a frame and a string processor, sites now use syntax unfolders. Arbitrary reusable components (including frames) can be implemented using custom unfolders. See the “New Features” section for more information.
    • Metadata is no longer a separate comment. It is now supplied using attributes on the root element. The root element should usually be <page> or something that unfolds into (and through) it.
    • Localization is now a phase of syntax unfolding: <localized><en>English</en><fr>Français</fr></localized>. The old style ([* English */* Français *]) is no longer supported.
  • Redirect has been replaced with a factory method: DocumentSyntax.redirect(language:target:).
  • AttributedSyntax’s class: String? property has been changed to classes: [String].

New Features

  • ElementSyntax has convenient factory methods for constructing common elements.
  • Syntax nodes can be “unfolded”. Custom unfolders can be set up to unfold custom pseudo‐elements into standard HTML. These can be used to create reusable shorthand for more complicated elements. For example, the default unfolder contains a rule that changes <foreign>...</foreign> into <span class="foreign">...</span>.

Bug Fixes

  • The root CSS styles handle more:
    • Paragraphs use book style by default (unspaced, indented, justified and hyphenated).
    • Print media adjusts links:
      • Links are not highlighted.
      • Navigation blocks are removed.
  • Unescaping now handles all entities.

Version 4.0.1 - 2019-12-01 22:23:15

Dependency updates.

Version 4.0.0 - 2019-10-19 05:41:08

Breaking Changes

  • ElementSyntax.name has been changed to nameText, and name now refers to the TokenSyntax instead of the String.

New Features

  • Syntax nodes have more convenience methods and properties.
  • Consistent formatting can be applied to syntax nodes with format().
    • Formatting is applied by default during site generation. It can be disabled by setting the new parameter of generate(formatting:) to false.

Bug Fixes

  • Validation now flags heading levels that are skipped. (Such as having an h5 without an h4.)

Version 3.1.0 - 2019-10-02 00:27:12

New Features

  • All platform restrictions have been removed.

Version 3.0.0 - 2019-09-22 01:45:06

Breaking Changes

  • Swift 5.1
  • The older ContentSyntax and its child list node have been collapsed into a single list node.
    • The freed‐up, shorter name has been reused as the new name for ContentElementSyntax.

New Features

  • Many convenience methods and initializers have been added to syntax nodes.

Version 2.0.1 - 2019-08-26 23:13:48

Bug Fixes

  • Validation recognizes data- attributes.

Version 2.0.0 - 2019-08-16 23:06:19

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.

Version 1.0.2 - 2019-07-27 00:39:29

Bug Fixes

  • Interface‐related components are now localized into German.

Version 1.0.1 - 2019-07-10 00:16:56

Bug Fixes

  • Dependency updates.

Version 1.0.0 - 2019-06-12 02:13:17

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.

Version 0.1.1 - 2019-05-21 00:21:16

Bug Fixes

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

Version 0.1.0 - 2019-05-20 01:41:27

Initial release.

Version 0.0.3 - 2019-04-09 02:10:48

Third pre‐release.

Version 0.0.2 - 2018-12-01 11:32:57

Second pre‐release.

Version 0.0.1 - 2018-11-29 20:14:19

Initial pre‐release.