summary refs log tree commit diff stats
path: root/tools/website.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/website.tmpl')
-rw-r--r--tools/website.tmpl339
1 files changed, 155 insertions, 184 deletions
diff --git a/tools/website.tmpl b/tools/website.tmpl
index 6f7a216a5..bc3ed8e2c 100644
--- a/tools/website.tmpl
+++ b/tools/website.tmpl
@@ -1,142 +1,142 @@
 #! stdtmpl | standard
 #proc generateHTMLPage(c: var TConfigData, currentTab, content, rss: string): string = 
 #  result = ""
-<!DOCTYPE html>

+<!DOCTYPE html>
 <html>
-  <head>

-    <meta http-equiv="content-type" content="text/html; charset=utf-8">

-    <title>$c.projectTitle</title>

+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <title>$c.projectTitle</title>
     <link rel="stylesheet" type="text/css" href="assets/style.css" />
-
-    <link rel="shortcut icon" href="assets/images/favicon.ico">

+    <link rel="shortcut icon" href="assets/images/favicon.ico">
   #if len(rss) > 0:
     <link href="$rss" title="Recent changes" type="application/atom+xml" rel="alternate">
   #end if
-  </head>

-  <body>

-    <header id="head">

-      <div class="page-layout tall">

-        <div id="head-logo"></div>

-        <a id="head-logo-link" href="http://nim-lang.org/index.html"></a>

+  </head>
+  <body>
+    <header id="head">
+      <div class="page-layout tall">
+        <div id="head-logo"></div>
+        <a id="head-logo-link" href="index.html"></a>
         <nav id="head-links">
       #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" 
-        #elif t == "community" or t == "news":
-        #  continue
-        #else:
-          <a
-        #end if
-        #if t.contains('.'):
-          href="${t}" title = "$c.projectName - $name">$name</a>
-        #else:
-          href="${t}.html" title = "$c.projectName - $name">$name</a>
-        #end if
+      # let t = c.tabs[i].val
+      # if t != "index" and t != "community" and t != "news":
+      #   let name = c.tabs[i].key
+      #   if currentTab == t:
+            <a class="active" 
+      #   else:
+            <a
+      #   end if
+      #   if t.contains('.'):
+            href="${t}" title = "$c.projectName - $name">$name</a>
+      #   else:
+            href="${t}.html" title = "$c.projectName - $name">$name</a>
+      #   end if
+      # end if
       #end for
-        </nav>

-      </div>

-    </header>

+        </nav>
+      </div>
+    </header>
 
 #  if currentTab == "index":
     <section id="neck" class="home">
 #  else:
     <section id="neck">
-#  end

-      <div class="page-layout tall">

+#  end
+      <div class="page-layout tall">
         <div id="glow-arrow"></div>
 
-#  if currentTab == "index":

-        <div id="slideshow">

+#  if currentTab == "index":
+        <div id="slideshow">
           <!-- slides -->
-          <div id="slide0" class="">

-            <div>

-              <h2>Nim looks like this..</h2>

-<pre><span class="cmt"># compute average line length</span>

-<span class="kwd">var</span>

-<span class="tab">  </span>sum = <span class="val">0</span>

-<span class="tab end">  </span>count = <span class="val">0</span>

-

-<span class="kwd">for</span> line <span class="kwd">in</span> stdin.lines:

-<span class="tab">  </span>sum += line.len

-<span class="tab end">  </span>count += <span class="val">1</span>

-

-echo(<span class="val">"Average line length: "</span>,

-  <span class="kwd">if</span> count: sum / count <span class="kwd">else</span>: <span class="val">0</span>)

-</pre>

-            </div>

-            <div>

-               <h2>..and this...</h2>

-<pre><span class="cmt"># create and greet someone</span>

-<span class="kwd">type</span> <span class="def">Person</span> = <span class="typ">object</span>

-<span class="tab">  </span>name: <span class="typ">string</span>

-<span class="tab end">  </span>age: <span class="typ">int</span>

-

-<span class="kwd">proc</span> <span class="def">greet</span>(p: <span class="typ">Person</span>) =

-<span class="tab">  </span>echo <span class="val">"Hi, I'm "</span>, p.name, <span class="val">"."</span>

