In the case of S-expressions that is true. In the case of HTML it may or may not be true. It depends on how the HTML parser is implemented. There is a "natural" mapping of HTML onto a parse tree that is different from the DOM, but that is not part of the standard (AFAIK).
> Can CL-WHO generate HTML that matches that?
Yes, though native Common Lisp does not provide c-like string escapes so putting in newlines is a little awkward. You could, of course, bring in a string interpolation library, but here's how you can do it without that:
? (defun nl () (who (fmt "~%"))) ; NL = NewLine
NL
? (defun nli () (who (fmt "~% "))) ; NLI = NewLine + Indent
NLI
? (princ (html (:pre (nli) (:span "one" (nli)) (nli) (:br (nli) (:span "two") (nl)))))
<pre>
<span>one
</span>
<br>
<span>two</span>
</br></pre>
Or you could do this: (html (:pre "
<span>one
</span>
<br>
<span>two</span>
<br />
"))
which looks like cheating but is actually closer to the spirit of the original.The PRE tag is really weird because it actually changes the way things inside it are parsed. You can actually implement that in Lisp too via reader macros. CL-WHO doesn't support that out of the box, but it's not hard.
I can't imagine anyone actually wanting to do that, though. The PRE tag is for presenting pre-formatted text without changing its appearance, so embedding other tags inside it is kinda perverse. [EDIT: I was wrong about this. See below.]