If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Friday, March 28, 2014

Ceylon: building typesafe webpages with the html module

import ceylon.html { Html, html5, Head, Body, P, H2, Ul, Li }
/**
Remark: Don't forget to import the html module in your module !!
import ceylon.html "1.0.0";
Output of program:
<!DOCTYPE html>
<html>
<head>
<title>
Hello Ceylon
</title>
</head>
<body>
<h2>
Introduction
</h2>
<ul>
<li>
Basics
</li>
<li>
Classes
</li>
</ul>
</body>
</html>
**/
void htmlDemo() {
Html html = Html {
doctype = html5;
head = Head { title = "Hello Ceylon"; };
body = Body {
H2 { text = "Introduction";},
Ul {
Li {text = "Basics";},
Li {text = "Classes";}
}
};
};
print(html);
}

No comments:

Post a Comment