cf76665d7e2c9ee5292041e6b1a0a403bb3f1c84
[nit.git] / lib / html / examples / html_page.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import html
16
17 class NitHomepage
18 super HTMLPage
19
20 redef fun head do
21 add("meta").attr("charset", "utf-8")
22 add("title").text("Nit")
23 add("link").attr("rel", "icon").attr("href", "http://nitlanguage.org/favicon.ico").attr("type", "image/x-icon")
24 add("link").attr("rel", "stylesheet").attr("href", "http://nitlanguage.org/style.css").attr("type", "text/css")
25 add("link").attr("rel", "stylesheet").attr("href", "http://nitlanguage.org/local.css").attr("type", "text/css")
26 end
27
28 redef fun body do
29 open("article").add_class("page")
30 open("section").add_class("pageheader")
31 add_html("<a id='toptitle_first' class='toptitle'>the</a><a id='toptitle_second' class='toptitle' href=''>Nit</a><a id='toptitle_third' class='toptitle' href=''>Programming Language</a>")
32 open("header").add_class("header")
33 open("div").add_class("topsubtitle")
34 add("p").text("A Fun Language for Serious Programming")
35 close("div")
36 close("header")
37 close("section")
38
39 open("div").attr("id", "pagebody")
40 open("section").attr("id", "content")
41 add("h1").text("# What is Nit?")
42 add("p").text("Nit is an object-oriented programming language. The goal of Nit is to propose a robust statically typed programming language where structure is not a pain.")
43 add("p").text("So, what does the famous hello world program look like, in Nit?")
44 add_html("<pre><tt><span class='normal'>print </span><span class='string'>'Hello, World!'</span></tt></pre>")
45
46 add("h1").text("# Feature Highlights")
47 add("h2").text("Usability")
48 add("p").text("Nit's goal is to be usable by real programmers for real projects")
49
50 open("ul")
51 open("li")
52 add("a").attr("href", "http://en.wikipedia.org/wiki/KISS_principle").text("KISS principle")
53 close("li")
54 add("li").text("Script-like language without verbosity nor cryptic statements")
55 add("li").text("Painless static types: static typing should help programmers")
56 add("li").text("Efficient development, efficient execution, efficient evolution.")
57 close("ul")
58
59 add("h2").text("Robustness")
60 add("p").text("Nit will help you to write bug-free programs")
61
62 open("ul")
63 add("li").text("Strong static typing")
64 add("li").text("No more NullPointerException")
65 close("ul")
66
67 add("h2").text("Object-Oriented")
68 add("p").text("Nit's guideline is to follow the most powerful OO principles")
69
70 open("ul")
71 open("li")
72 add("a").attr("href", "./everything_is_an_object/").text("Everything is an object")
73 close("li")
74 open("li")
75 add("a").attr("href", "./multiple_inheritance/").text("Multiple inheritance")
76 close("li")
77 open("li")
78 add("a").attr("href", "./refinement/").text("Open classes")
79 close("li")
80 open("li")
81 add("a").attr("href", "./virtual_types/").text("Virtual types")
82 close("li")
83 close("ul")
84
85
86 add("h1").text("# Getting Started")
87 add("p").text("Get Nit from its Git repository:")
88
89 add_html("<pre><code>$ git clone http://nitlanguage.org/nit.git</code></pre>")
90 add("p").text("Build the compiler (may be long):")
91 add_html("<pre><code>$ cd nit\n")
92 add_html("$ make</code></pre>")
93 add("p").text("Compile a program:")
94 add_html("<pre><code>$ bin/nitc examples/hello_world.nit</code></pre>")
95 add("p").text("Execute the program:")
96 add_html("<pre><code>$ ./hello_world</code></pre>")
97 close("section")
98 close("div")
99 close("article")
100 end
101 end
102
103 var page = new NitHomepage
104 page.write_to stdout
105 page.write_to_file("nit.html")