-<span class="tab end">  </span>echo <span class="val">"I am "</span>, p.age, <span class="val">" years old."</span>

-

-<span class="kwd">var</span> p = <span class="typ">Person</span>(name:<span class="val">"Jon"</span>, age:<span class="val">18</span>)

-p.greet() <span class="cmt"># or greet(p)</span>

-</pre>

-             </div>

-          </div>  <!-- slide0 -->
-          <div id="slide1" class="active">
-             <h2><a name="why-should-i-be-excited">Why should I be excited?</a></h2>
-             <span class="desc">
-               Nim is the only language that leverages automated proof technology
-               to perform a <i>disjoint check</i> for your parallel
-               code. Working on disjoint data means no locking is
-               required and yet data races are impossible:</span>
-             <pre>
+          <div id="slide0" class="active">
+            <h2><a name="why-should-i-be-excited">Why should I be excited?</a></h2>
+            <span class="desc">Nim is the only language that leverages automated proof technology to perform a <i>disjoint check</i> for your parallel code. Working on disjoint data means no locking is required and yet data races are impossible:</span><br><br>
+<pre>
 <span class="kwd">parallel</span>:
 <span class="tab">  </span><span class="kwd">var</span> i = <span class="val">0</span>
 <span class="tab">  </span><span class="kwd">while</span> i <= a.high:
-<span class="tab">    </span>spawn f(a[i])
-<span class="tab">    </span>spawn f(a[i+<span class="val">1</span>])
-<span class="tab">    </span><span class="cmt"># ERROR: cannot prove a[i] is disjoint from a[i+1]</span>
-<span class="tab">    </span><span class="cmt"># BUT: replace 'i += 1' with 'i += 2' and the code compiles!</span>
-<span class="tab end">    </span>i += <span class="val">1</span>
-            </pre>
+<span class="tab">  <span class="tab">  </span></span></span><span class="kwd">spawn</span> f(a[i])
+<span class="tab">  <span class="tab">  </span></span></span><span class="kwd">spawn</span> f(a[i+<span class="val">1</span>])
+<span class="tab">  <span class="tab">  </span></span></span><span class="cmt"># ERROR: cannot prove a[i] is disjoint from a[i+1]</span>
+<span class="tab">  <span class="tab">  </span></span></span><span class="cmt"># BUT: replace 'i += 1' with 'i += 2' and the code compiles!</span>
+<span class="tab end">  <span class="tab end">  </span></span>i += <span class="val">1</span>
+</pre>
+          </div>
+          <div id="slide1">
+            <div>
+              <h2>Nim is simple..</h2>
+<pre>
+<span class="cmt"># compute average line length</span>
+<span class="kwd">var</span>
+<span class="tab">  </span>sum = <span class="val">0</span>
+<span class="tab end">  </span>count = <span class="val">0</span>
+
+<span class="kwd">for</span> line <span class="kwd">in</span> stdin.lines:
+<span class="tab">  </span>sum += line.len
+<span class="tab end">  </span>count += <span class="val">1</span>
+
+echo(<span class="val">"Average line length: "</span>,
+  <span class="kwd">if</span> count &gt; <span class="val">0</span>: sum / count <span class="kwd">else</span>: <span class="val">0</span>)
+</pre>
+            </div>
+            <div>
+               <h2>..and type safe...</h2>
+<pre>
+<span class="cmt"># create and greet someone</span>
+<span class="kwd">type</span> <span class="def">Person</span> = <span class="kwd">object</span>
+<span class="tab">  </span>name: <span class="typ">string</span>
+<span class="tab end">  </span>age: <span class="typ">int</span>
+
+<span class="kwd">proc</span> <span class="def">greet</span>(p: <span class="typ">Person</span>) =
+<span class="tab">  </span>echo <span class="val">"Hi, I'm "</span>, p.name, <span class="val">"."</span>
+<span class="tab end">  </span>echo <span class="val">"I am "</span>, p.age, <span class="val">" years old."</span>
+
+<span class="kwd">let</span> p = <span class="typ">Person</span>(name:<span class="val">"Jon"</span>, age:<span class="val">18</span>)
+p.greet() <span class="cmt"># or greet(p)</span>
+</pre>
+             </div>
           </div>
           <div id="slide2" class="">
             <div>
