<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>sample page</title>
<link rel="stylesheet" href="sample1.css"/>
</head>
<body>
<h1>sample</h1>
<p>
text sample
</p>
</body>
</html>
to: (html ((lang . "en"))
(head nil
(meta ((charset . "utf-8")))
(title nil "sample page")
(link ((rel . "stylesheet") (href . "sample1.css"))))
(body nil
(h1 nil "sample")
(p nil "text sample")))
I don't understand it, but it seems to be true. The egotistical part of me feels that they just haven't experience the enlightenment of understanding the benefits of have all data & code be manipulable, structured data rather than dead text which must be painstakingly parsed, combined with the benefits of a single, general, universal, cheaply-parseable representation.But the professional, open-minded part of me wonders if maybe I am missing the point. Maybe all that painful-to-parse, irregular syntax is buying something. Maybe there's a reason every generation for the last 50 years has been approximating some but not all of the features of Lisp. Maybe those other languages and formats have worthwhile benefits. Maybe they're even superior.
Or maybe most folks really are stuck in a local maximum, like kids who like being read to and don't see the advantage of learning to read. I honestly don't know.
Regardless, SEML looks great.
<p>This is a <b>really cool</b> sentence.</p>
Your solution will probably have to splice the text segments around the embedded markup, something like: (p nil (text "This is a " (b nil "really cool") " sentence."))
In particular, notice the careful whitespace at the edges of the strings.IMO this Sexpr is now more obtuse than the XML, and the more markup you have within text-spans (e.g. nested markup), the worse it gets. This is also a major difference between XML (markup language) vs JSON (data-structure notation).
Maybe you don't need the (text ...) thing, but either way you're changing the grammar. How do SEML and SXML handle this?
(p nil (text (string-join '("This" "is "a" '(b nil "really") '(b nil "cool") "sentence.") " ")))
No more wondering if the space between 'really' and 'cool' should be bold and no need to have awkward preceding and trailing padding. (p "This is a " (b "really cool") " sentence.")
Which seems a-okay to me.For someone that has edited a couple of html pages but is not a programmer SEML looks like gibberish (who is nil?).
(html (@ (lang "en"))
(head
(meta (@ (charset "utf-8")))
(title "sample page")
(link (@ (rel "stylesheet") (href "sample1.css"))))
(body
(h1 "sample")
(p "text sample")))
The great thing about standards is that there are so many to choose from.A noun in the English language, of Latin origin.
However, I changed the format when I saw Oleg Kiselyov's SXML work, to make my Web-scraping and other tools able to use his XML tools. I later made a few other tools that used SXML, such as a simple HTML-writing template embedded in Racket that does some of the checking and work at compilation time.[1]
At a library level, SXML's arbitrary nested lists make some things computationally harder to do (e.g., find all the attributes, depending on the "normal form" of SXML), but some other things easier to do (e.g., some kinds of functional editing, due to arbitrary nested lists). Aside from those considerations, SXML is the closest to a de facto standard for XML and HTML tools in Scheme.
If I ever happen to have funding to do so, I'd like to revisit the exact representations, to try come up with an end-all-be-all for all purposes, and redesign/reimplement all the tools from scratch. Until then, there's SXML.
[0] some people can't bear lisp uniformity for instance.
I bring this up so often that I have a go-to blog post for it: http://chriswarbo.net/blog/2017-08-29-s_expressions.html
Most text formats fall into one of these two categories. Formats primarily for storing text (like XML or SGML or TeX) are in the former, formats primarily for storing (unstructured) data (like sexps or JSON or YAML) are in the latter.