Created
August 26, 2010 01:31
-
-
Save jashkenas/550618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch = -> | |
Git.readFile version, Path.join('articles', "#{name}.markdown"), preprocess | |
preprocess = (err, markdown) -> | |
return finish err if err | |
props = preProcessMarkdown markdown | |
finish Data.author version, props.author if props.author | |
finish {} | |
finish = (err, author) -> | |
return callback err if err | |
props.name = name | |
props.version = version if version isnt 'fs' | |
props.author = author | |
callback props | |
fetch() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step( | |
function getArticleMarkdown() { | |
Git.readFile(version, Path.join("articles", name + ".markdown"), this); | |
}, | |
function (err, markdown) { | |
if (err) { callback(err); return; } | |
props = preProcessMarkdown(markdown); | |
if (props.author) { | |
Data.author(version, props.author, this); | |
} else { | |
return {}; | |
} | |
}, | |
function finish(err, author) { | |
if (err) { callback(err); return; } | |
props.name = name; | |
if (version !== 'fs') { | |
props.version = version; | |
} | |
props.author = author; | |
return props; | |
}, | |
callback | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment