robb / Swim

A DSL for writing HTML in Swift
310 stars 9 forks source link

How to deal with whitespace? #17

Closed kevinrenskers closed 3 years ago

kevinrenskers commented 3 years ago

Consider this example:

div(id: "article_footer") {
  p {
    "Have feedback? Let me know on"
    a(href: "https://twitter.com/kevinrenskers") { "Twitter" }
    "."
  }
}

This will get rendered with a space between the link and the period. How would you prevent that from happening?

kevinrenskers commented 3 years ago

Ah, I see you have a solution for that via a custom operator.

div(id: "article_footer") {
  p {
    "Have feedback? Let me know on"
    a(href: "https://twitter.com/kevinrenskers") { "Twitter" }
    %"."
  }
}