soliciting feedback: which of these two syntaxes do you prefer?

body {
@each section in $(sections) where $(:title section) {
$(:title section)
}
$content
}

body {
@each section in (sections) where (:title section) {
$(:title section)
}
$content
}

(note that $ has disappeared from the @each line in the second one)

actually wait i'm a dumbass, this can consistently be (:title section) everywhere, even in the body

this is hot

body {
header.site-header {
nav.site-nav {
@each section in (sections) where (predicate section) {
a.page-link[href=$section.url] { $section.title }
}
}
}

ok follow-up question: which of these do you like better?

A: all of these rules:

  • div { Hello world } expands to <div>Hello world</div>
  • div { span { Hi } } expands to <div><span>Hi</span></div>
  • div { "Hello" span { world } } expands to <div>Hello<span>world</span></div>
  • div div > span { Hi } and p { Hello span { world } } are parse errors

B: all of these rules:

  • div { "Hello world" } expands to <div>Hello world</div>
  • div { span { "Hi" } } expands to <div><span>Hi</span></div>
  • div div > span { "Hi" } expands to <div></div><div><span>Hi</span></div>
  • p { Hello span { world } } expands to <p><Hello></Hello><span><world></world></span></p>

C: something else

@jyn In theory B, but I've used twirl (https://www.playframework.com/documentation/3.0.x/ScalaTemplates) which is in school A and it was Fine™ in practice.

That said, B3 looks like it might have a typo in its expansion? At least I can't find a logic for `foo foo > bar` to expand to `<foo/><foo><bar/></foo>` Also just generally not a fan of unmatched braces.

Scala Templates - 3.0.x

Play Framework - The High Velocity Web Framework For Java and Scala

@natkr think your client might be mangling B, it renders ok on mine:
@jyn I think @natkr is saying the > reads as an unmatched grouping character to them?
@zwol @jyn Yes, but as I wrote in the other subthread I can kinda buy that based on css/emmet's precedent. I think the main thing that confused me was that my brain wants to group `a b > c` as `(a b) > c`, rather than `a (b > c)`.
@natkr @jyn my brain actually wants to read it as a CSS selector, thus (a b > c) all one thing.
@zwol @jyn Yeah… I think that's where I went first tbh.