Skip to content

Commit cbaca0a

Browse files
committed
Actually make the coffeescript asynchronous
Also remove an unneeded repo from the Makefile. `highlights` is already in our node package file, so it automatically downloads.
1 parent 6180396 commit cbaca0a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ html-highlights: bigpage
77
perl6 htmlify.p6 --parallel=1 --use-highlights
88

99
init-highlights:
10-
git clone https://github.com/atom/highlights.git ./highlights/highlights || cd highlights/highlights; git pull
1110
git clone https://github.com/perl6/atom-language-perl6 ./highlights/atom-language-perl6 || cd highlights/atom-language-perl6; git pull
1211
cd highlights; npm install .
1312

highlights/highlight-filename-from-stdin.coffee

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ stdin = process.openStdin()
1111
stdin.setEncoding 'utf8'
1212
mystderr = process.stderr
1313
mystdout = process.stdout
14-
foo = (full_path) ->
15-
fs.readFile full_path, 'utf8', (err, file_str) ->
16-
if err
17-
console.error err
14+
process_file = (full_path) ->
15+
fs.readFile full_path, 'utf8', (read_err, file_str) ->
16+
if read_err
17+
console.error read_err
1818
else
19-
mystdout.write highlighter.highlightSync(
20-
fileContents: file_str
21-
scopeName: 'source.perl6fe'
22-
) + '\n'
19+
highlighter.highlight (fileContents: file_str, scopeName: 'source.perl6fe'), (hl_err, html) ->
20+
if hl_err
21+
console.error hl_err
22+
else
23+
mystdout.write(html + '\n')
24+
2325

2426
stdin.on 'data', (input) ->
25-
foo path.resolve input.trim()
27+
process_file path.resolve input.trim()

0 commit comments

Comments
 (0)