lib/ruco/syntax_parser.rb in ruco-0.2.3 vs lib/ruco/syntax_parser.rb in ruco-0.2.4
- old
+ new
@@ -1,12 +1,12 @@
module Ruco
module SyntaxParser
# textpow only offers certain syntax
TEXTPOW_CONVERT = {
- 'scss' => 'sass',
- 'html+erb' => 'html',
- 'rhtml' => 'html',
+ 'scss' => 'source.sass',
+ 'html+erb' => 'text.html.ruby',
+ 'rhtml' => 'text.html.ruby',
}
def self.syntax_for_line(line, languages)
syntax_for_lines([line], languages).first
end
@@ -24,11 +24,10 @@
def self.syntax_node(languages)
found = nil
fallbacks = languages.map{|l| TEXTPOW_CONVERT[l] }.compact
(languages + fallbacks).detect do |language|
- syntax = File.join(Textpow.syntax_path, "#{language}.syntax")
- found = Textpow::SyntaxNode.load(syntax) if File.exist?(syntax)
+ found = Textpow.syntax(language)
end
found
end
cmemoize :syntax_node