Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML grammar files #3079

Merged
merged 2 commits into from
Sep 4, 2016
Merged

YAML grammar files #3079

merged 2 commits into from
Sep 4, 2016

Conversation

pchaigno
Copy link
Contributor

This pull request partially fixes the issue at #3070.

The scopes for vendor/grammars/NSIS and vendor/grammars/awk-sublime were not recognized because the Sublime Text XML files were recently removed. The authors only kept the YAML files from which the XML files are generated.

Thus, this pull request adds support for YAML syntax definitions in script/convert-grammars.
A few new scopes were detected via .YAML-tmLanguage files. I added them in grammars.yml.

⚠️ Of course, for this to work, GitHub backend for syntax highlighting must also recognize YAML grammar files.

Sublime Text YAML syntax definitions use the .sublime-syntax file extension

Most syntax files declare a YAML 1.2 syntax although they are YAML 1.1 compatible
Thus, the YAML version header is stripped off before parsing
Displays a warning if parsing fails

In .sublime-syntax files, the scope is under the 'scope' key -- as opposed to the usual 'scopeName' key
@@ -42,7 +42,7 @@ class DirectoryPackage
case File.extname(path.downcase)
when '.plist'
path.split('/')[-2] == 'Syntaxes'
when '.tmlanguage'
when '.tmlanguage', '.yaml-tmlanguage', '.sublime-syntax'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sublime Text YAML syntax definitions use the .YAML-tmLanguage file extension, and more recently, .sublime-syntax.

@pchaigno pchaigno changed the title Yaml grammars YAML grammar files Jun 26, 2016
@arfon
Copy link
Contributor

arfon commented Jun 28, 2016

/ cc @aroben incase he has a chance to give this a quick look.

@aroben
Copy link
Contributor

aroben commented Aug 15, 2016

Of course, for this to work, GitHub backend for syntax highlighting must also recognize YAML grammar files.

GitHub uses the JSON files this script creates rather than parsing the original files directly. So if this script can turn YAML into JSON then it should work fine on GitHub.

@aroben
Copy link
Contributor

aroben commented Aug 15, 2016

This seems reasonable to me 👍

@pchaigno
Copy link
Contributor Author

pchaigno commented Sep 4, 2016

@arfon Do you want to wait for a specific version to merge this or should I go ahead?

@arfon
Copy link
Contributor

arfon commented Sep 4, 2016

@arfon Do you want to wait for a specific version to merge this or should I go ahead?
Show all checks

Nah, let's get this merged in.

@arfon arfon merged commit 04e1cc6 into github-linguist:master Sep 4, 2016
@pchaigno pchaigno deleted the yaml-grammars branch September 5, 2016 05:10
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants