diff options
-rw-r--r-- | doc/docs.txt | 3 | ||||
-rw-r--r-- | tools/nimweb.nim | 29 | ||||
-rw-r--r-- | tools/sunset.tmpl | 76 | ||||
-rw-r--r-- | tools/website.tmpl | 75 | ||||
-rw-r--r-- | web/assets/images/link_aporia.png | bin | 0 -> 1585 bytes | |||
-rw-r--r-- | web/assets/images/link_forum.png | bin | 0 -> 1107 bytes | |||
-rw-r--r-- | web/assets/images/link_nimbuild.png | bin | 0 -> 955 bytes | |||
-rw-r--r-- | web/assets/images/logo.png | bin | 0 -> 125152 bytes | |||
-rw-r--r-- | web/assets/images/quote.png | bin | 0 -> 1062 bytes | |||
-rw-r--r-- | web/assets/images/sidebar.png | bin | 0 -> 1029 bytes | |||
-rw-r--r-- | web/assets/images/sidebar_h2.png | bin | 0 -> 2104 bytes | |||
-rw-r--r-- | web/assets/images/sidebar_head.png | bin | 0 -> 39194 bytes | |||
-rw-r--r-- | web/assets/images/site_foot.png | bin | 0 -> 4039 bytes | |||
-rw-r--r-- | web/assets/images/site_neck.png | bin | 0 -> 391 bytes | |||
-rw-r--r-- | web/assets/style.css | 180 | ||||
-rw-r--r-- | web/download.txt | 3 | ||||
-rw-r--r-- | web/index.txt | 34 | ||||
-rw-r--r-- | web/nimrod.ini | 22 | ||||
-rw-r--r-- | web/ticker.txt | 32 |
19 files changed, 328 insertions, 126 deletions
diff --git a/doc/docs.txt b/doc/docs.txt index 14bdd64b2..2162d6564 100644 --- a/doc/docs.txt +++ b/doc/docs.txt @@ -1,6 +1,3 @@ - Incorrect documentation is often worse than no documentation. - -- Bertrand Meyer - The documentation consists of several documents: - | `Tutorial (part I) <tut1.html>`_ diff --git a/tools/nimweb.nim b/tools/nimweb.nim index de9bcb440..27e843fde 100644 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -8,16 +8,17 @@ # import - os, strutils, times, parseopt, parsecfg, streams, strtabs + os, strutils, times, parseopt, parsecfg, streams, strtabs, tables type - TKeyValPair = tuple[key, val: string] + TKeyValPair = tuple[key, id, val: string] TConfigData = object of TObject tabs, links: seq[TKeyValPair] doc, srcdoc, srcdoc2, webdoc, pdf: seq[string] authors, projectName, projectTitle, logo, infile, outdir, ticker: string vars: PStringTable nimrodArgs: string + quotations: TTable[string, tuple[quote, author: string]] proc initConfigData(c: var TConfigData) = c.tabs = @[] @@ -36,8 +37,9 @@ proc initConfigData(c: var TConfigData) = c.logo = "" c.ticker = "" c.vars = newStringTable(modeStyleInsensitive) + c.quotations = initTable[string, tuple[quote, author: string]]() -include "sunset.tmpl" +include "website.tmpl" # ------------------------- configuration file ------------------------------- @@ -132,8 +134,10 @@ proc parseIniFile(c: var TConfigData) = of "authors": c.authors = v else: quit(errorStr(p, "unknown variable: " & k.key)) of "var": nil - of "links": add(c.links, (k.key, v)) - of "tabs": add(c.tabs, (k.key, v)) + of "links": + let valID = v.split(';') + add(c.links, (k.key.replace('_', ' '), valID[1], valID[0])) + of "tabs": add(c.tabs, (k.key, "", v)) of "ticker": c.ticker = v of "documentation": case normalize(k.key) @@ -143,6 +147,10 @@ proc parseIniFile(c: var TConfigData) = of "srcdoc2": addFiles(c.srcdoc2, "lib", ".nim", split(v, {';'})) of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'})) else: quit(errorStr(p, "unknown variable: " & k.key)) + of "quotations": + let vSplit = v.split('-') + doAssert vSplit.len == 2 + c.quotations[k.key.normalize] = (vSplit[0], vSplit[1]) else: nil of cfgOption: quit(errorStr(p, "syntax error")) @@ -203,13 +211,10 @@ proc main(c: var TConfigData) = const cmd = "nimrod rst2html --compileonly $1 -o:web/$2.temp web/$2.txt" if c.ticker.len > 0: - Exec(cmd % [c.nimrodArgs, c.ticker]) - var temp = "web" / changeFileExt(c.ticker, "temp") try: - c.ticker = readFile(temp) + c.ticker = readFile("web" / c.ticker) except EIO: - quit("[Error] cannot open: " & temp) - RemoveFile(temp) + quit("[Error] cannot open: " & c.ticker) for i in 0..c.tabs.len-1: var file = c.tabs[i].val Exec(cmd % [c.nimrodArgs, file]) @@ -221,13 +226,15 @@ proc main(c: var TConfigData) = quit("[Error] cannot open: " & temp) var f: TFile var outfile = "web/upload/$#.html" % file + if not existsDir("web/upload"): + createDir("web/upload") if open(f, outfile, fmWrite): writeln(f, generateHTMLPage(c, file, content)) close(f) else: quit("[Error] cannot write file: " & outfile) removeFile(temp) - + copyDir("web/assets", "web/upload/assets") buildAddDoc(c, "web/upload") buildDoc(c, "web/upload") buildDoc(c, "doc") diff --git a/tools/sunset.tmpl b/tools/sunset.tmpl deleted file mode 100644 index fadf8d3e1..000000000 --- a/tools/sunset.tmpl +++ /dev/null @@ -1,76 +0,0 @@ -#! stdtmpl | standard -#proc generateHTMLPage(c: var TConfigData, currentTab, content: string): string = -# result = "" -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - -<head> - <title>$c.projectTitle</title> - <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <link rel="stylesheet" type="text/css" href="style/style.css" /> -</head> - -<body> - <div id="main"> - <div id="links"> - <!-- **** INSERT LINKS HERE **** --> - </div> - <div id="logo"><h1>$c.projectTitle</h1> - <h2>$c.logo</h2> - </div> - <div id="content"> - <div id="menu"> - <ul> -#for i in 0.. c.tabs.len-1: -# var name = c.tabs[i].key -# var t = c.tabs[i].val - #if currentTab == t: - <li><a id="selected" - #else: - <li><a - #end if - href="${t}.html" title = "$c.projectName - $name">$name</a></li> -#end for - </ul> - </div> - <div id="column1"> -# if len(c.ticker) > 0: - <div class="sidebaritem"> - <div class="sbihead"> - <h1>latest news</h1> - </div> - <div class="sbicontent"> - $c.ticker - </div> - </div> -# end if -# if len(c.links) > 0: - <div class="sidebaritem"> - <div class="sbihead"> - <h1>Links</h1> - </div> - <div class="sbilinks"> - <ul> -# for i in 0..c.links.len-1: - <li><a class="reference" href="${c.links[i].val}">${c.links[i].key}</a></li> -# end for - </ul> - </div> - </div> -# end if - </div> - <div id="column2"> - $content - </div> - </div> - <div id="footer"> - © 2012 $c.authors | Last update: ${getDateStr()} - <!-- | <iframe style="border: 0; margin: 0; padding: 0;" - src="https://www.gittip.com/Araq/widget.html" - width="48pt" height="15pt"></iframe> --> - - | <a class="reference" href="http://www.dcarter.co.uk">design by dcarter</a> - </div> - </div> -</body> -</html> diff --git a/tools/website.tmpl b/tools/website.tmpl new file mode 100644 index 000000000..0ec659267 --- /dev/null +++ b/tools/website.tmpl @@ -0,0 +1,75 @@ +#! stdtmpl | standard +#proc generateHTMLPage(c: var TConfigData, currentTab, content: string): string = +# result = "" +<!doctype html> +<html> + +<head> + <title>$c.projectTitle</title> + <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" type="text/css" href="assets/style.css" /> +</head> + +<body> + <div id="site"> + <!-- site_head --> + <div id="site_head"> + <div id="logo"></div> + </div> + + <!-- site_neck --> + <div id="site_neck"> + #for i in 0.. c.tabs.len-1: + # var name = c.tabs[i].key + # var t = c.tabs[i].val + #if currentTab == t: + <a class="active" + #else: + <a + #end if + href="${t}.html" title = "$c.projectName - $name">$name</a> + #end for + </div> + + <!-- site_body --> + <div id="site_body"> + + <!-- sidebar_wrapper --> + <div id="sidebar_wrap"> + <div id="sidebar"> + <div id="sidebar_head"></div> + <h2>Latest News</h2> +# if len(c.ticker) > 0: + $c.ticker +# end if + +# if len(c.links) > 0: + <h2>More Links</h2> +# for i in 0..c.links.len-1: + <a class="link" href="${c.links[i].val}" id="${c.links[i].id}">${c.links[i].key}</a> +# end for +# end if + </div> + </div> + <!-- page --> + <div id="page"> + #if c.quotations.hasKey(currentTab): + <div class="quote-image"></div> + <p class="quote"> + ${c.quotations[currentTab].quote} + <br> + <b style="float: right">-- ${c.quotations[currentTab].author}</b> + </p> + <br/> + #end if + + $content + </div> + </div> + <!-- site_foot --> + <div id="site_foot"> + <div id="legal">Copyright © 2013 - Andreas Rumpf & Contributors - All rights reserved - <a href="http://reign-studios.com/philipwitte/">Design by Philip Witte</a></div> + </div> + </div> +</body> +</html> diff --git a/web/assets/images/link_aporia.png b/web/assets/images/link_aporia.png new file mode 100644 index 000000000..6256792d7 --- /dev/null +++ b/web/assets/images/link_aporia.png Binary files differdiff --git a/web/assets/images/link_forum.png b/web/assets/images/link_forum.png new file mode 100644 index 000000000..d153231a7 --- /dev/null +++ b/web/assets/images/link_forum.png Binary files differdiff --git a/web/assets/images/link_nimbuild.png b/web/assets/images/link_nimbuild.png new file mode 100644 index 000000000..ad94f9c82 --- /dev/null +++ b/web/assets/images/link_nimbuild.png Binary files differdiff --git a/web/assets/images/logo.png b/web/assets/images/logo.png new file mode 100644 index 000000000..f6b95bf05 --- /dev/null +++ b/web/assets/images/logo.png Binary files differdiff --git a/web/assets/images/quote.png b/web/assets/images/quote.png new file mode 100644 index 000000000..52d529284 --- /dev/null +++ b/web/assets/images/quote.png Binary files differdiff --git a/web/assets/images/sidebar.png b/web/assets/images/sidebar.png new file mode 100644 index 000000000..8488f8acf --- /dev/null +++ b/web/assets/images/sidebar.png Binary files differdiff --git a/web/assets/images/sidebar_h2.png b/web/assets/images/sidebar_h2.png new file mode 100644 index 000000000..5de3da291 --- /dev/null +++ b/web/assets/images/sidebar_h2.png Binary files differdiff --git a/web/assets/images/sidebar_head.png b/web/assets/images/sidebar_head.png new file mode 100644 index 000000000..734d5709b --- /dev/null +++ b/web/assets/images/sidebar_head.png Binary files differdiff --git a/web/assets/images/site_foot.png b/web/assets/images/site_foot.png new file mode 100644 index 000000000..d94632b20 --- /dev/null +++ b/web/assets/images/site_foot.png Binary files differdiff --git a/web/assets/images/site_neck.png b/web/assets/images/site_neck.png new file mode 100644 index 000000000..cab3dc75a --- /dev/null +++ b/web/assets/images/site_neck.png Binary files differdiff --git a/web/assets/style.css b/web/assets/style.css new file mode 100644 index 000000000..f550f7809 --- /dev/null +++ b/web/assets/style.css @@ -0,0 +1,180 @@ +* { cursor:default; } +a, a * { cursor:pointer; text-decoration:none; } + +html, body { + margin:0; + padding:0; + width:100%; + height:100%; + background:#121220; + font:14px arial; + letter-spacing:1px; + line-height:22px; +} + +#site { z-index:0; position:relative; margin:0 auto; width:960px; } +#site > dive { position:relative; } + + /* site_head */ + #site_head { z-index:0; height:200px; } + + #logo { + z-index:-1; + position:absolute; + top:-35px; + left:-330px; + width:868px; + height:334px; + background:url("images/logo.png") no-repeat; + } + + /* site_neck */ + #site_neck { z-index:1; float:left; width:100%; height:40px; background:url("images/site_neck.png") bottom no-repeat; } + + #site_neck > a { + display:block; + float:left; + margin-top:3px; + margin-right:10px; + padding:4px 20px 0 20px; + height:28px; + color:#959a9b; + background:#394649; + font-size:18px; + } + + #site_neck > a:hover { + margin-top:0; + border-top:3px solid #1cb4ec; + } + + #site_neck > a.active { + margin-top:0; + padding-top:7px; + color:#fff; + background:#1cb4ec; + text-shadow:0 0 4px rgba(255,255,255,0.75); + } + + #site_neck > a.active:hover { + border-top:none; + } + + /* site_body */ + #site_body { z-index:2; float:left; clear:both; width:100%; background:#d1dbe3; } + + #page { position:relative; float:left; padding:20px 30px 50px 50px; width:620px; color:#343739; } + + #page h1 { margin-top:40px; } + #page h2 { margin-top:40px; } + + #page p { text-align:justify; } + + #page .quote-image { + z-index:0; + position:absolute; + top:15px; + left:20px; + width:59px; + height:42px; + background:url("images/quote.png") no-repeat; + } + + #page p.quote { + position:relative; + color:#6187a2; + font-style:italic; + letter-spacing:2px; + word-spacing:1px; + } + + #page pre { + padding:20px; + border-left:10px solid #8f9698; + background:#f3f6f8; + font-size:15px; + font-family:courier; + letter-spacing:0; + line-height:17px; + } + + #page pre > .Comment { color:#858686; font-style:italic; } + #page pre > .Keyword { color:#1cb4ec; font-weight:bold; } + #page pre > .Operator { color:#777; } + #page pre > .StringLit, #page pre > .DecNumber { color:#ff7302; } + + #page li { margin-top:10px; } + + + #sidebar_wrap { float:right; width:260px; } + #sidebar { + z-index:0; + position:relative; + left:20px; + padding:0 10px 60px 10px; + width:200px; + background:#394649 url("images/sidebar.png") bottom no-repeat; + } + + #sidebar_head { + z-index:-1; + position:absolute; + top:-220px; + left:-30px; + width:282px; + height:400px; + background:url("images/sidebar_head.png") top no-repeat; + } + + #sidebar > h2 { + position:relative; + left:-40px; + margin:20px 0 0 0; + padding:19px 0 0 48px; + width:204px; + height:47px; + color:#fff; + background:url("images/sidebar_h2.png") no-repeat; + text-shadow:0 0 4px rgba(255,255,255,0.75); + letter-spacing:2px; + } + + #sidebar > .news { display:block; margin-bottom:20px; padding:0 10px; } + #sidebar > .news > h3 { margin:0; color:#cdd1d1; font-size:18px; letter-spacing:2px; } + #sidebar > .news > p { margin:0; color:#99a0a1; } + #sidebar > .news:hover > h3 { color:#fff; text-shadow:0 0 4px rgba(255,255,255,0.75); } + #sidebar > .news:hover > p { color:#eee; text-shadow:0 0 4px rgba(255,255,255,0.5); } + + #sidebar > .link { + display:block; + margin:0; + padding:15px 20px 0 20px; + height:41px; + color:#cdd1d1; + font-size:18px; + font-weight:bold; + } + + #sidebar > .link:hover { + color:#fff; + text-shadow:0 0 4px rgba(255,255,255,0.75); + } + + #link_forum { background:url("images/link_forum.png") top right no-repeat; } + #link_aporia { background:url("images/link_aporia.png") top right no-repeat; } + #link_nimbuild { background:url("images/link_nimbuild.png") top right no-repeat; } + + /* site_foot */ + #site_foot { z-index:3; clear:both; padding-top:40px; height:150px; background:url("images/site_foot.png") top no-repeat; } + + #legal { + float:right; + margin-top:10px; + color:#88888f; + font-size:12px; + letter-spacing:1px; + } + + #legal > a { color:#88888f; } + #legal > a:visited { color:#88888f; } + #legal > a:hover { color:#fff; } diff --git a/web/download.txt b/web/download.txt index 688ea9f02..63b91a832 100644 --- a/web/download.txt +++ b/web/download.txt @@ -1,6 +1,3 @@ - There are two major products that come out of Berkeley: LSD and UNIX. - We don't believe this to be a coincidence. -- Jeremy S. Anderson. - Here you can download the latest version of the Nimrod Compiler. Please choose your platform: * source-based installation: `<download/nimrod_0.9.0.zip>`_ diff --git a/web/index.txt b/web/index.txt index 9b90e94de..6033ef930 100644 --- a/web/index.txt +++ b/web/index.txt @@ -2,12 +2,6 @@ Home ==== - The most important thing in the programming language is the name. A language - will not succeed without a good name. I have recently invented a very good - name and now I am looking for a suitable language. - -- D. E. Knuth - - **Nimrod combines Lisp's power with Python's readability and C's performance.** Welcome to Nimrod @@ -16,7 +10,9 @@ Welcome to Nimrod **Nimrod** is a statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their -various forms. Beneath a nice infix/indentation based syntax with a +various forms. + +Beneath a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system lies a semantic model that supports a soft realtime GC on thread local heaps. Asynchronous message passing is used between threads, so no "stop the world" mechanism is necessary. An unsafe @@ -24,16 +20,20 @@ shared memory heap is also provided for the increased efficiency that results from that model. -.. container:: snippet - *Nimrod looks like this:* - - .. code-block:: nimrod - import strutils - - # Prints the maximum integer from a list of integers - # delimited by whitespace read from stdin. - let tokens = stdin.readLine.split - echo tokens.map(parseInt).max, " is the maximum." +Nimrod looks like this: +======================= + +.. code-block:: nimrod + # compute average line length + var count = 0 + var sum = 0 + + for line in stdin.lines: + count += 1 + sum += line.len + + echo "Average line length: ", + if count > 0: sum / count else: 0 Nimrod is efficient diff --git a/web/nimrod.ini b/web/nimrod.ini index 565a02117..9c7e977c0 100644 --- a/web/nimrod.ini +++ b/web/nimrod.ini @@ -5,9 +5,11 @@ Logo: "efficient, expressive, elegant" Authors: "Andreas Rumpf and contributors" [Links] -FORUM: "http://forum.nimrod-code.org" -APORIA: "https://github.com/nimrod-code/Aporia" -NIMBUILD: "http://build.nimrod-code.org" +# Underscores are replaced with a space. +# Everything after ; is the ID +User_Forum: "http://forum.nimrod-code.org;link_forum" +Aporia_IDE: "https://github.com/nimrod-code/Aporia;link_aporia" +Nimbuild: "http://build.nimrod-code.org;link_nimbuild" [Tabs] # Menu entry: filename @@ -19,7 +21,19 @@ community: community FAQ: question [Ticker] -file: ticker +file: ticker.txt + +[Quotations] +# Page: quote - Person +# Bad things will happen if you use multiple dashes here. +index: """The most important thing in the programming language is the name. +A language will not succeed without a good name. I have recently invented a +very good name and now I am looking for a suitable language. - D. E. Knuth""" +documentation: """Incorrect documentation is often worse than no documentation. +- Bertrand Meyer""" +download: """There are two major products that come out of Berkeley: LSD and +UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson.""" + [Documentation] doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros" diff --git a/web/ticker.txt b/web/ticker.txt index 6b247c735..e0965238f 100644 --- a/web/ticker.txt +++ b/web/ticker.txt @@ -1,16 +1,24 @@ -| `2012-09-23`:newsdate: -| Nimrod version 0.9.0 has been released! - Get it `here <./download.html>`_. +<a class="news" href="news.html#Z2012-09-23-version-0-9-0-released"> + <h3>Sep 23, 2012</h3> + <p>Nimrod version 0.9.0 has been released!</p> +</a> -| `2012-02-09`:newsdate: -| Nimrod version 0.8.14 has been released! +<a class="news" href="news.html#Z2012-02-09-version-0-8-14-released"> + <h3>Feb 9, 2012</h3> + <p>Nimrod version 0.8.14 has been released!</p> +</a> -| `2011-07-10`:newsdate: -| Nimrod version 0.8.12 has been released! +<a class="news" href="news.html#Z2011-07-10-version-0-8-12-released"> + <h3>Jul 10, 2011</h3> + <p>Nimrod version 0.8.12 has been released!</p> +</a> -| `2010-10-20`:newsdate: -| Nimrod version 0.8.10 has been released! - -| `2010-03-14`:newsdate: -| Nimrod version 0.8.8 has been released! +<a class="news" href="news.html#Z2010-10-20-version-0-8-10-released"> + <h3>Oct 20, 2010</h3> + <p>Nimrod version 0.8.10 has been released!</p> +</a> +<a class="news" href="news.html#Z2010-03-14-version-0-8-8-released"> + <h3>Mar 14, 2010</h3> + <p>Nimrod version 0.8.8 has been released!</p> +</a> \ No newline at end of file |