summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2013-03-02 20:19:28 -0500
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2013-03-02 20:19:28 -0500
commit3f439080c47d49318fd814b74a128897f9fdac59 (patch)
tree8171003311a0911d53b5f49c03449d2d9f0bb6e5
parent9d9935696b9c7dc8e70f6cab680f0363a7946601 (diff)
Templateize a bit better
-rw-r--r--main.ur86
1 files changed, 37 insertions, 49 deletions
diff --git a/main.ur b/main.ur
index 491d9b6..76082f9 100644
--- a/main.ur
+++ b/main.ur
@@ -57,46 +57,9 @@ fun menu (current : pageName) : xbody =
end
-(*********************************** Pages ***********************************)
-(* These need to be mutually recursive with the menu code--otherwise, the menus
-can't link to all the pages. *)
-
-and main () =
- return <xml>
- {headTag None}
- <body>
- <h1 class={siteTitle}><a link={main ()}>6.947 &ndash; Functional Programming Project Laboratory</a></h1>
- {menu (make [#Main] ())}
- <div class={content}>
- <p>
- Like <a href="//web.mit.edu/6.115/www/">6.115</a>, 6.947 is a chance to remember why you came to <span class={smallCaps}>mit</span>: to learn and to build.
- Whereas 6.115 focuses on constructing digital systems from compositions of discrete integrated circuits, however, we’ll be focusing on functional programming &ndash; constructing software systems from compositions of discrete mathematical functions.
- Prepare to leave behind everything you've ever known about programming and enter a world of functors, combinators, and monads; a world without borders or boundaries; <a href="//www.youtube.com/watch?v=OyRW9uFSmh0">a world where anything is possible</a>.
- </p>
- </div>
- {licenseInfo ()}
- </body>
- </xml>
+(********************************* Template **********************************)
-and forum () =
- return <xml>
- {headTag (Some "Forum")}
- <body>
- <h1 class={siteTitle}><a link={main ()}>6.947 &ndash; Functional Programming Project Laboratory</a></h1>
- {menu (make [#Forum] ())}
- <div class={content}>
- <p>
- Coming soon!
- </p>
- </div>
- {licenseInfo ()}
- </body>
- </xml>
-
-
-(****************************** Page components ******************************)
-
-and headTag (pageName : option string) : xhtml [] [] =
+and generic (pageName : option string) (menuAndContent : xbody) : xhtml [] [] =
let val titleString : string =
case pageName of
| None => "6.947 – Functional Programming Project Laboratory"
@@ -107,23 +70,48 @@ and headTag (pageName : option string) : xhtml [] [] =
<title>{[titleString]}</title>
<link rel="stylesheet" type="text/css" href="//bbaren.scripts.mit.edu/urweb/6.947/site.css"/>
</head>
+ <body>
+ <h1 class={siteTitle}><a link={main ()}>6.947 &ndash; Functional Programming Project Laboratory</a></h1>
+ {menuAndContent}
+ <div class={footer}>
+ <p>
+ 6.947 is free software: you can redistribute it and/or modify it under the terms of the <a href="//gnu.org/licenses/agpl"><span class={smallCaps}>gnu</span> Affero General Public License</a> as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ </p>
+
+ <p>
+ 6.947 is distributed in the hope that it will be useful, but <span class={smallCaps}>without any warranty</span>; without even the implied warranty of <span class={smallCaps}>merchantability</span> or <span class={smallCaps}>fitness for a particular purpose</span>.
+ See the <span class={smallCaps}>gnu</span> Affero General Public License for more details.
+ </p>
+
+ <p>
+ You can get the 6.947 source code <a href="file:///afs/athena.mit.edu/user/b/b/bbaren/web_scripts/urweb/6.947/">via AFS</a>.
+ </p>
+ </div>
+ </body>
</xml>
end
-and licenseInfo () : xbody =
- <xml>
- <div class={footer}>
- <p>
- 6.947 is free software: you can redistribute it and/or modify it under the terms of the <a href="//gnu.org/licenses/agpl"><span class={smallCaps}>gnu</span> Affero General Public License</a> as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- </p>
+(*********************************** Pages ***********************************)
+
+and main () =
+ return (generic None <xml>
+ {menu (make [#Main] ())}
+ <div class={content}>
<p>
- 6.947 is distributed in the hope that it will be useful, but <span class={smallCaps}>without any warranty</span>; without even the implied warranty of <span class={smallCaps}>merchantability</span> or <span class={smallCaps}>fitness for a particular purpose</span>.
- See the <span class={smallCaps}>gnu</span> Affero General Public License for more details.
+ Like <a href="//web.mit.edu/6.115/www/">6.115</a>, 6.947 is a chance to remember why you came to <span class={smallCaps}>mit</span>: to learn and to build.
+ Whereas 6.115 focuses on constructing digital systems from compositions of discrete integrated circuits, however, we’ll be focusing on functional programming &ndash; constructing software systems from compositions of discrete mathematical functions.
+ Prepare to leave behind everything you've ever known about programming and enter a world of functors, combinators, and monads; a world without borders or boundaries; <a href="//www.youtube.com/watch?v=OyRW9uFSmh0">a world where anything is possible</a>.
</p>
+ </div>
+ </xml>)
+and forum () =
+ return (generic (Some "Forum") <xml>
+ {menu (make [#Forum] ())}
+ <div class={content}>
<p>
- You can get the 6.947 source code <a href="file:///afs/athena.mit.edu/user/b/b/bbaren/web_scripts/urweb/6.947/">via AFS</a>.
+ Coming soon!
</p>
</div>
- </xml>
+ </xml>)