Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Created August 26, 2010 01:31
Show Gist options
  • Save jashkenas/550618 to your computer and use it in GitHub Desktop.
Save jashkenas/550618 to your computer and use it in GitHub Desktop.
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()
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