dokun1 / vaux Goto Github PK
View Code? Open in Web Editor NEWA HTML DSL library for Swift
License: Apache License 2.0
A HTML DSL library for Swift
License: Apache License 2.0
In looking the definitions for Attribute and StyleAttribute, is there a reason that public initializers are not provided? I suspect that they were just inadvertently omitted (I do it all the time; one of the less intuitive features of swift IMO).
public struct Attribute {
public let key: String
public let value: String?
}
public struct StyleAttribute {
public let key: String
public let value: String
}
I kinda expected this to work, but it doesn't (output
is an empty string). Any idea how to get the result as a String?
import Vaux
var pageTitle = "Page title"
var pageBody = "Page body"
func simplePage() -> HTML {
html {
head {
title(pageTitle)
}
body {
div {
pageBody
}
}
}
}
let content = simplePage()
var output = ""
let stream = HTMLOutputStream(output, content.getTag())
content.renderAsHTML(into: stream, attributes: [])
print(output)
swift --version
# Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
# Target: x86_64-apple-darwin19.3.0
swift test
# …/Vaux/Tests/VauxTests/VauxTableTests.swift:94:190:
# error: 'String' is not convertible to 'String?'
# link(…, label: "…").class("external").attr("rel", "noopener")
# ^~~~~~~~~~
# …/Vaux/Tests/VauxTests/VauxTests.swift:1703:13:
# error: expression type 'HTML' is ambiguous without more context
# fieldset {
# ^~~~~~~~~~
# …/Vaux/Tests/VauxTests/VauxTests.swift:1714:28:
# error: 'InputType' is not convertible to 'InputType?'
# input(type: .text)
# ~^~~~
# …/Vaux/Tests/VauxTests/VauxTests.swift:2386:49:
# error: 'String' is not convertible to 'String?'
# }.attr("for", "a b").attr("name", "x")
# ^~~
# …/Vaux/Tests/VauxTests/VauxTests.swift:2386:29:
# error: 'String' is not convertible to 'String?'
# }.attr("for", "a b").attr("name", "x")
# ^~~~~
The last tag, 0.2.0, is quite old - there have been a bunch of commits since then. Could you tag a new release?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.