Add support for Java Template Engine by maths22 · Pull Request #6610 · github-linguist/linguist · GitHub
Skip to content
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
3 changes: 3 additions & 0 deletions .gitmodules
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ vendor/grammars/javascript-objective-j.tmbundle:
- source.js.objj
vendor/grammars/jflex.tmbundle:
- source.jflex
vendor/grammars/jte-template-syntax-highlight:
- text.html.jte
vendor/grammars/kivy-language-grammer:
- source.python.kivy
vendor/grammars/kusto-sublime:
Expand Down
11 changes: 11 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3301,6 +3301,17 @@ Java Server Pages:
codemirror_mode: htmlembedded
codemirror_mime_type: application/x-jsp
language_id: 182
Java Template Engine:
type: programming
color: "#2A6277"
group: Java
aliases:
- jte
extensions:
- ".jte"
ace_mode: text
tm_scope: text.html.jte
language_id: 599494012
JavaScript:
type: programming
tm_scope: source.js
Expand Down
81 changes: 81 additions & 0 deletions samples/Java Template Engine/baseLayout.jte
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@import static org.example.common.utils.JteHelper.*
@import static org.example.global.ExampleConstants.*
@import gg.jte.Content

@param String pageTitle = null
@param Content body

!{pageTitle = pageTitle == null ? APP_NAME : pageTitle;}

!{addCssFile("main");}
!{addScriptFile("layout");}

!{var renderedBody = preRenderContent(body);}
<!DOCTYPE html>
<html lang="${getLang()}" data-template="jte">
<head>
<title>${pageTitle}</title>

<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>

<link rel="icon" href="${assetHelper().path("favicon.ico")}"/>
<link rel="stylesheet" href="${assetHelper().path("js/jquery-ui.css")}"/>

@for(var resource : assetHelper().bundle("globals").getAssets().getCss())
<link rel="stylesheet" href="${assetHelper().bundlePath(resource)}"/>
@endfor

<%-- Ensure our css files have precedence over global ones --%>
@for(var file : getCssFiles())
<link rel="stylesheet" href="${assetHelper().path("css/" + file + ".css")}" />
@endfor

@for(var file : getBundleFiles())
@for(var resource : assetHelper().bundle(file).getAssets().getCss())
<link rel="stylesheet" href="${assetHelper().bundlePath(resource)}"/>
@endfor
@endfor

@for(var style : getInlineStyles())
${style}
@endfor
</head>
<body>
<script>
window.FTC_ENV = ${jsonEncode(ftcEnv())};
</script>
@for(var resource : assetHelper().bundle("sentry").getAssets().getJs())
<script src="${assetHelper().bundlePath(resource)}" type="module"></script>
@endfor
<script src="${assetHelper().path("translations/" + getLang() + ".js")}"></script>
<script src="${assetHelper().path("js/jquery-1.12.4.js")}"></script>
<script src="${assetHelper().path("js/jquery-ui.js")}"></script>
<script src="${assetHelper().path("bootstrap/js/bootstrap.bundle.min.js")}"></script>
<script src="${assetHelper().path("bootstrap/js/bootstrap-table.min.js")}"></script>
<script src="${assetHelper().path("js/general.js")}"></script>
@for(var resource : assetHelper().bundle("globals").getAssets().getJs())
<script src="${assetHelper().bundlePath(resource)}" type="module"></script>
@endfor

$unsafe{renderedBody}

@for(var file : getScriptFiles())
<script src="${assetHelper().path("js/" + file + ".js")}"></script>
@endfor
@for(var file : getDeferScriptFiles())
<%-- Defer to ensure it runs *after* globals have loaded --%>
<script src="${assetHelper().path("js/" + file + ".js")}" defer></script>
@endfor

@for(var script : getInlineScripts())
${script}
@endfor

@for(var file : getBundleFiles())
@for(var resource : assetHelper().bundle(file).getAssets().getJs())
<script src="${assetHelper().bundlePath(resource)}" type="module"></script>
@endfor
@endfor
</body>
</html>
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **Java:** [tree-sitter/tree-sitter-java](https://github.com/tree-sitter/tree-sitter-java) 🐌
- **Java Properties:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **Java Server Pages:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **Java Template Engine:** [maj2c/jte-template-syntax-highlight](https://github.com/maj2c/jte-template-syntax-highlight)
- **JavaScript:** [tree-sitter/tree-sitter-javascript](https://github.com/tree-sitter/tree-sitter-javascript) 🐌
- **JavaScript+ERB:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **Jest Snapshot:** [jest-community/vscode-jest](https://github.com/jest-community/vscode-jest)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/jte-template-syntax-highlight
200 changes: 200 additions & 0 deletions vendor/licenses/git_submodule/jte-template-syntax-highlight.dep.yml