Fix regex syntax

This commit is contained in:
Brandon Keepers
2015-01-29 13:07:18 -06:00
parent bf6bd246fd
commit 7a601b196e

View File

@@ -23,7 +23,7 @@ module Linguist
#
# Returns a String or nil
def self.modeline(data)
regex = <<-EOF
regex =
/(?:
(-\*- \s* (?:mode:)? \s*) | # $1: Emacs
(\/\* \s* vim: \s* set \s* (?:ft|filetype)=) # $2: Vim
@@ -35,7 +35,6 @@ module Linguist
: \s* \*\/ # otherwise close Vim syntax
)
)/x
EOF
data.lines.first(5).any? { |l| l.match(regex) }
lang = $3