News for hackers. Stuff that matters.
Re:The case against self-closing tags in HTML by entrox on Thursday July 06, 2023 @10:53AM (#36616907)
It's funny how close your example are to S-expressions, just replace the pointy brackets with round parenthesis and move the closing one to the end:

  (table
    (tr
      (td one)
      (td two)
      (td three))
    (tr
      (td another table)
      (td with more stuff)))
Re:The case against self-closing tags in HTML by em-bee on Thursday July 06, 2023 @11:19AM (#36617362)
i love s-expressions, but they have closing tags, so to me they are precisely not what the parent example shows. i prefer writing html with closing tags because then i can use any xml parser and my editor can jump from opening to closing tag and back.
Re:The case against self-closing tags in HTML by taeric on Thursday July 06, 2023 @12:36PM (#36618634)
Well, sorta. XML style syntax already has open and closing marks for the tags. They just additionally have marks for the end of non-attribute children. s-expressions not having that is still a win.
Re:The case against self-closing tags in HTML by em-bee on Thursday July 06, 2023 @02:37PM (#36620742)
yes, s-expressions are a win (that's why i love them) but i don't see the structure that way. for me the tags themselves are very elaborate opening and closing markers. that's simply how i perceive the xml structure. if a closing tag is missing when there should be one, the structure looks broken to me.

the example s-expression matches that structure and i perceive it as the same because the first element in any list has a special meaning (in lisp itself it is the function name, while the rest are arguments)

to replicate the html5 structure in the top comment without closing tags as s-expressions i would come up with something different:

  (table
    (tr)
      (td) one
      (td) two
      (td) three
    (tr)
      (td) another table
      (td) with more stuff)
Re:The case against self-closing tags in HTML by taeric on Thursday July 06, 2023 @06:39PM (#36624237)
I think I see your point, but it feels weird to see this form, to me.

To your point, I can see the opening tag as ( and the closing as ), but then that would lead to something more like:

    (table
      (tr
        (td one
        (td two
        (td three
      (tr
        (td ...
Which really just highlights how odd it is to see the opening tags without the closing ones. Which probably goes a long way to explaining why I don't like it. :D

Probably more natural to have something like:

    (html 
      table
        tr
          td "one"
          td "two"
        tr
          td "...")
In this way, you could optionally have the closing tags of /td and such. Still looks very weird to me.
Re:The case against self-closing tags in HTML by smcl on Thursday July 06, 2023 @11:04AM (#36617123)
I've seen quite a few HTML templating engines that look just like this (in C#, TS and Python)
Re:The case against self-closing tags in HTML by Zambyte on Thursday July 06, 2023 @11:04AM (#36617115)
Plus by moving the closing bracket to the end, it resolves any ambiguity in nesting.
Re:The case against self-closing tags in HTML by TylerE on Thursday July 06, 2023 @11:22AM (#36617404)
It also tosses the baby out, as you're in that horrible area of distinction-without-difference.
Re:The case against self-closing tags in HTML by charlieyu1 on Thursday July 06, 2023 @11:46AM (#36617811)
I liked jade/pugjs or other templatong language that allowed similar stuff back then.

Sadly they have fallen out of favour.

Re:The case against self-closing tags in HTML by Timon3 on Thursday July 06, 2023 @02:09PM (#36620314)
I still use them with Vue, it has perfect support and it feels just so good to write. Especially combined with Tailwind!
Re:The case against self-closing tags in HTML by gloryjulio on Thursday July 06, 2023 @12:29PM (#36618505)
S expressions with colored braces in ides are amazing
Re:The case against self-closing tags in HTML by lawn on Thursday July 06, 2023 @01:52PM (#36620011)
Mthis is the idea with Pollen, a static site generator implemented in Racket.

The markup experience was super nice.