Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Forked from jashkenas/markdown.coffee
Created August 26, 2010 03:45
Show Gist options
  • Save tim-smart/550754 to your computer and use it in GitHub Desktop.
Save tim-smart/550754 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