-            <h2>interfacing with C..</h2>
-            <pre>
-<span class="kwd">proc</span> <span class="def">unsafeScanf</span>(f: <span class="typ">File</span>; s: <span class="typ">cstring</span>)
-<span class="tab">  </span>{.importc: <span class="val">"fscanf"</span>, 
-<span class="tab end">    </span>header: <span class="val">"&lt;stdio.h&gt;"</span>, varargs.}
-
-<span class="kwd">var</span> x: cint
-unsafeScanf(stdin, <span class="val">"%d"</span>, <span class="kwd">addr</span> x)
-            </pre></div>
-
+              <h2>C FFI is easy in Nim..</h2>
+<pre>
+<span class="cmt"># declare a C procedure..</span>
+<span class="kwd">proc</span> <span class="def">unsafeScanf</span>(f: <span class="typ">File</span>, s: <span class="typ">cstring</span>)
+<span class="tab">  </span>{.varargs,
+<span class="tab">    </span>importc: <span class="val">"fscanf"</span>, 
+<span class="tab end">    </span>header: <span class="val">"&lt;stdio.h&gt;"</span>.}
+
+<span class="cmt"># ..and use it...</span>
+<span class="kwd">var</span> x: <span class="typ">cint</span>
+stdin.unsafeScanf(<span class="val">"%d"</span>, <span class="kwd">addr</span> x)
+</pre>
+              <p><span class="desc"><b>Compile and run with:</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&#36; nim c -r example.nim</span></p>
+            </div>
             <div>
-              <h2>..and DSLs made easy</h2>
+              <h2>..and DSLs are too...</h2>
 <pre>
-<span class="kwd">import</span> jester, asyncdispatch, htmlgen
+<span class="cmt"># a simple html server</span>
+<span class="kwd">import</span>
+  jester, asyncdispatch, htmlgen
 
-routes:
-<span class="tab">  </span>get <span class="val">"/"</span>:
-<span class="tab end">    </span>resp h1(<span class="val">"Hello world"</span>)
+<span class="kwd">routes</span>:
+<span class="tab">  </span><span class="kwd">get</span> <span class="val">"/"</span>:
+<span class="tab end">  <span class="tab end">  </span></span><span class="kwd">resp</span> h1(<span class="val">"Hello world"</span>)
 
 runForever()
-</pre><p><span class="desc">
-Compile and run with:<br />
-nim c -r example.nim<br />
-View at: localhost:5000
-</span></p>
+</pre>
+              <p><span class="desc"><b>View in browser at:</b><br>&nbsp;&nbsp;&nbsp;&nbsp;localhost:5000</span></p>
             </div>
           </div>
-        </div>

-        <div id="slideshow-nav">

-          <div id="slideControl0" onclick="slideshow_click(0)"></div>

-          <div id="slideControl1" onclick="slideshow_click(1)" class="active"></div>

-          <div id="slideControl2" onclick="slideshow_click(2)"></div>

         </div>
-#  end

-        <aside id="sidebar">

+        <div id="slideshow-nav">
+          <div id="slideControl0" onclick="slideshow_click(0)" class="active"></div>
+          <div id="slideControl1" onclick="slideshow_click(1)"></div>
+          <div id="slideControl2" onclick="slideshow_click(2)"></div>
+        </div>
+#  end
+        <aside id="sidebar">
 
 #  if len(c.links) > 0:
           <h3>More Links</h3>
@@ -146,94 +146,65 @@ View at: localhost:5000
 #         end for
           </div>
 #  end if
-					<h3 class="blue">Latest News</h3>

-					<div id="sidebar-news">
 #  if len(c.ticker) > 0:
+					<h3 class="blue">Latest News</h3>
+					<div id="sidebar-news">
           $c.ticker
-#  end if

-					</div>

-				</aside>

-			</div>

-		</section>

-
-		<section id="body">

-			<div id="body-border"></div>

-			<div id="glow-line"></div>

-			<div class="page-layout">

+					</div>
+#  end if
+				</aside>
+			</div>
+		</section>
+
+		<section id="body">
+			<div id="body-border"></div>
+			<div id="glow-line"></div>
+			<div class="page-layout">
 				<article id="content" class="page">
-				$content

-				</article>

-			</div>

-		</section>

-

-		<!--- #foot --->

