Browse files

updated Docco for the new Node 0.1.90

  • Loading branch information...
1 parent bf39b7b commit 5f7f25a447b72214c001652886cfba97dce71032 @jashkenas committed Apr 13, 2010
Showing with 9 additions and 6 deletions.
  1. +2 −0 Cakefile
  2. +7 −6 docco.coffee
View
2 Cakefile
@@ -1,3 +1,5 @@
+exec: require('child_process').exec
+
option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
task 'install', 'install the `docco` command into /usr/local (or --prefix)', (options) ->
View
13 docco.coffee
@@ -79,11 +79,11 @@ parse: (source, code) ->
# wherever our markers occur.
highlight: (source, sections, callback) ->
language: get_language source
- pygments: process.createChildProcess 'pygmentize', ['-l', language.name, '-f', 'html']
+ pygments: spawn 'pygmentize', ['-l', language.name, '-f', 'html']
output: ''
- pygments.addListener 'error', (error) ->
- process.stdio.writeError error if error
- pygments.addListener 'output', (result) ->
+ pygments.stderr.addListener 'data', (error) ->
+ puts error if error
+ pygments.stdout.addListener 'data', (result) ->
output += result if result
pygments.addListener 'exit', ->
output: output.replace(highlight_start, '').replace(highlight_end, '')
@@ -92,8 +92,8 @@ highlight: (source, sections, callback) ->
section.code_html: highlight_start + fragments[i] + highlight_end
section.docs_html: showdown.makeHtml section.docs_text
callback()
- pygments.write((section.code_text for section in sections).join(language.divider_text))
- pygments.close()
+ pygments.stdin.write((section.code_text for section in sections).join(language.divider_text))
+ pygments.stdin.end()
# Once all of the code is finished highlighting, we can generate the HTML file
# and write out the documentation. Pass the completed sections into the template
@@ -114,6 +114,7 @@ generate_html: (source, sections) ->
fs: require 'fs'
path: require 'path'
showdown: require('./vendor/showdown').Showdown
+{spawn: spawn, exec: exec}: require('child_process')
# A list of the languages that Docco supports, mapping the file extension to
# the name of the Pygments lexer and the symbol that indicates a comment. To

0 comments on commit 5f7f25a

Please sign in to comment.