Implemented new Nimrod website designed by @PhilipWitte.

This commit is contained in:
Dominik Picheta 2013-05-18 17:36:57 +01:00
commit f081ac0e54
19 changed files with 328 additions and 126 deletions

View file

@ -1,6 +1,3 @@
Incorrect documentation is often worse than no documentation.
-- Bertrand Meyer
The documentation consists of several documents: The documentation consists of several documents:
- | `Tutorial (part I) <tut1.html>`_ - | `Tutorial (part I) <tut1.html>`_

View file

@ -8,16 +8,17 @@
# #
import import
os, strutils, times, parseopt, parsecfg, streams, strtabs os, strutils, times, parseopt, parsecfg, streams, strtabs, tables
type type
TKeyValPair = tuple[key, val: string] TKeyValPair = tuple[key, id, val: string]
TConfigData = object of TObject TConfigData = object of TObject
tabs, links: seq[TKeyValPair] tabs, links: seq[TKeyValPair]
doc, srcdoc, srcdoc2, webdoc, pdf: seq[string] doc, srcdoc, srcdoc2, webdoc, pdf: seq[string]
authors, projectName, projectTitle, logo, infile, outdir, ticker: string authors, projectName, projectTitle, logo, infile, outdir, ticker: string
vars: PStringTable vars: PStringTable
nimrodArgs: string nimrodArgs: string
quotations: TTable[string, tuple[quote, author: string]]
proc initConfigData(c: var TConfigData) = proc initConfigData(c: var TConfigData) =
c.tabs = @[] c.tabs = @[]
@ -36,8 +37,9 @@ proc initConfigData(c: var TConfigData) =
c.logo = "" c.logo = ""
c.ticker = "" c.ticker = ""
c.vars = newStringTable(modeStyleInsensitive) c.vars = newStringTable(modeStyleInsensitive)
c.quotations = initTable[string, tuple[quote, author: string]]()
include "sunset.tmpl" include "website.tmpl"
# ------------------------- configuration file ------------------------------- # ------------------------- configuration file -------------------------------
@ -132,8 +134,10 @@ proc parseIniFile(c: var TConfigData) =
of "authors": c.authors = v of "authors": c.authors = v
else: quit(errorStr(p, "unknown variable: " & k.key)) else: quit(errorStr(p, "unknown variable: " & k.key))
of "var": nil of "var": nil
of "links": add(c.links, (k.key, v)) of "links":
of "tabs": add(c.tabs, (k.key, v)) 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 "ticker": c.ticker = v
of "documentation": of "documentation":
case normalize(k.key) case normalize(k.key)
@ -143,6 +147,10 @@ proc parseIniFile(c: var TConfigData) =
of "srcdoc2": addFiles(c.srcdoc2, "lib", ".nim", split(v, {';'})) of "srcdoc2": addFiles(c.srcdoc2, "lib", ".nim", split(v, {';'}))
of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'})) of "webdoc": addFiles(c.webdoc, "lib", ".nim", split(v, {';'}))
else: quit(errorStr(p, "unknown variable: " & k.key)) 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 else: nil
of cfgOption: quit(errorStr(p, "syntax error")) of cfgOption: quit(errorStr(p, "syntax error"))
@ -203,13 +211,10 @@ proc main(c: var TConfigData) =
const const
cmd = "nimrod rst2html --compileonly $1 -o:web/$2.temp web/$2.txt" cmd = "nimrod rst2html --compileonly $1 -o:web/$2.temp web/$2.txt"
if c.ticker.len > 0: if c.ticker.len > 0:
Exec(cmd % [c.nimrodArgs, c.ticker])
var temp = "web" / changeFileExt(c.ticker, "temp")
try: try:
c.ticker = readFile(temp) c.ticker = readFile("web" / c.ticker)
except EIO: except EIO:
quit("[Error] cannot open: " & temp) quit("[Error] cannot open: " & c.ticker)
RemoveFile(temp)
for i in 0..c.tabs.len-1: for i in 0..c.tabs.len-1:
var file = c.tabs[i].val var file = c.tabs[i].val
Exec(cmd % [c.nimrodArgs, file]) Exec(cmd % [c.nimrodArgs, file])
@ -221,13 +226,15 @@ proc main(c: var TConfigData) =
quit("[Error] cannot open: " & temp) quit("[Error] cannot open: " & temp)
var f: TFile var f: TFile
var outfile = "web/upload/$#.html" % file var outfile = "web/upload/$#.html" % file
if not existsDir("web/upload"):
createDir("web/upload")
if open(f, outfile, fmWrite): if open(f, outfile, fmWrite):
writeln(f, generateHTMLPage(c, file, content)) writeln(f, generateHTMLPage(c, file, content))
close(f) close(f)
else: else:
quit("[Error] cannot write file: " & outfile) quit("[Error] cannot write file: " & outfile)
removeFile(temp) removeFile(temp)
copyDir("web/assets", "web/upload/assets")
buildAddDoc(c, "web/upload") buildAddDoc(c, "web/upload")
buildDoc(c, "web/upload") buildDoc(c, "web/upload")
buildDoc(c, "doc") buildDoc(c, "doc")