-		<footer id="foot" class="home">

-			<div class="page-layout tall">

-				<div id="foot-links">

-					<div>

-						<h4>Documentation</h4>

-						<a href="documentation.html">Stable Documentation</a>

-					<!--	<a href="">Development Documentation</a> -->

-						<a href="https://github.com/Araq/Nimrod">Issues &amp; Requests</a>

-					</div>

-					<div>

-						<h4>Community</h4>

-						<a href="http://forum.nim-lang.org">User Forum</a>

-            <a href="http://webchat.freenode.net/?channels=nimlang">Online IRC</a>

-            <a href="http://irclogs.nim-lang.org/">IRC Logs</a>

-					</div>

-				</div>

-				<div id="foot-legal">

-					<h4>Written in Nim - Powered by <a href="https://github.com/dom96/jester">Jester</a></h4>

-					Web Design by <a href="http://reign-studios.net/philipwitte/">Philip Witte</a> &amp; <a href="http://picheta.me/">Dominik Picheta</a><br>

-					Copyright © 2014 - <a href="http://nim-lang.org/blog/">Andreas Rumpf</a> &amp; <a href="https://github.com/Araq/Nimrod/graphs/contributors">Contributors</a>

-				</div>

-			</div>

-		</footer>

-

+				$content
+				</article>
+			</div>
+		</section>
+
+		<!--- #foot --->
+		<footer id="foot" class="home">
+			<div class="page-layout tall">
+				<div id="foot-links">
+					<div>
+						<h4>Documentation</h4>
+						<a href="documentation.html">Stable Documentation</a>
+						<a href="learn.html">Learning Resources</a>
+					<!--	<a href="">Development Documentation</a> -->
+						<a href="https://github.com/Araq/Nimrod">Issues &amp; Requests</a>
+					</div>
+					<div>
+						<h4>Community</h4>
+						<a href="http://forum.nim-lang.org">User Forum</a>
+            <a href="http://webchat.freenode.net/?channels=nim">Online IRC</a>
+            <a href="http://irclogs.nim-lang.org/">IRC Logs</a>
+					</div>
+				</div>
+				<div id="foot-legal">
+					<h4>Written in Nim - Powered by <a href="https://github.com/dom96/jester">Jester</a></h4>
+					Web Design by <a href="http://reign-studios.net/philipwitte/">Philip Witte</a> &amp; <a href="http://picheta.me/">Dominik Picheta</a><br>
+					Copyright © 2015 - <a href="http://nim-lang.org/blog/">Andreas Rumpf</a> &amp; <a href="https://github.com/Araq/Nimrod/graphs/contributors">Contributors</a>
+				</div>
+			</div>
+		</footer>
+  
+#  if currentTab == "index":
+  <script src="assets/index.js"></script>
+# end if
+#  if c.gaId != nil:
   <script>
     (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
     (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
     m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
     })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
-    ga('create', 'UA-48159761-1', 'nim-lang.org');
+    ga('create', '${c.gaId}', 'nim-lang.org');
     ga('send', 'pageview');
-
-var timer;
-var prevIndex = 0;
-
-function setSlideShow(index, short) {
-  if (index > 2) index = 0;
-  for (var i = 0; i < 10; ++i) {
-    var x = document.getElementById("slide"+i);
-    if (!x) break;
-    x.className = "";
-    document.getElementById("slideControl"+i).className = "";
-  }
-  document.getElementById("slide"+index).className = "active";
-  document.getElementById("slideControl"+index).className = "active";
-  prevIndex = index;
-  startTimer(short ? 8000 : 32000);
-}
-
-function nextSlide() { setSlideShow(prevIndex + 1, true); }
-function startTimer(t) { timer = setTimeout(nextSlide, t); }
-
-function slideshow_enter() { clearTimeout(timer); }
-function slideshow_exit () { startTimer(16000); }
-
-function slideshow_click(index) {
-  clearTimeout(timer);
-  setSlideShow(index, false);
-}
-
-window.onload = function() {
-  var slideshow = document.getElementById("slideshow");
-  slideshow.onmouseenter = slideshow_enter;
-  slideshow.onmouseleave = slideshow_exit;
-  startTimer(8000);
-};
   </script>
+#  end if
 </body>
 </html>