mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Support for .YAML-tmLanguage grammar files
This commit is contained in:
		| @@ -36,6 +36,8 @@ vendor/grammars/Docker.tmbundle: | |||||||
| - source.dockerfile | - source.dockerfile | ||||||
| vendor/grammars/Elm/: | vendor/grammars/Elm/: | ||||||
| - source.elm | - source.elm | ||||||
|  | - text.html.mediawiki.elm-build-output | ||||||
|  | - text.html.mediawiki.elm-documentation | ||||||
| vendor/grammars/FreeMarker.tmbundle: | vendor/grammars/FreeMarker.tmbundle: | ||||||
| - text.html.ftl | - text.html.ftl | ||||||
| vendor/grammars/G-Code/: | vendor/grammars/G-Code/: | ||||||
| @@ -577,6 +579,8 @@ vendor/grammars/sublime-text-ox/: | |||||||
| vendor/grammars/sublime-typescript/: | vendor/grammars/sublime-typescript/: | ||||||
| - source.ts | - source.ts | ||||||
| - source.tsx | - source.tsx | ||||||
|  | - text.error-list | ||||||
|  | - text.find-refs | ||||||
| vendor/grammars/sublime-varnish: | vendor/grammars/sublime-varnish: | ||||||
| - source.varnish.vcl | - source.varnish.vcl | ||||||
| vendor/grammars/sublime_cobol: | vendor/grammars/sublime_cobol: | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ class DirectoryPackage | |||||||
|       case File.extname(path.downcase) |       case File.extname(path.downcase) | ||||||
|       when '.plist' |       when '.plist' | ||||||
|         path.split('/')[-2] == 'Syntaxes' |         path.split('/')[-2] == 'Syntaxes' | ||||||
|       when '.tmlanguage', '.sublime-syntax' |       when '.tmlanguage', '.yaml-tmlanguage', '.sublime-syntax' | ||||||
|         true |         true | ||||||
|       when '.cson', '.json' |       when '.cson', '.json' | ||||||
|         path.split('/')[-2] == 'grammars' |         path.split('/')[-2] == 'grammars' | ||||||
| @@ -114,7 +114,7 @@ class SVNPackage | |||||||
|   def fetch(tmp_dir) |   def fetch(tmp_dir) | ||||||
|     `svn export -q "#{url}/Syntaxes" "#{tmp_dir}/Syntaxes"` |     `svn export -q "#{url}/Syntaxes" "#{tmp_dir}/Syntaxes"` | ||||||
|     raise "Failed to export SVN repository: #{url}: #{$?.to_s}" unless $?.success? |     raise "Failed to export SVN repository: #{url}: #{$?.to_s}" unless $?.success? | ||||||
|     Dir["#{tmp_dir}/Syntaxes/*.{plist,tmLanguage,tmlanguage,sublime-syntax}"] |     Dir["#{tmp_dir}/Syntaxes/*.{plist,tmLanguage,tmlanguage,YAML-tmLanguage,sublime-syntax}"] | ||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| @@ -148,7 +148,7 @@ def load_grammar(path) | |||||||
|   case File.extname(path.downcase) |   case File.extname(path.downcase) | ||||||
|   when '.plist', '.tmlanguage' |   when '.plist', '.tmlanguage' | ||||||
|     Plist::parse_xml(path) |     Plist::parse_xml(path) | ||||||
|   when '.sublime-syntax' |   when '.yaml-tmlanguage', '.sublime-syntax' | ||||||
|     content = File.read(path) |     content = File.read(path) | ||||||
|     # Attempt to parse YAML file even if it has a YAML 1.2 header |     # Attempt to parse YAML file even if it has a YAML 1.2 header | ||||||
|     if content.lines[0] =~ /^%YAML[ :]1\.2/ |     if content.lines[0] =~ /^%YAML[ :]1\.2/ | ||||||
| @@ -180,7 +180,7 @@ def load_grammars(tmp_dir, source, all_scopes) | |||||||
|         else |         else | ||||||
|           SingleFile.new(source) |           SingleFile.new(source) | ||||||
|         end |         end | ||||||
|       elsif source.end_with?('.tmLanguage', '.plist', '.sublime-syntax') |       elsif source.end_with?('.tmLanguage', '.plist', '.YAML-tmLanguage', '.sublime-syntax') | ||||||
|         SingleGrammar.new(source) |         SingleGrammar.new(source) | ||||||
|       elsif source.start_with?('https://github.com') |       elsif source.start_with?('https://github.com') | ||||||
|         GitHubPackage.new(source) |         GitHubPackage.new(source) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user