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 }
ul.nav { width: 80% }
ul.nav li { font-size: 1.4em
; line-height: 1.6em
}
@ -108,7 +110,7 @@
; font-size: 1em
}
#stats { font-size: 1em }
#stats { font-size: 1em; margin-bottom: 0.5em }
footer { margin: 0
; padding: 0.5em 0

View file

@ -23,10 +23,9 @@ function main() {
ctx.template = html.toString()
fs.readFile(projectFile, function(err, json) {
if (err) throw err
var projects = JSON.parse(json)
, names = Object.keys(projects)
var projects = JSON.parse(json).projects
, index = path.join(targetDir, 'index.html')
// write project index
fs.readFile(path.join(templateDir, 'index.html'), function(err, tpl) {
if (err) throw err
@ -34,7 +33,7 @@ function main() {
if (err && err.code !== 'EEXIST') throw err
fs.unlink(index, function(err) {
if (err && err.code !== 'ENOENT') throw err
var vals = { names: names }
var vals = { projects: projects }
, html = mustache.to_html(tpl.toString(), vals)
fs.writeFile(index, html, function(err) {
if (err) throw err
@ -46,9 +45,9 @@ function main() {
// write project pages
ctx.n = 0
names.forEach(function(name) {
projects.forEach(function(project) {
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" }
, "bin" : { "description" : "~/bin" }
, "cheat.el" : { "description" : "cheat from emacs" }
, "compiler" : { "description" : "an x86 compiler written in ruby" }
, "config" : { "description" : "important dot files (zsh, emacs, vim, screen)" }
, "format" : { "description" : "printf for JavaScript" }
, "gitter" : { "description" : "a GitHub client for Node (v2 API)" }
, "lake" : { "description" : "A simple implementation of Scheme in C" }
, "mojo.el" : { "description" : "turn emacs into a sweet mojo editor" }
, "NorthWatcher" : { "description" : "cron for filesystem changes" }
, "repl-edit" : { "description" : "edit Node repl commands with your text editor" }
, "samhuri.net" : { "description" : "this site" }
, "strftime" : { "description" : "strftime for JavaScript" }
, "ThePusher" : { "description" : "Github post receive hook router" }
{ "projects" :
[ { "name" : "batteries"
, "description" : "a general purpose node library"
}
, { "name" : "bin"
, "description" : "~/bin"
}
, { "name" : "cheat.el"
, "description" : "cheat from emacs"
}
, { "name" : "compiler"
, "description" : "an x86 compiler written in ruby"
}
, { "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">
<dict>
<key>currentDocument</key>
<string>bin/blog.rb</string>
<string>assets/css/style.css</string>
<key>documents</key>
<array>
<dict>
@ -112,14 +112,14 @@
<key>caret</key>
<dict>
<key>column</key>
<integer>21</integer>
<integer>31</integer>
<key>line</key>
<integer>2</integer>
<integer>63</integer>
</dict>
<key>firstVisibleColumn</key>
<integer>0</integer>
<key>firstVisibleLine</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>assets/js/blog.js</key>
<dict>

View file

@ -20,6 +20,13 @@
#gh img { border: none }
span { padding: 5px }
#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>
</head>
<body>
@ -28,13 +35,6 @@
<header>
<h1>projects</h1>
</header>
<nav>
<ul class="nav" id="projects">
{{#names}}
<li><a href="{{.}}">{{.}}</a></li>
{{/names}}
</ul>
</nav>
<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>
</p>
@ -50,6 +50,16 @@
<td align="left">following <span id="nfollowing"><img src="../images/spinner@2x.gif" width="16" height="16"></span></td>
</tr>
</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>
<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>