Nu-2.1.0
Nu now includes built in operators for generating HTML and other XML-style markup.
For usage examples, see the test/test_markup.nu unit tests.
As a simple example, this Nu code:
(puts (&html (&body (&h1 "Hello!")
(&p "This is a test")
(&p "This is a second paragraph"))))
produces the following output:
<!DOCTYPE html><html><body><h1>Hello!</h1><p>This is a test</p><p>This is a second paragraph</p></body></html>
You'll note that no line breaks or formatting is included. These can easily be added with xmllint:
%nush sample-markup.nu | xmllint --format -
<?xml version="1.0"?>
<!DOCTYPE html>
<html>
<body>
<h1>Hello!</h1>
<p>This is a test</p>
<p>This is a second paragraph</p>
</body>
</html>
Also, the Nu source formatter (in beautify.nu) now produces prettier output.
Download Nu here.