@@ -104,7 +104,7 @@ private static int skipBOM(byte[] bytes, int length) {
104
104
105
105
/** Information about supported file types. */
106
106
public static enum FileType {
107
- HTML (".htm" , ".html" , ".xhtm" , ".xhtml" , ".vue" , ".hbs" , ".ejs" , ".njk" , ".html. erb" ) {
107
+ HTML (".htm" , ".html" , ".xhtm" , ".xhtml" , ".vue" , ".hbs" , ".ejs" , ".njk" , ".erb" ) {
108
108
@ Override
109
109
public IExtractor mkExtractor (ExtractorConfig config , ExtractorState state ) {
110
110
return new HTMLExtractor (config , state );
@@ -120,6 +120,12 @@ protected boolean contains(File f, String lcExt, ExtractorConfig config) {
120
120
if (isBinaryFile (f , lcExt , config )) {
121
121
return false ;
122
122
}
123
+ // for ERB files we are only interrested in `.html.erb` files
124
+ if (FileUtil .extension (f ).equalsIgnoreCase (".erb" )) {
125
+ if (!f .getName ().endsWith (".html.erb" )) {
126
+ return false ;
127
+ }
128
+ }
123
129
return super .contains (f , lcExt , config );
124
130
}
125
131
},
@@ -350,7 +356,7 @@ public static FileType forFile(File f, ExtractorConfig config) {
350
356
351
357
/** Determine the {@link FileType} for a given file based on its extension only. */
352
358
public static FileType forFileExtension (File f ) {
353
- String lcExt = StringUtil .lc (FileUtil .extension (f ));
359
+ String lcExt = StringUtil .lc (FileUtil .extension (f )); // TODO: Here, it doesn't recognize .html.erb files
354
360
for (FileType tp : values ())
355
361
if (tp .getExtensions ().contains (lcExt )) {
356
362
return tp ;
0 commit comments