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

Add .tag to Java Server Pages #6048

Merged
merged 3 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/linguist/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ extensions:
- ".cmp"
- ".sol"
- ".stl"
- ".tag"
- ".url"
4 changes: 4 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ disambiguations:
pattern: '^\s*(?:use\s+v6\b|\bmodule\b|\bmy\s+class\b)'
- language: Turing
pattern: '^\s*%[ \t]+|^\s*var\s+\w+(\s*:\s*\w+)?\s*:=\s*\w+'
- extensions: ['.tag']
rules:
- language: Java Server Pages
pattern: '<%[@!=\s]?\s*(taglib|tag|include|attribute|variable)\s'
- extensions: ['.toc']
rules:
- language: World of Warcraft Addon Data
Expand Down
1 change: 1 addition & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3117,6 +3117,7 @@ Java Server Pages:
- jsp
extensions:
- ".jsp"
- ".tag"
tm_scope: text.html.jsp
ace_mode: jsp
codemirror_mode: htmlembedded
Expand Down
33 changes: 33 additions & 0 deletions test/fixtures/Generic/tag/Java Server Pages/skeleton_page.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<%@ tag language="java" pageEncoding="ISO-8859-1"
description="Base Page"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html>

<head>
<meta charset='utf-8'>
<title>WavyArch</title>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name='viewport' content='width=device-width, initial-scale=1'
, shrink-to-fit=no>
<link rel="shortcut icon"
href="<c:url value="/resources/img/logo.svg"/>" type="image/x-icon">
<link rel="stylesheet"
href="<c:url value="/resources/css/bootstrap.min.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/all.css"/>">
<link rel="stylesheet" href="<c:url value="/resources/css/main.css"/>">
</head>

<body>
<jsp:doBody />

<script src="<c:url value="/resources/js/jquery-3.5.1.slim.min.js"/>"></script>
<script src="<c:url value="/resources/js/popper.min.js"/>"></script>
<script src="<c:url value="/resources/js/bootstrap.min.js"/>"></script>
<script src="<c:url value="/resources/js/validation.js"/>"></script>
<script src="<c:url value="/resources/js/main.js"/>"></script>
</body>

</html>
1 change: 1 addition & 0 deletions test/fixtures/Generic/tag/nil/ignored.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Not a JSP tag file
7 changes: 7 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,13 @@ def test_t_by_heuristics
})
end

def test_tag_by_heuristics
assert_heuristics({
"Java Server Pages" => Dir.glob("#{fixtures_path}/Generic/tag/Java Server Pages/*"),
nil => Dir.glob("#{fixtures_path}/Generic/tag/nil/*")
})
end

def test_toc_by_heuristics
assert_heuristics({
"TeX" => all_fixtures("TeX", "*.toc"),
Expand Down