add descriptions to the project index

This commit is contained in:
Sami Samhuri 2012-04-28 09:01:15 -07:00
parent c78acc5919
commit dbf1824210
5 changed files with 73 additions and 32 deletions

View file

@ -38,6 +38,8 @@
#forkme { display: none } #forkme { display: none }
ul.nav { width: 80% }
ul.nav li { font-size: 1.4em ul.nav li { font-size: 1.4em
; line-height: 1.6em ; line-height: 1.6em
} }
@ -108,7 +110,7 @@
; font-size: 1em ; font-size: 1em
} }
#stats { font-size: 1em } #stats { font-size: 1em; margin-bottom: 0.5em }
footer { margin: 0 footer { margin: 0
; padding: 0.5em 0 ; padding: 0.5em 0

View file

@ -23,10 +23,9 @@ function main() {
ctx.template = html.toString() ctx.template = html.toString()
fs.readFile(projectFile, function(err, json) { fs.readFile(projectFile, function(err, json) {
if (err) throw err if (err) throw err
var projects = JSON.parse(json) var projects = JSON.parse(json).projects
, names = Object.keys(projects)
, index = path.join(targetDir, 'index.html') , index = path.join(targetDir, 'index.html')
// write project index // write project index
fs.readFile(path.join(templateDir, 'index.html'), function(err, tpl) { fs.readFile(path.join(templateDir, 'index.html'), function(err, tpl) {
if (err) throw err if (err) throw err
@ -34,7 +33,7 @@ function main() {
if (err && err.code !== 'EEXIST') throw err if (err && err.code !== 'EEXIST') throw err
fs.unlink(index, function(err) { fs.unlink(index, function(err) {
if (err && err.code !== 'ENOENT') throw err if (err && err.code !== 'ENOENT') throw err
var vals = { names: names } var vals = { projects: projects }
, html = mustache.to_html(tpl.toString(), vals) , html = mustache.to_html(tpl.toString(), vals)
fs.writeFile(index, html, function(err) { fs.writeFile(index, html, function(err) {
if (err) throw err if (err) throw err
@ -46,9 +45,9 @@ function main() {
// write project pages // write project pages
ctx.n = 0 ctx.n = 0
names.forEach(function(name) { projects.forEach(function(project) {
ctx.n += 1 ctx.n += 1
buildProject(name, projects[name], ctx) buildProject(project.name, project, ctx)
}) })
}) })
}) })

View file

@ -1,15 +1,45 @@
{ "batteries" : { "description" : "a general purpose node library" } { "projects" :
, "bin" : { "description" : "~/bin" } [ { "name" : "batteries"
, "cheat.el" : { "description" : "cheat from emacs" } , "description" : "a general purpose node library"
, "compiler" : { "description" : "an x86 compiler written in ruby" } }
, "config" : { "description" : "important dot files (zsh, emacs, vim, screen)" } , { "name" : "bin"
, "format" : { "description" : "printf for JavaScript" } , "description" : "~/bin"
, "gitter" : { "description" : "a GitHub client for Node (v2 API)" } }
, "lake" : { "description" : "A simple implementation of Scheme in C" } , { "name" : "cheat.el"
, "mojo.el" : { "description" : "turn emacs into a sweet mojo editor" } , "description" : "cheat from emacs"
, "NorthWatcher" : { "description" : "cron for filesystem changes" } }
, "repl-edit" : { "description" : "edit Node repl commands with your text editor" } , { "name" : "compiler"
, "samhuri.net" : { "description" : "this site" } , "description" : "an x86 compiler written in ruby"
, "strftime" : { "description" : "strftime for JavaScript" } }
, "ThePusher" : { "description" : "Github post receive hook router" } , { "name" : "config"
, "description" : "important dot files (zsh, emacs, vim, screen)"
}
, { "name" : "format"
, "description" : "printf for JavaScript"
}
, { "name" : "gitter"
, "description" : "a GitHub client for Node (v2 API)"
}
, { "name" : "lake"
, "description" : "A simple implementation of Scheme in C"
}
, { "name" : "mojo.el"
, "description" : "turn emacs into a sweet mojo editor"
}
, { "name" : "NorthWatcher"
, "description" : "cron for filesystem changes"
}
, { "name" : "repl-edit"
, "description" : "edit Node repl commands with your text editor"
}
, { "name" : "samhuri.net"
, "description" : "this site"
}
, { "name" : "strftime"
, "description" : "strftime for JavaScript"
}
, { "name" : "ThePusher"
, "description" : "Github post receive hook router"
}
]
} }

View file

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>currentDocument</key> <key>currentDocument</key>
<string>bin/blog.rb</string> <string>assets/css/style.css</string>
<key>documents</key> <key>documents</key>
<array> <array>
<dict> <dict>
@ -112,14 +112,14 @@
<key>caret</key> <key>caret</key>
<dict> <dict>
<key>column</key> <key>column</key>
<integer>21</integer> <integer>31</integer>
<key>line</key> <key>line</key>
<integer>2</integer> <integer>63</integer>
</dict> </dict>
<key>firstVisibleColumn</key> <key>firstVisibleColumn</key>
<integer>0</integer> <integer>0</integer>
<key>firstVisibleLine</key> <key>firstVisibleLine</key>
<integer>0</integer> <integer>1</integer>
</dict> </dict>
<key>assets/js/blog.js</key> <key>assets/js/blog.js</key>
<dict> <dict>

View file

@ -20,6 +20,13 @@
#gh img { border: none } #gh img { border: none }
span { padding: 5px } span { padding: 5px }
#forkme { display: none } #forkme { display: none }
#projects li p { margin: 0 }
#projects li p.description
{ font-size: 0.6em
; line-height: 1em
; color: #444
; margin-bottom: 0.5em
}
</style> </style>
</head> </head>
<body> <body>
@ -28,13 +35,6 @@
<header> <header>
<h1>projects</h1> <h1>projects</h1>
</header> </header>
<nav>
<ul class="nav" id="projects">
{{#names}}
<li><a href="{{.}}">{{.}}</a></li>
{{/names}}
</ul>
</nav>
<p id="gh"> <p id="gh">
<a class="img" href="https://github.com/samsonjs"><img src="../images/dr-octocat-448x448.png" width="224" height="224" alt="GitHub"></a> <a class="img" href="https://github.com/samsonjs"><img src="../images/dr-octocat-448x448.png" width="224" height="224" alt="GitHub"></a>
</p> </p>
@ -50,6 +50,16 @@
<td align="left">following <span id="nfollowing"><img src="../images/spinner@2x.gif" width="16" height="16"></span></td> <td align="left">following <span id="nfollowing"><img src="../images/spinner@2x.gif" width="16" height="16"></span></td>
</tr> </tr>
</table> </table>
<nav>
<ul class="nav" id="projects">
{{#projects}}
<li>
<p class="title"><a href="{{name}}">{{name}}</a></p>
<p class="description">{{description}}</p>
</li>
{{/projects}}
</ul>
</nav>
<footer> <footer>
<p>You can <a href="https://twitter.com/_sjs">find me on twitter</a>.</p> <p>You can <a href="https://twitter.com/_sjs">find me on twitter</a>.</p>
<p><a href="mailto:sami@samhuri.net">sami@samhuri.net</a></p> <p><a href="mailto:sami@samhuri.net">sami@samhuri.net</a></p>