Skip to content

Commit

Permalink
Merge pull request #42 from stylig/master
Browse files Browse the repository at this point in the history
Add support for literate CoffeeScript when a literate syntax is used
  • Loading branch information
surjikal committed Jan 19, 2015
2 parents 5a60a65 + 3e46785 commit 6e1b045
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CoffeeCompile.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
, "syntax_patterns": [
"Packages/CoffeeScript/CoffeeScript.tmLanguage"
, "Packages/Better CoffeeScript/CoffeeScript.tmLanguage"
, "Packages/Better CoffeeScript/CoffeeScript_Literate.tmLanguage"
, "Packages/Text/Plain text.tmLanguage"

]
Expand Down
2 changes: 2 additions & 0 deletions coffee_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def run(self, edit):

try:
[compiler, options] = settings_adapter(self.settings)['compiler']
# Literate option does not depend on settings, but on the files syntax (must be a literate tmLanguage)
options['literate'] = 'literate' in self.view.settings().get('syntax').lower()
javascript = self._compile(coffeescript, compiler, options)
self._write_javascript_to_panel(javascript, edit)
except CoffeeCompilationError as e:
Expand Down
2 changes: 2 additions & 0 deletions lib/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _options_to_json(self, options={}):
return 'null'
return JSON.dumps({
'bare': options.get('bare', False)
, 'literate': options.get('literate', False)
})


Expand Down Expand Up @@ -107,4 +108,5 @@ def compile(self, coffeescript, options):
def _options_to_args(self, options):
args = ['--stdio', '--print']
if options.get('bare'): args.append('--bare')
if options.get('literate'): args.append('--literate')
return args

0 comments on commit 6e1b045

Please sign in to comment.