Skip to content

Instantly share code, notes, and snippets.

@mdlawson
Created August 8, 2012 00:24
Show Gist options
  • Save mdlawson/3290867 to your computer and use it in GitHub Desktop.
Save mdlawson/3290867 to your computer and use it in GitHub Desktop.
Parser demo
task 'doc', 'Build docs', ->
fs = require 'fs'
dox = require '../dox'
jade = require 'jade'
fs.readFile 'doc/template.jade', 'utf-8', (err,tmpl) ->
fn = jade.compile tmpl
for file in files
code =fs.readFileSync "src/#{file}.coffee", 'utf-8'
json = dox.parseComments code
html = fn({"dox":json,"file":file})
fs.writeFileSync "doc/#{file}.html",html
doctype 5
html(lang="en")
head
title= "Rogue Docs"
script(src='highlight.pack.js')
link(rel='stylesheet', href='styles/monokai.css')
script
hljs.initHighlightingOnLoad();
body
ul
each item in dox
li
h3= "Description"
p!= item.description.full
h3= "Code"
pre
code.coffeescript= item.code
ul
each child in item.children
li
h3= "Description"
p!= child.description.full
h3= "Code"
pre
code.coffeescript= child.code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment