Input an Html code and get the Swift code for the following DSLs
to generate that Html code.
https://github.com/atacan/Dime-a-Dozen
import HtmlSwift
let htmlInput = """
<a href="url">link text</a>
<br>
"""
try convertToPointFree(html: htmlInput)
⤵
.html(
.head(
),
.body(
.a(
attributes: [
.href("url"),
],
"link text"
),
.br
)
)
or
try convertToBinaryBirds(html: htmlInput)
⤵
Html {
Head()
Body {
A("link text")
.href("url")
Br()
}
}
- You have an html code base, maybe with a templating language, but you want to switch to pure Swift DSL.
- You are using a CSS framework such as Bootstrap, and you copy paste the ready-made components you find.
Without a converter, the only way to switch to the DSL world is to look at your html code on one side and type the Swift code for it on the other side.
- Tests are incomplete. We need to test all the elements and attributes
- The code has a lot of repeated components. Those can be put in functions maybe.
Inspired by and adapted from HTMLKit