Skip to content

Commit

Permalink
Merge pull request #29 from mattesmohr/master
Browse files Browse the repository at this point in the history
Add missing tag and fix typo
  • Loading branch information
MatsMoll authored Aug 30, 2021
2 parents ac158d7 + b3282b3 commit 441fa95
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Sources/HTMLKit/Localize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension Localized where B == NoData {
}
}

public struct EnviromentModifier: HTML {
public struct EnvironmentModifier: HTML {

let view: HTML
let locale: HTML
Expand All @@ -82,11 +82,11 @@ public struct EnviromentModifier: HTML {
}

extension HTML {
public func enviroment(locale: String) -> EnviromentModifier {
return EnviromentModifier(view: self, locale: locale)
public func environment(locale: String) -> EnvironmentModifier {
return EnvironmentModifier(view: self, locale: locale)
}

public func enviroment(locale: TemplateValue<String>) -> EnviromentModifier {
return EnviromentModifier(view: self, locale: locale)
public func environment(locale: TemplateValue<String>) -> EnvironmentModifier {
return EnvironmentModifier(view: self, locale: locale)
}
}
19 changes: 19 additions & 0 deletions Sources/HTMLKit/View Builders/TemplateBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2071,3 +2071,22 @@ public struct Viewport: HTMLComponent {
Meta().name(.viewport).content("width=\(mode.width), initial-scale=\(internalScale)")
}
}

/// The <main> tag defines the dominant content of a document.
public struct Main: ContentNode {

public var name: String { "main" }

public var attributes: [HTMLAttribute] = []

public var content: HTML

public init(@HTMLBuilder builder: () -> HTML) {
content = builder()
}

public init(attributes: [HTMLAttribute] = [], content: HTML = "") {
self.content = content
self.attributes = attributes
}
}
4 changes: 2 additions & 2 deletions Tests/HTMLKitTests/HTMLTestDocuments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ struct LocalizedView: HTMLTemplate {
P("unread.messages", with: ["numberTest": 2])
P("unread.messages", with: context)
}
.enviroment(locale: context.locale)
.environment(locale: context.locale)
}
}

Expand Down Expand Up @@ -859,7 +859,7 @@ struct LocalizedDateView: HTMLTemplate {
context.date.formatted(string: "MM/dd/yyyy")
}
}
.enviroment(locale: context.locale)
.environment(locale: context.locale)
}
}

Expand Down

0 comments on commit 441fa95

Please sign in to comment.