Skip to content

Commit

Permalink
feat: Add support for ERB templates (#1559)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Lewis <[email protected]>
  • Loading branch information
Ian Lewis authored Sep 3, 2024
1 parent f3c2e0e commit 5809435
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support was added for
[Powershell](https://learn.microsoft.com/en-us/powershell/).
- Support was added for [Elixir](https://elixir-lang.org/).
- Support was added for [ERB templates](https://github.com/ruby/erb).

## [0.9.0] - 2024-08-08

Expand Down
7 changes: 4 additions & 3 deletions SUPPORTED_LANGUAGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Supported Languages

46 languages are currently supported.
47 languages are currently supported.

| File type | Extension | Supported comments |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
Expand All @@ -19,7 +19,8 @@
| Go | `.go` | `//`, `/* */` |
| Go Module | | `//` |
| Groovy | `.groovy`, `.grt`, `.gtpl`, `.gvy` | `//`, `/* */` |
| HTML | `.html`, `.hta`, `.htm`, `.html.hl`, `.inc`, `.xht`, `.xhtml` | `<!-- --!>` |
| HTML | `.html`, `.hta`, `.htm`, `.html.hl`, `.inc`, `.xht`, `.xhtml` | `<!-- -->` |
| HTML+ERB | `.erb`, `.erb.deface`, `.rhtml` | `<!-- -->`, `<%# %>` |
| Haskell | `.hs`, `.hs-boot`, `.hsc` | `--`, `{- -}` |
| JSON | `.json`, `.4DForm`, `.4DProject`, `.avsc`, `.geojson`, `.gltf`, `.har`, `.ice`, `.JSON-tmLanguage`, `.jsonl`, `.mcmeta`, `.sarif`, `.tfstate`, `.tfstate.backup`, `.topojson`, `.webapp`, `.webmanifest`, `.yy`, `.yyp` | `//`, `#`, `/* */` |
| Java | `.java`, `.jav`, `.jsh` | `//`, `/* */` |
Expand Down Expand Up @@ -48,5 +49,5 @@
| VBA | `.bas`, `.cls`, `.frm`, `.vba` | `'` |
| Vim Script | `.vim`, `.vba`, `.vimrc`, `.vmb` | `"` |
| Visual Basic .NET | `.vb`, `.vbhtml` | `'` |
| XML | `.xml`, `.adml`, `.admx`, `.ant`, `.axaml`, `.axml`, `.builds`, `.ccproj`, `.ccxml`, `.clixml`, `.cproject`, `.cscfg`, `.csdef`, `.csl`, `.csproj`, `.ct`, `.depproj`, `.dita`, `.ditamap`, `.ditaval`, `.dll.config`, `.dotsettings`, `.filters`, `.fsproj`, `.fxml`, `.glade`, `.gml`, `.gmx`, `.grxml`, `.gst`, `.hzp`, `.iml`, `.ivy`, `.jelly`, `.jsproj`, `.kml`, `.launch`, `.mdpolicy`, `.mjml`, `.mm`, `.mod`, `.mojo`, `.mxml`, `.natvis`, `.ncl`, `.ndproj`, `.nproj`, `.nuspec`, `.odd`, `.osm`, `.pkgproj`, `.pluginspec`, `.proj`, `.props`, `.ps1xml`, `.psc1`, `.pt`, `.qhelp`, `.rdf`, `.res`, `.resx`, `.rs`, `.rss`, `.sch`, `.scxml`, `.sfproj`, `.shproj`, `.srdf`, `.storyboard`, `.sublime-snippet`, `.sw`, `.targets`, `.tml`, `.ts`, `.tsx`, `.typ`, `.ui`, `.urdf`, `.ux`, `.vbproj`, `.vcxproj`, `.vsixmanifest`, `.vssettings`, `.vstemplate`, `.vxml`, `.wixproj`, `.workflow`, `.wsdl`, `.wsf`, `.wxi`, `.wxl`, `.wxs`, `.x3d`, `.xacro`, `.xaml`, `.xib`, `.xlf`, `.xliff`, `.xmi`, `.xml.dist`, `.xmp`, `.xproj`, `.xsd`, `.xspec`, `.xul`, `.zcml` | `<!-- --!>` |
| XML | `.xml`, `.adml`, `.admx`, `.ant`, `.axaml`, `.axml`, `.builds`, `.ccproj`, `.ccxml`, `.clixml`, `.cproject`, `.cscfg`, `.csdef`, `.csl`, `.csproj`, `.ct`, `.depproj`, `.dita`, `.ditamap`, `.ditaval`, `.dll.config`, `.dotsettings`, `.filters`, `.fsproj`, `.fxml`, `.glade`, `.gml`, `.gmx`, `.grxml`, `.gst`, `.hzp`, `.iml`, `.ivy`, `.jelly`, `.jsproj`, `.kml`, `.launch`, `.mdpolicy`, `.mjml`, `.mm`, `.mod`, `.mojo`, `.mxml`, `.natvis`, `.ncl`, `.ndproj`, `.nproj`, `.nuspec`, `.odd`, `.osm`, `.pkgproj`, `.pluginspec`, `.proj`, `.props`, `.ps1xml`, `.psc1`, `.pt`, `.qhelp`, `.rdf`, `.res`, `.resx`, `.rs`, `.rss`, `.sch`, `.scxml`, `.sfproj`, `.shproj`, `.srdf`, `.storyboard`, `.sublime-snippet`, `.sw`, `.targets`, `.tml`, `.ts`, `.tsx`, `.typ`, `.ui`, `.urdf`, `.ux`, `.vbproj`, `.vcxproj`, `.vsixmanifest`, `.vssettings`, `.vstemplate`, `.vxml`, `.wixproj`, `.workflow`, `.wsdl`, `.wsf`, `.wxi`, `.wxl`, `.wxs`, `.x3d`, `.xacro`, `.xaml`, `.xib`, `.xlf`, `.xliff`, `.xmi`, `.xml.dist`, `.xmp`, `.xproj`, `.xsd`, `.xspec`, `.xul`, `.zcml` | `<!-- -->` |
| YAML | `.yml`, `.mir`, `.reek`, `.rviz`, `.sublime-syntax`, `.syntax`, `.yaml`, `.yaml-tmlanguage`, `.yaml.sed`, `.yml.mysql` | `#` |
18 changes: 17 additions & 1 deletion internal/scanner/languages.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var (
xmlBlockComments = []MultilineCommentConfig{
{
Start: []rune("<!--"),
End: []rune("--!>"),
End: []rune("-->"),
AtLineStart: false,
},
}
Expand Down Expand Up @@ -293,6 +293,22 @@ var LanguagesConfig = map[string]*Config{
MultilineComments: xmlBlockComments,
Strings: cStrings,
},
"HTML+ERB": {
LineComments: nil,
MultilineComments: []MultilineCommentConfig{
{
Start: []rune("<!--"),
End: []rune("-->"),
AtLineStart: false,
},
{
Start: []rune("<%#"),
End: []rune("%>"),
AtLineStart: false,
},
},
Strings: cStrings,
},
"Haskell": {
LineComments: []LineCommentConfig{
{
Expand Down
Loading

0 comments on commit 5809435

Please sign in to comment.