Skip to content

Commit

Permalink
Add Pipfile filename globs to JSON and TOML lexers (#975)
Browse files Browse the repository at this point in the history
This commit adds Pipfile filename globs to the JSON and TOML lexers.
  • Loading branch information
remcohaszing authored and pyrmont committed Jul 3, 2019
1 parent da7f4dd commit f82edb2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class JSON < RegexLexer
title 'JSON'
desc "JavaScript Object Notation (json.org)"
tag 'json'
filenames '*.json'
filenames '*.json', 'Pipfile.lock'
mimetypes 'application/json', 'application/vnd.api+json',
'application/hal+json', 'application/problem+json',
'application/schema+json'
Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/toml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TOML < RegexLexer
desc 'the TOML configuration format (/~https://github.com/mojombo/toml)'
tag 'toml'

filenames '*.toml'
filenames '*.toml', 'Pipfile'
mimetypes 'text/x-toml'

identifier = /\S+/
Expand Down
1 change: 1 addition & 0 deletions spec/lexers/javascript_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
it 'guesses by filename' do
assert_guess :filename => 'foo.js'
assert_guess Rouge::Lexers::JSON, :filename => 'foo.json'
assert_guess Rouge::Lexers::JSON, :filename => 'Pipfile.lock'
end

it 'guesses by mimetype' do
Expand Down
1 change: 1 addition & 0 deletions spec/lexers/toml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

it 'guesses by filename' do
assert_guess :filename => 'foo.toml'
assert_guess :filename => 'Pipfile'
end

it 'guesses by mimetype' do
Expand Down

0 comments on commit f82edb2

Please sign in to comment.