View file

@ -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">
&copy; 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>

75
tools/website.tmpl Normal file
View file

@ -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 &copy; 2013 - Andreas Rumpf &amp; Contributors - All rights reserved - <a href="http://reign-studios.com/philipwitte/">Design by Philip Witte</a></div>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

BIN
web/assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
web/assets/images/quote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

180
web/assets/style.css Normal file
View file

@ -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; }

View file

@ -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. Here you can download the latest version of the Nimrod Compiler.
Please choose your platform: Please choose your platform:
* source-based installation: `<download/nimrod_0.9.0.zip>`_ * source-based installation: `<download/nimrod_0.9.0.zip>`_

View file

@ -2,12 +2,6 @@
Home 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.** **Nimrod combines Lisp's power with Python's readability and C's performance.**
Welcome to Nimrod Welcome to Nimrod
@ -16,7 +10,9 @@ Welcome to Nimrod
**Nimrod** is a statically typed, imperative programming language that tries to **Nimrod** is a statically typed, imperative programming language that tries to
give the programmer ultimate power without compromises on runtime efficiency. give the programmer ultimate power without compromises on runtime efficiency.
This means it focuses on compile-time mechanisms in all their 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 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 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 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. from that model.
.. container:: snippet Nimrod looks like this:
*Nimrod looks like this:* =======================
.. code-block:: nimrod .. code-block:: nimrod
import strutils # compute average line length
var count = 0
var sum = 0
# Prints the maximum integer from a list of integers for line in stdin.lines:
# delimited by whitespace read from stdin. count += 1
let tokens = stdin.readLine.split sum += line.len
echo tokens.map(parseInt).max, " is the maximum."
echo "Average line length: ",
if count > 0: sum / count else: 0
Nimrod is efficient Nimrod is efficient

View file

@ -5,9 +5,11 @@ Logo: "efficient, expressive, elegant"
Authors: "Andreas Rumpf and contributors" Authors: "Andreas Rumpf and contributors"
[Links] [Links]
FORUM: "http://forum.nimrod-code.org" # Underscores are replaced with a space.
APORIA: "https://github.com/nimrod-code/Aporia" # Everything after ; is the ID
NIMBUILD: "http://build.nimrod-code.org" 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] [Tabs]
# Menu entry: filename # Menu entry: filename
@ -19,7 +21,19 @@ community: community
FAQ: question FAQ: question
[Ticker] [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] [Documentation]
doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros" doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters;trmacros"

View file

@ -1,16 +1,24 @@
| `2012-09-23`:newsdate: <a class="news" href="news.html#Z2012-09-23-version-0-9-0-released">
| Nimrod version 0.9.0 has been released! <h3>Sep 23, 2012</h3>
Get it `here <./download.html>`_. <p>Nimrod version 0.9.0 has been released!</p>
</a>
| `2012-02-09`:newsdate: <a class="news" href="news.html#Z2012-02-09-version-0-8-14-released">
| Nimrod version 0.8.14 has been released! <h3>Feb 9, 2012</h3>
<p>Nimrod version 0.8.14 has been released!</p>
</a>
| `2011-07-10`:newsdate: <a class="news" href="news.html#Z2011-07-10-version-0-8-12-released">
| Nimrod version 0.8.12 has been released! <h3>Jul 10, 2011</h3>
<p>Nimrod version 0.8.12 has been released!</p>
</a>
| `2010-10-20`:newsdate: <a class="news" href="news.html#Z2010-10-20-version-0-8-10-released">
| Nimrod version 0.8.10 has been released! <h3>Oct 20, 2010</h3>
<p>Nimrod version 0.8.10 has been released!</p>
| `2010-03-14`:newsdate: </a>
| Nimrod version 0.8.8 has been released!
<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>