mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #66 from beckje01/master
Grails and Gosu GSP guessing
This commit is contained in:
@@ -433,6 +433,19 @@ module Linguist
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Internal: Guess language of .gsp files.
|
||||
#
|
||||
# Returns a Language.
|
||||
def guess_gsp_language
|
||||
if lines.grep(/<%|<%@|${|<%|<g:|<meta name="layout"|<r:/).any?
|
||||
Language['Groovy Server Pages']
|
||||
else
|
||||
Language['Gosu']
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Internal: Guess language from the first line.
|
||||
#
|
||||
# Look for leading "<?php"
|
||||
|
||||
@@ -379,6 +379,16 @@ Groovy:
|
||||
- .gradle
|
||||
- .groovy
|
||||
|
||||
Groovy Server Pages:
|
||||
group: Groovy
|
||||
lexer: Java Server Page
|
||||
overrides:
|
||||
- .gsp
|
||||
aliases:
|
||||
- gsp
|
||||
extensions:
|
||||
- .gsp
|
||||
|
||||
HTML:
|
||||
type: markup
|
||||
primary_extension: .html
|
||||
|
||||
10
test/fixtures/bar.gsp
vendored
Normal file
10
test/fixtures/bar.gsp
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Testing with SiteMesh and Resources</title>
|
||||
<meta name="layout" content="blankMain"/>
|
||||
<r:require module="style"/>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
16
test/fixtures/hello-pagedirective.gsp
vendored
Normal file
16
test/fixtures/hello-pagedirective.gsp
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Using page directive tag</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="center">
|
||||
<a href="#" alt="Download" id="downloadButton">Download</a>
|
||||
</div>
|
||||
<div class="center">
|
||||
<a href="#" alt="Print" id="printButton">Print</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
9
test/fixtures/hello-resources.gsp
vendored
Normal file
9
test/fixtures/hello-resources.gsp
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Testing with Resources</title>
|
||||
<r:require module="style"/>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -332,6 +332,12 @@ class TestBlob < Test::Unit::TestCase
|
||||
assert_equal Language['Gosu'], blob("hello.gsp").language
|
||||
assert_equal Language['Gosu'], blob("Hello.gst").language
|
||||
assert_equal Language['Gosu'], blob("hello.vark").language
|
||||
|
||||
#Groovy Server Pages
|
||||
assert_equal Language['Groovy Server Pages'], blob("bar.gsp").language
|
||||
assert_equal Language['Groovy Server Pages'], blob("hello-resources.gsp").language
|
||||
assert_equal Language['Groovy Server Pages'], blob("hello-pagedirective.gsp").language
|
||||
|
||||
end
|
||||
|
||||
def test_lexer
|
||||
|
||||
Reference in New Issue
Block a user